VMware Cloud Community
FAL-Moray
Contributor
Contributor
Jump to solution

EX 3.5 migrating VM between datastores

hi all,

Not sure if this is correctr location but I am sure this will be moved in required Smiley Happy

Scenario - I have a very small ESX 3.5 server with 6 VM hosted on it. We recently connected and configured a SAN and I am trying to migrate the servers from local storage to the SAN, one at a time. I have written a script that works on the my ESX 3.5 test bed system but will not work on my production system. I cannot get the larger HDDs on the production system to copy over. I run the script as a scheduled task on Saturday afternoon after I have confirmed that my vRanger backup is complete. I reason I am doing a 'cp' as oppsoed to a move is that I like the idea of being able to fall back over to the original VM is required. I know that most of the script work as I can see the original VM powered down and unregistered and all the files except the VMDK copied over from the local storage to the SAN.

I have attached the script I am using as well as the log file that results from it from last weekends run. Can someone please take a look and see what I am doing wrong? This is driving me nuts.

We only have single ESX connected to the SAN and are not using vmotion. The SAN is connected and (I hope) properly configured.

regards

Gord

0 Kudos
1 Solution

Accepted Solutions
FranckRookie
Leadership
Leadership
Jump to solution

What files are missing? Compare your source and destination folders, in case. You can also have a look at this kb http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=100093... to check if you didn't forge anything.

As your script worked on another host, it should also work on that one.

Good luck.

Regards

Franck

View solution in original post

0 Kudos
9 Replies
FranckRookie
Leadership
Leadership
Jump to solution

Hi Gord,

You do not catch error messages from your VMKFSTools command. So there is no information about a problem in your log. You could modify your script and add "2>&1" and the end of lines 60 and 61. You can also have a look at system log files on your host.

If you have a problem only with big VMDKs it could be due to a too small block size on your VMFS. Check that you formatted your SAN with the right block size.

Good luck.

Regards

Franck

FAL-Moray
Contributor
Contributor
Jump to solution

hi Franck,

I will add the switches as suggested and then post the log results after this weekends attempt. I have looged in the Host log files and cannot find anythign that looks like an error. WHat does show up is when the VM tries to power up I see a lot of file not found errors.

The SAN has been formatted with 8MB block sizes while the local storage has 1MB blocks.

Does the script itself look correct?

Any other thoughts?

regards,

Gord

0 Kudos
FranckRookie
Leadership
Leadership
Jump to solution

What files are missing? Compare your source and destination folders, in case. You can also have a look at this kb http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=100093... to check if you didn't forge anything.

As your script worked on another host, it should also work on that one.

Good luck.

Regards

Franck

0 Kudos
FAL-Moray
Contributor
Contributor
Jump to solution

That is what is killing me - the script works fine on my test bed when copying a small VM from local storage to local storage and renaming it along the way. However when I move onto my prod. box the VMDKs fail to copy over. All the other files in the script copy over onto the SAN fine.

I have slightly modifed the script based upon the articles that you mentioned and will see what the result is on Saturday afternoon.

You also mentioned getting some extra loggin from the vmkfstools command? Can you confirm that this is what you have in mine?

vmkfstools -i /vmfs/volumes/storage1/$server/bilbo.vmdk /vmfs/volumes/SANVolume0/$server/bilbo.vmdk 2>&1 >> /scripts/vm_move.log
vmkfstools -i /vmfs/volumes/storage1/$server/bilbo_1.vmdk /vmfs/volumes/SANVolume0/$server/bilbo_1.vmdk 2>&1 >> /scripts/vm_move.log

regards,

Gord

0 Kudos
akshunj
Enthusiast
Enthusiast
Jump to solution

Hi Gord,

Try to perform the copy manually (without renaming) using the mv command and see if that works. I believe the cp command has a file size limitation, which is probably why the copy works with the smaller vmdk files.

0 Kudos
FAL-Moray
Contributor
Contributor
Jump to solution

Yes I noticed that on my test bed.

I was trying to avoid using mv (I found this in a script somewhere online) as I am paranoid about getting into a situation where I have some of the machine on local storage and some on the SAN and being unable to power the silly thing on.

THe last thing I want to do is haul myself in here on a Sunday and spend several hours restoring the sucker from its vRanger backup.

I am using vmkfstools to try and export the VMDK files but that does not seem to be working.

My worst case is coming in on a Sat and using the VIClinet to move the machine between datastores.

0 Kudos
FranckRookie
Leadership
Leadership
Jump to solution

No. You have to put "2>&1" at the end of the line to have error messages written in the same log file as standard messages. In your example, it should give:

vmkfstools -i /vmfs/volumes/storage1/$server/bilbo.vmdk /vmfs/volumes/SANVolume0/$server/bilbo.vmdk >> /scripts/vm_move.log 2>&1

It could also be a timeout problem when copying big files. You could try to catch start and end time of each step in your script to see how long each one takes to complete.

Franck

FAL-Moray
Contributor
Contributor
Jump to solution

Got it - thank you.

I have altered and uploaded and scheduled the script to go off tomorrw (Sat at 1PM). I will check later in the afternoon to see what happens and post the results on Monday mornng.

regards,

Gord

0 Kudos
FAL-Moray
Contributor
Contributor
Jump to solution

hi guys,

Looks as if we got it - thanks for the links and tips.

What I did was to alter the script to use the ID of the volume as opposed to the volume name as per this snip of the script-

# specifying what virtual HDDs to export to the SAN
# vmkfstools -i /vmfolder/vmserver1.vmdk -d 2gbsparse /dest/folder/vmserver1.vmdk

echo "starting vm disk 1 move" >> /scripts/vm_move.log
echo " " >> /scripts/vm_move.log
/bin/date >> /scripts/vm_move.log
echo " " >> /scripts/vm_move.log

vmkfstools -i /vmfs/volumes/46f31629-a68d447d-0996-001b2108da51/bilbo/bilbo.vmdk `
/vmfs/volumes/4c92eda7-f1ebb89e-598d-000ae414532c/bilbo/bilbo.vmdk >> /scripts/vm_move.log 2>&1

echo "disk 1 move complete" >> /scripts/vm_move.log
echo " " >> /scripts/vm_move.log
/bin/date >> /scripts/vm_move.log
echo " " >> /scripts/vm_move.log

echo "starting vm disk 2 move" >> /scripts/vm_move.log
echo " " >> /scripts/vm_move.log
/bin/date >> /scripts/vm_move.log
echo " " >> /scripts/vm_move.log

vmkfstools -i /vmfs/volumes/46f31629-a68d447d-0996-001b2108da51/bilbo/bilbo_1.vmdk `
/vmfs/volumes/4c92eda7-f1ebb89e-598d-000ae414532c/bilbo/bilbo_1.vmdk >> /scripts/vm_move.log 2>&1

echo "disk 2 move complete" >> /scripts/vm_move.log
echo " " >> /scripts/vm_move.log
/bin/date >> /scripts/vm_move.log
echo " " >> /scripts/vm_move.log

echo "vm file move completed" >> /scripts/vm_move.log
echo " " >> /scripts/vm_move.log

/bin/date >> /scripts/vm_move.log
echo " " >> /scripts/vm_move.log

This seems to have solved it.

thanks for the assistance.

regards

Gord

0 Kudos