How to change default snapshot location in VMware

By default the snapshots which are taken for any vm are stored with their parent in the same directory or storage. Sometimes you may run out of space and you might not be able to take anymore snapshots so in that case you can always use some other location for the storage of snapshots.

But how will you change the default locations of all the snapshots which will be taken for any vm ?

Below are the steps to resolve the above issue;

01. Power off the Virtual Machine

02. Right Click the vm and select Edit Settings

03. Click on Options from the top TAB, select General and open the Configuration parameters

04. Add a new row with the following details

snapshot.redoNotWithParent

05. Save this parameter with a value “true” as shown below

06. Now open the CLI of the host where the vm is located, Go to the vm’s parent directory where all the vm files are stored and open the main .vmx file: Ex;

# cd /vmfs/volumes/xxxxxxxx-xxxxxxxxx-xxxx-xxxxxxxxxxx/test_machine
# vi test_machine.vmx

07. Now add this line anywhere in the .vmx file with the path location where you want your snapshots to be stored

workingDir = “/vmfs/volumes/xxxxxxxx-xxxxxxxxx-xxxx-xxxxxxxxxxx/snapshots”

Save the file and exit

08. Now you need to reload this vm to make the changes take affect.

# vim-cmd vmsvc/getallvms | grep test_machine

09 test_machine [iSCSI-Datastore1] test_machine/test_machine wintestmachine vmx-07

10. Here 07 is the vm id which you can find out using the above command

# vim-cmd vmsvc/reload 07

11. Now when you take snapshots the snapshot files and vm swap files will be created in a different location.

Converting a VMware Linux Guest to HyperV

There are some situtaions where we fail to move Linux based Guest VMs to Hyper V from VMware. If you haven’t figured it out already, the basic problem here is that the Linux VMs (that came from the VMware environment) don’t have the Hyper-V drivers configured because they weren’t needed at installation (again, on VMware), but the Installation ISOs *do* have the drivers at the ready when booting the “rescue system”.

The below article will provide you the correct way to carry out the tasks;

Step 1: Install MVMC2

First, the installation.  Go to the MVMC2 download site, get the software, and install.

Step2: Convert the Disk

Open Powershell *as Administrator* (right-click, run as Administrator), and load the module:

Import-Module “C:Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1”

We need to create a temporary folder for our converted disk — in my case on a separate drive from where my source VMs reside, to speed things up a tad:

md c:MvmcResults
cd c:MvmcResults

And then we can convert out source disk:

ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath “E:Virtual MachinesOpensuse12.3Opensuse12.3.vmdk”
Next, move the newly converted disk to wherever you keep your virtual hard disks (I assume you have a designated location).

Then, create a Generation 1 Virtual Machine in Hyper-V (try to use the same name, memory settings, and so on as before), but choose to “Use an existing virtual hard disk” and set it to the newly converted hard disk.  But before you start it, attach the correct installation ISO (I use the tiny “network install” ISO). 

Step 3: Boot and Mount the Alternate Root

Start the VM (booting from ISO), and choose “Rescue System” as the boot choice.  Tip: while the splash screen is up, hit the escape key and notice the Hyper-V drivers it chose; in my case it was only hv_netvsc and hv_storvsc, but you may have others.

Once at the “Rescue” prompt, enter “root” as the login.

Now, mount the proper disk partition for your root filesystem; this may take some guessing if you don’t remember which is which. If you don’t know, you might have to mount a few of them and look and see what’s in them.  And of course, if you have a separate /boot, you’ll have to mount that too.  But for the examples that follow, we’ll assume the full root file system is all on /dev/sda2.

So mount the root filesystem under the alternate mount point, like this example:

# mount the root
mount /dev/sda2 /mnt
# you may have to mount /boot too, depending on your setup
# mount /dev/sda1 /mnt/boot
# you must re-mount the live dev and proc
mount -–rbind /dev /mnt/dev
mount -–rbind /proc /mnt/proc

# set the chroot environment
chroot /mnt
…and then we’re ready to actually do some fixing.

Step 4: Fix the Modules

Use vi to edit /etc/sysconfig/kernel to include the Hyper-V modules

INITRD_MODULES=”mptspi ata_piix ata_generic vmxnet3 vmw_pvscsi vmxnet”
…or perhaps like this (this example does not have VMtools drivers):

INITRD_MODULES=”mptspi ata_piix ata_generic”
…and with your change, you’re making it look more like this (again, we’re only adding the hv_ modules to the end):

INITRD_MODULES=”mptspi ata_piix ata_generic vmxnet3 vmw_pvscsi vmxnet hv_vmbus hv_netvsc hv_storvsc”
And finally, recreate the initrd with something similar to the following command (this example is taken from one of my older ones). The kernel and initrd specified in the command must match your current kernel the machine boots with.

mkinitrd -k /boot/vmlinux-3.7.10-1.11-desktop.gz -i /boot/initrd-3.7.10-1.11-desktop
…and you’re done!  Type “exit” to end the chroot environment, and “init 0” to shut down.  Go to the settings of the VM, and detach the ISO, and boot it up.

 

Continue reading “Converting a VMware Linux Guest to HyperV”