Moving a VM from SAN to Local Storage on Citrix XenServer

(Or Local Storage to SAN)

Couldn't be easier!

In XenCenter, find the machine you want to copy or move

Shut down the machine

Right click it and choose "Copy VM"

You're probably better off copying it rather than moving it, you can always delete the original later!

If you're moving from local to SAN, or SAN to local, you want to choose "Full Copy"

Pick the appropriate destination Storage Repository

Click Copy

Wait a while

Done

Make sure you delete or otherwise tag the original so you don't have them both up at the same time, unless you then change the MAC and IP of one of them.

From a bash prompt locally or ssh:

xe vm-list to get the name of the vm

xe sr-list to get the uuid of the destination SR

xe vm-copy vm="ABCServer" sr-uuid=24565487-accf-55ed-54da54873ade784a new-name-label="Copy of ABCServer" new-name-description="New Description"

Wait a while

Done

Posted in bash, example, howto, linux, xen
2 comments on “Moving a VM from SAN to Local Storage on Citrix XenServer
  1. Pandu E Poluan says:

    Hi! Thanks for this wonderful tip!

    I'm wondering if you have some specific tips for my situation:

    There's a Testing-stage VM (Windows guest) that somehow ends up in the Production SAN Storage, and with one volume a bit too big (by 200GB :P). I want to move the store to the Testing SAN Storage. I had originally planned to do the following steps:

    1. Create a new volume on the Testing SAN Storage, of the proper size.
    2. Copy (file-by-file) the too-big volume's contents to the new volume (after shutting down all services accessing that volume), then swapping the drive letters afterwards and detaching the older virtual disk
    3. Migrate only the C: volume to the Testing SAN Storage.

    However, after reading your nice article here, I think I'll modify the plan as such:

    1. Create a temporary volume somewhere, but not on the final destination.
    2. Perform the file-by-file copy similar to step #2 above.
    3. Shutdown the VM and Copy VM, thus moving all volumes in one fell swoop to the new store.

    What do you think?

  2. Brad says:

    Well, shrinking a partition is always an option but only if you can do it safely (i.e. snapshot it first) but when you need to resize the partition or disk itself, that transcends the snapshot and basically makes things pretty weird to roll back. SO, option 2 is better, and should work fine. If there are millions of small files or it is a complex drive (houses Exchange or AD or pagefile) you may have problems swapping things around. In that case I would try to clone and resize it with Clonezilla. Clonezilla works very well from a bootable ISO and while it looks a bit complicated, as long as you read things carefully and know FOR SURE which disk has your data and which is blank, Clonezilla works great!

    If you want to live on the edge, grab a GParted ISO and just resize the partition directly, but I don't recall if you can shrink a virtual disk with any kind of accuracy on XenServer so that may just be a creative way to blow it up...

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Layer 8 Consulting

Layer 8 Consulting was formed to provide experts and expertise to small businesses needing professional support for their networks, web hosting, computers, and virtualization needs.