Move a Cloud Block Storage volume between servers

  • Last updated on: 2016-06-06
  • Authored by: Trenton Guthrie

This article describes how to move a software RAID Cloud Block Storage volume from one Cloud server to another. You might want to perform this task when you need to build to a larger General Purpose server.

Prerequisites

Before you can perform this task, you must have a software RAID volume. For information about creating a RAID volume, see Configure a software RAID on a Linux General Purpose Cloud server.

Detach the RAID volume

You must detach the volume from the source server before you can move it to the destination server.

  1. Run cat mdstat to see the name of the md device, as seen in the following example:

    cat /proc/mdstat
    Personalities : [raid1]
    md0 : active raid1 xvdc[1] xvdb[0]
    157155200 blocks super 1.2 [2/2] [UU]
    

In this example, the md device is md0.

  1. Run the mount command to find the mount point.

    mount
    /dev/md0 on /raid type ext3 (rw)
    

In this example, the volume mounted is /raid.

Unmount the RAID volume

  1. Unmount the volume, as shown in the following example:

     unmount /raid
    
  2. Use mdadm to deactivate the md device, as shown in the following example:

    mdadm --stop /dev/md0
    mdadm: stopped /dev/md0
    
  3. In the Cloud Control Panel, navigate to the details page for the server from which you want to detach the Cloud Block Storage volumes that composed the RAID.

  4. In the Storage Volumes section of the server details page, click the Actions gear next to each volume that you want to detach, and select Detach Volume.

  5. In the warning pop-up box, click Detach Volume.

Attach the RAID volume

  1. Attach the RAID volume to the Destination server.

  2. Run fdisk -l to see the device IDs of the newly attached Cloud Block Storage volumes.

    Disk /dev/xvdb: 161.1 GB, 161061273600 bytes
    255 heads, 63 sectors/track, 19581 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    Disk /dev/xvdc: 161.1 GB, 161061273600 bytes
    255 heads, 63 sectors/track, 19581 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    

Recreate the RAID volume

  1. Install mdadm on destination server if it is not already installed.

For Redhat, CentOS, Fedora, and Scientific Linux (SL):

   sudo yum install mdadm

For Ubuntu or Debian:

   sudo apt-get update
   sudo apt-get install mdadm
  1. Reassemble the volumes in the RAID.

    mdadm --assemble --scan
    mdadm: /dev/md/0 has been started with 2 drives.
    
  2. Remount the RAID.

    mkdir /newraid
    mount /dev/md0p1 /newraid
    

Continue the conversation in the Rackspace Community.