38,939
edits
(Updating to match new version of source page) |
(Updating to match new version of source page) |
||
Line 103: | Line 103: | ||
Cloning is the recommended method for copying volumes. While it is possible to make an image of an existing volume and use it to create a new volume, cloning is much faster and requires less movement of data behind the scenes. This method is handy if you have a persistent VM and you want to test out something before doing it on your production site. It is highly recommended to shutdown your VM before creating a clone of the volume as the newly created volume may be left in an inconsistent state if there was writing to the source volume during the time the clone was created. To create a clone you must use the [[OpenStack Command Line Clients|command line client]] with this command | Cloning is the recommended method for copying volumes. While it is possible to make an image of an existing volume and use it to create a new volume, cloning is much faster and requires less movement of data behind the scenes. This method is handy if you have a persistent VM and you want to test out something before doing it on your production site. It is highly recommended to shutdown your VM before creating a clone of the volume as the newly created volume may be left in an inconsistent state if there was writing to the source volume during the time the clone was created. To create a clone you must use the [[OpenStack Command Line Clients|command line client]] with this command | ||
{{Command|openstack volume create --source <source-volume-id> --size <size-of-new-volume> <name-of-new-volume>}} | {{Command|openstack volume create --source <source-volume-id> --size <size-of-new-volume> <name-of-new-volume>}} | ||
==Detaching a Volume== | |||
Before detaching a volume it is important to make sure that the operating system and other programs running on your VM are not accessing files on your volume. If programs are modifying the contents of files on the volume when it is detached, the volume can be left in a corrupted state. Additionally if programs are reading files when a volume is detached it can result in unexpected behaviours of those programs. To ensure files are not being accessed shutdown the VM while you detach the volume. If you would prefer to avoid shutting down the VM, a successful [[Using_a_new_empty_volume_on_a_Linux_VM#Unmounting_a_device|unmounting of the volume]] will also ensure that no files are being accessed before detaching the volume. | |||
To detach a volume, login to the OpenStack dashboard (see the [[Cloud|Cloud wiki page]] for a list of login links) and select the project containing the volume you wish to detach. Use the left side navigation pane to open the "Volumes" menu and select "Volumes". You will be presented with a list of all your volumes for that cloud project. Find the row for the particular volume you wish to detach and look at the "attached to" column, this will indicate where your volume is attached (if it says its attached to <code>/dev/vda</code> it is a boot volume, if it is attached to <code>/dev/vdb</code>, <code>/dev/vdc</code>, etc. it is an additional volume). If it is a boot volume you must delete the attached VM before the volume can be detached. If you try the following procedure on a boot volume before you have deleted the VM it is attached to, you will get an error message saying "Unable to detach volume". If the volume is not a boot volume you do not need to delete the VM it is attached to before proceeding. In the row for the volume you want to detach, go to the drop down box at the far right under the "Actions" column and select "Manage Attachments". On the new "Manage Volume Attachments" screen which appears, the VM the volume is attached to will be listed, next to which will be a "Detach Volume" button. Click this button to detach the volume, it will ask you to confirm you want to detach this volume by clicking the "Detach Volume" button on a second screen that appears. | |||
=Working with images= | =Working with images= |