This page describes how to move data from old end_of_life OpenStack volumes to the new production volume type.

There are meant to be programmatic ways to 'retype' a volume, but as of June 2015 they don't work. Making a new volume of the proper type and copying the old bits over is the only option.

The example shown here will assume the volume is a bootable root for a persistent vm as that is both the most common and most complex case. For non-root volumes the procedure is similar though the device names may change.

Conventions

  • We have a persistent vm called my-vm
  • The root volume is called my-vm-root
  • my-vm-root is of type end_of_life (see volumes web page)

Notes

This documents the safest procedure which involves shutting down the current system and doing an off line copy.

It is possible to minimize downtime by doing a live copy directly from /dev/vda on the running system though this introduces the possibility of a corrupted copy. Corruption is most likely if your volume is used for database storage, so live copy is especially discouraged for database systems.

(If you want to do a live copy, you can, of course, do mount -o remount,ro / before the copy. Of course, that's going to make lots of running things break, and they won't be able to log any errors, except to the console, but the filesystem will be in a consistent state.)

Steps

  1. Rename old volume
    In the volumes tab of the web interface select Edit Volume in the Actions column and change the Volume Name from my-vm-root to old-my-vm-root
  2. Create new volume
    Click on Create Volume at the top of the volumes page and create a new volume called my-vm-root 1G larger than the old volume as due to the way blocks are counted on the different backends the old volumes are slightly larger than the new ones and this field only accept integers (all other values should be left as default)
  3. Set new volume as bootable.
    • from the volumes page select the Edit Volume action for the volume you just created
    • check the Bootable check box at the bottom left of the dialog then click Submit
  4. Launch temporary system for copy
    follow the instructions for launching an ephemeral vm. We will refer to this as temp-vm.
  5. Terminate the old VM
    • do a clean shutdown from within the existing VM (sudo shutdown -h now works well)
    • terminate the instance on the instances webpage
  6. Attach old volume to temp-vm
    • Back on the volumes web page select the Actions pulldown menu next to the old volume (old-my-vm-root) select Edit Attachments
    • from the Attach to instance pull down menu select the name of your temporary instance (temp-vm in this example)
    • in the Device Name field enter /dev/vdb, note: this is a required field but doesn't actually have any effect inside the VM, but since this is the first volume we are attaching (after the vda root volume), it will be assigned to /dev/vdb by the VM operating system.
  7. Repeat previous step attatching the new volume (my-vm-root) as /dev/vdc
  8. ssh into your VM
  9. verify device names
    • check that device /dev/vdb is old volume you wish to copy
      ubuntu@temp-vm:~$ sudo mount /dev/vdb1 /mnt
      ubuntu@temp-vm:~$ ls /mnt # or otherwise check the right bits are there
      ubuntu@temp-vm:~$ sudo umount /dev/vdb1
      
    • check that /dev/vdc is the new empty volume
       ubuntu@temp-vm:~$ sudo sfdisk -l /dev/vdc
      
      Disk /dev/vdc: 20805 cylinders, 16 heads, 63 sectors/track
      
      sfdisk: ERROR: sector 0 does not have an msdos signature
       /dev/vdc: unrecognized partition table type
      No partitions found
      
      you should see that the device does not have a partition table. Again, the important part of the output is
      sfdisk: ERROR: sector 0 does not have an msdos signature
       /dev/vdc: unrecognized partition table type
      
      that error meand the device is blank which is what we want to be very sure of.
  10. Copy of the old disk to the new disk
    sudo dd if=/dev/vdb of=/dev/vdc bs=4k
    
    this will include the partition structure and boot loader.
  11. Detach drives or terminate the temp-vm
    • If you have more volumes to convert keep the temp-vm running but detatch the volumes
      on the volumes web page, again select Edit Attachments, this time Delete   Attachemnt to disconnect each volume from the temp-vm instance.
    • If this was the last or only volume you need to convert, simply terminate temp-vm.
  12. Launch & verify new vm by selecting Launch as instance from the volumes Action drop down for your new my-vm-root volume and verify the new my-vm is functioning properly
  13. Delete old volume

-- JonProulx - 03 Jun 2015
Topic revision: 30 Nov 2015, JonProulx
 

MIT Computer Science and Artificial Intelligence Laboratory

 

  • About CSAIL
  • Research
  • News + Events
  • Resources
  • People

This site is powered by Foswiki MIT: Massachusetts Institute of Technology