VMware Cloud Community
JRink
Enthusiast
Enthusiast
Jump to solution

migrating VMs from internal to san storage

Hello,

I've had my ESX server running since Feb with two VMs on the internal storage of an HP DL380 server. I have recently purchased an upgrade for the ESX software from starter to standard edition and purchased a san device (Storevault S500). I am hoping to move my current VMs from internal storage to the SAN device. Can someone point me in the right direction how to accomplish this? Thanks!

JR

Reply
0 Kudos
1 Solution

Accepted Solutions
esiebert7625
Immortal
Immortal
Jump to solution

You can shutdown your VM's, un-register them from ESX (not delete) and then login to the service console and use scp to copy all the files to a new directory you create on the SAN VMFS volume. You would then register the VM by clicking on the datastore in the VI client, selecting Browse Datastore and then finding your vmx file and select Add To Inventory.

Optionally you could make a new directory on the SAN VMFS volume, go to your source VM's directory, type vmkfstools -i to copy the VM disk. You would then create a new VM and tell it to use an existing disk. When you specify the source vmdk disk use only the non-flat filename, it will automatically copy both files to the destination. Once the new VM is running you can delete the old one. You won't be able to use the same VM name when you register it if the old one is there but you can change the name back to the original once the old VM is gone.

View solution in original post

Reply
0 Kudos
23 Replies
ZMkenzie
Enthusiast
Enthusiast
Jump to solution

Sadly it can't be done when your machines are powered on. Just install your san, create zones on the switches, create a vmfs2 partition, then, power off your machines and migrate them using virtualcenter. It's really easy.

Reply
0 Kudos
esiebert7625
Immortal
Immortal
Jump to solution

You can shut the VM's down and select Migrate and then choose your SAN storage. Optionally there is a way to hot-clone if this is important. It's generally easier and safer to do the cold migrate though.

How can I hot clone a VM without using VMware Converter?

• You cannot hot clone a VM with VirtualCenter, a VM must be shutdown to be able to clone it. One option to hot clone a running VM is to install VMware Converter on it. A reboot will not be required if it is running Windows 2003 or Windows XP. Windows 2000 and earlier require reboots because a special driver is installed on the system. Another option to hot clone is using snapshots and vmkfstools, creating a snapshot will prevent any writes to the VM’s original vmdk file as all subsequent writes are written to the –delta.vmdk files that the snapshot creates. You can also use this procedure to cold clone a VM if you do not have VirtualCenter. To cold clone power off your source VM first and there is not need to create a snapshot, you can omit steps 3 and 9 below.

• 1) Login to the Service Console

• 2) Switch to your VM’s directory, ie. cd /vmfs/volumes/MyVolume/MyVM1

• 3) To create a snapshot type through the command line you can use vmware-cmd, the syntax is: “vmware-cmd removesnapshots” which will remove all snapshots for the VM. Optionally you can remove the snapshot using Snapshot Manager in the VI Client.

Fyi…if you find this post helpful, please award points using the Helpful/Correct buttons.

-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-

Thanks, Eric

Visit my website: http://vmware-land.com

-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-

Reply
0 Kudos
JRink
Enthusiast
Enthusiast
Jump to solution

I do not use virtual center at all... How do I accomplish this without virtual center?

edit: this post was made at the same time as the longer post above mine... sorry.

Message was edited by:

JRink

Reply
0 Kudos
ZMkenzie
Enthusiast
Enthusiast
Jump to solution

If you have esx 3.x you can use virtualcenter client, you can find it going to http://ipofyouresxserver, you can then connect directly to esx with that software.

You can also use the console and issue the commands i've written on the first post.

Reply
0 Kudos
oreeh
Immortal
Immortal
Jump to solution

You can't migrate VMs without VC.

In this case vmkfstools is the only option.

Reply
0 Kudos
esiebert7625
Immortal
Immortal
Jump to solution

You can shutdown your VM's, un-register them from ESX (not delete) and then login to the service console and use scp to copy all the files to a new directory you create on the SAN VMFS volume. You would then register the VM by clicking on the datastore in the VI client, selecting Browse Datastore and then finding your vmx file and select Add To Inventory.

Optionally you could make a new directory on the SAN VMFS volume, go to your source VM's directory, type vmkfstools -i to copy the VM disk. You would then create a new VM and tell it to use an existing disk. When you specify the source vmdk disk use only the non-flat filename, it will automatically copy both files to the destination. Once the new VM is running you can delete the old one. You won't be able to use the same VM name when you register it if the old one is there but you can change the name back to the original once the old VM is gone.

Reply
0 Kudos
ZMkenzie
Enthusiast
Enthusiast
Jump to solution

If you are on the same machine, and just need to move from local storage to san you don't need scp, just deregister them and use MOVE (mv src dst), and, anyway, you can use virtualcenter also client. If they are on DIFFERENT servers use vmware converter or, better in this case, vmware importer.

