Always Take Backups

Like so many things, a storage migration has the potential of blowing up in your face. Although I've never personally seen that happen using this process, anything is possible. So make backups of your data. Most storage platforms call this taking a 'snapshot'. For my example I'll show you how to take the snapshot on a NetApp.

  1. # snap create $myvolume $date_premigrate
  2. # snap list $myvolume

The line of code above do the following. First you are taking a real-time snapshot of the data. The variable $myvolume will be substituted with the actual volume name of the *origin* data. This is where your storage already lives. The snapshot name $date_premigrate can be changed to your preference. I like to keep the dates in my snapshot names just so I have a good idea when things can be removed.

Present your destination storage

This is mostly going to be infrastructure specific, depending on which storage platform your new storage is on. 

  • Step 1) Create a volume on the new storage unit, make sure it is at least as big as all of the data you are moving plus some room to grow.
  • Step 2) Present that volume to the host
  • Step 3) Verify the volume exists, most vendors provide tools you can use for this. On a linux host using a NetApp SAN LUN backend you can use the command 
  1. # sanlun lun show -p

Host Side - The Fun Part

Now we are going to play with LVM to get the data moving. ï»¿ï»¿ï»¿We are going to make the new storage into a physical volume and add it to the Volume Group. The we simply move the data and watch the magic. Don't forget to use screen , an admin's best friend. The last command will show you and update on the progress every 10 seconds.

  1. # pvcreate /dev/mapper/$mpath_dest
  2. # vgextend $VolGroup /dev/mapper/$mpath_dest
  3. # vgdisplay
  4. # screen
  5. # pvmove -b /dev/mapper/$mpath_orig /dev/mapper/$mpath_dest
  6. # pvmove -i 10

Expect this process to take a long time. When I moved approximately 500G of data between two fiber attached SAN LUNs it took approximately three and a half hours. *BUT* No downtime, thank goodness you didn't forget to use the 'screen' command. Final steps are really just cleanup. We remove the origin volume from the volume group.

  1. # vgreduce $VolGroup /dev/mapper/$mpath_orig
  2. # pvremove /dev/mapper/$mpath_orig


That was so easy.. I KNOW! I told myself the same thing. This has now become standard practice for me when getting new shiney storage toys. Never forget backups , always use screen. You'll be fine.