oreeh
Immortal
Immortal
Jump to solution

You would then create a new VM and tell it to use an existing disk.

not needed when you copy (and edit) the vmx (and nvram) file too

Reply
0 Kudos
JRink
Enthusiast
Enthusiast
Jump to solution

This is being migrated to the SAME esx server, yes. The only thing that's changing is I'm adding a SAN and wanting to move the VMs from the internal server storage to the Sotrevault SAN. I am not using Virtual Center either.

Appreciate all the replies. I'll digest them shortly.

JR

Reply
0 Kudos
oreeh
Immortal
Immortal
Jump to solution

Then use vmkfstools to copy the disks and optionally copy the VMX files too.

You have to edit the VMX files since they contain references to the old storage.

esiebert7625
Immortal
Immortal
Jump to solution

I usually just copy the disk and create a new VM, for a simple VM there is generally nothing you really need in the old vmx and it's easier to have it re-create this for you. Either way works equally as well.

Reply
0 Kudos
JRink
Enthusiast
Enthusiast
Jump to solution

Hmm. Something else I just thought about.

If I'm adding a SAN, is it typically best practice to house the ESX OS on the SAN as well? Or keep that on the internal storage? Right now, ESX is running on 2 physical drives that are in a RAID 1 configuration. Wondering if I should have ESX moved over to the SAN as well... Thoughts?

JR

Reply
0 Kudos
oreeh
Immortal
Immortal
Jump to solution

Copying the VMX has one advantage (if you keep the UUID afterwards):

no change in the virtual HW and therefore no (possible) reactivation of Microsoft systems

Reply
0 Kudos
esiebert7625
Immortal
Immortal
Jump to solution

I always prefer to run ESX on local disk and my VMFS volumes on SAN disk, you can use Boot from SAN with ESX but it will require a re-install of ESX.

Boot from SAN Overview

Before you consider how to set up your system for boot from SAN, you need to decide whether it makes sense for your environment.

Use boot from SAN:

! If you don’t want to handle maintenance of local storage.

! If you need easy cloning of service consoles.

! In diskless hardware configurations, such as on some blade systems.

Do not use boot from SAN:

! If you are using Microsoft Cluster Service.

! If there is a risk of I/O contention between the service console and VMkernel.

Good SAN guides...

SAN Configuration Guide - http://www.vmware.com/pdf/vi3_esx_san_cfg.pdf

SAN Conceptual and Design Basics - http://www.vmware.com/pdf/esx_san_cfg_technote.pdf

SAN System Design and Deployment Guide - http://www.vmware.com/pdf/vi3_san_design_deploy.pdf

Reply
0 Kudos
JRink
Enthusiast
Enthusiast
Jump to solution

I guess there's no outstanding reason for me to move the ESX OS to the SAN device as opposed to keeping it on the local storage.

The point maybe moot because I may use a software iSCSI initiator for the Storevault SAN (I will only end up with 4-5 VMs at the very most) and I don't think you use host ESX on a SAN with a software initiator anyways.

Appreciate all the feedback here.

Reply
0 Kudos
wila
Immortal
Immortal
Jump to solution

Additionally you can now also just use my new vm-relocate.sh script and it will handle all of this for you automatically (migrate disks, copy vm configuration, register new, unregister etc..) The original VM is left - not erased - on the storage where it is migrated from. So that you can always go back if required, although haven't had the need for it so far.

On top of that the script will first analyze what it is going to do, then ask for a confirmation.

http://www.vmware.com/community/thread.jspa?threadID=89885

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
Reply
0 Kudos
JRink
Enthusiast
Enthusiast
Jump to solution

I am trying this using vmkfstools. Here is what I am typing in the shell from my VM directory on the source....

"vmkfstools -i CentOS\ Server1-flat.vmdk /vmfs/volumes/san_storage1/CentOS\ Server1/CentOS\ Server1-flat.vmdk"

I receive a "DiskLib_Check() failed for source disk the file specified is not a virtual disk (15)." error.

When looking in my source directory, my flat file is called "CentOS Server1-flat.vmdk" so I'm not sure what I'm typing wrong here. I'm guessing it has something to do with the spaces in the file name/directory.

Any help?

Reply
0 Kudos
esiebert7625
Immortal
Immortal
Jump to solution

If it has a space try putting it in quotes, it's a good idea to not use spaces in any names, it makes things alot easier. Also you have a back-slash instead of a forward-slash in you path...

vmkfstools -i "CentOS Server1-flat.vmdk" "/vmfs/volumes/san_storage1/CentOS Server1/CentOS/ Server1-flat.vmdk"

Reply
0 Kudos
JRink
Enthusiast
Enthusiast
Jump to solution

I tried the quotes already as well. No luck. I'll try again incase I typoed something wrong.

EDIT- I tried again using quotes. Same error.

I can screenshot if necessary.

Message was edited by:

JRink

Reply
0 Kudos