It has been a while since I started using XenClient on my laptop, and I've always lacked a nice and easy way to resize my VM disk is not synchronized. Because I'm a techie, techie and we're used to love the idea of being aside the standards of the company and preserve our independence. XenClient is a great match for this concept of BYO, even feeling impelled me to study how to resize my personal XenClient VM disks that are not synchronized to the Datacenter.
So let me share with you how I managed to resize my main personalize VM disk (VHD) from my own unique laptop, without the need to SSH.
the first thing you need to do is open a terminal window XenClient receiver. Just go to Receiver for XenClient or press "Ctrl + 0". Once on your home screen, press "Ctrl + Shift + t", and your terminal window should appear asking for your root password (you should know that, for obvious reasons).
The next step is to identify your VM virtual disk (VHD). The discs of all VMs are located at / storage / disks, but there's a bunch of them with names based long UUID. So, which is the one I want?
In your case, it might be easier if you have little or few VM's pretty clear target size of your disk. Remember, these are thin provisioned VHD, so that the size of the vhd do not reflect the actual size of the disk being seen by the virtual machine, but the amount of space used.
IDENTIFY YOUR DISK VM
If you is not that lucky, this is what you do:
Go to " / config / VMS "(using" cd "command) where you will find a lot of db file with a filename based on the VM UUID. These files retain the configuration information of VM, and the discs are specified in the configuration files. Knowing the VM UUID might be difficult, but the name of my VMs is something that I can easily remember. So all I have to do is run the following command:
grep -r -l "My VM Name" /config/vms/*.db
The output of this command should be db file for "My Name VM" VM. Something like this:
/config/vms/b4501705-0232-45da-9d12-9f80e45bd857.db
Now that I have identified the file, we'll dig into it to find VHD disk for this Vm. You can easily type:
/config/vms/b4501705-0232-45da-9d12-9f80e45bd857.db[1945007vi]Once modified the file, scroll to the "Disc" . "0" paragraph represent your mounted iso, and "1" represent your attached drive. So in the "1" section, you will have the "path" value. It would look something like this:
"1": { "path": " / storage / disks /your_vhd_uuid.vhd"This is real we vhd looking for. Great, now we are 100% sure this is the disc. Write it from the Terminal window you will not be able to copy and paste. You will not have a backslash, your path would be like:
"/ storage / disks / your_vhd_uuid.vhd"Type "q + Enter". Exit vi editor
copy the file VHDBut now I have to move my VHD file somewhere, I can then take my VM to resize disk. In my case, I will move the VHD file to a NAS. To avoid this from an additional computer via SFTP or SCP, I would just mount a CIFS share XenClient terminal window as follows:
Create a mount point:
mkdir / mnt / VHD(worked for me)
Run :.
up server_user username =, password = secret //192.168.44.100/share / mnt / VHD [-o-tcifs... where server_user and secret will your credentials to connect to your action.
Hopefully, now you should be able to change in the "/ mnt / VHD" and browse by content with the ls command
while assuming of past, time to copy the VHD file :.
/storage/disks/your_vhd_uuid.vhd cp / mnt / VHD"your_vhd_uuid.vhd" must be the one you have written on a previous step. Now it's time to wait for it to be copied.
There are other ways to copy your file, as you can mount a USB key, but it will still require Linux skills. In this post I will focus on the use of NAS as a storage medium to support the transition vhd.
RESIZING YOUR VHDFor vhd resizing, I will be using "VHD Resizer vmtoolkit". It is easy and neat. You can download it from http://vmtoolkit.com/files/default.aspx
In my case I will install this tool on another virtual machine, so it would be easier for me. It's time to start extra virtual machine and install "VHD Resizer". After installation, I will recommend to map the CIFS file sharing shame, now from your Windows virtual machine. It should be something like:
net use z: \ 192.168.44.100 share / user: [DomainName UserName] / persistent: no vhdIf everything mapped correctly, you can now launch "resizer". You should select your vhd source and destination file. Keep it dynamic and assign the new size. For this I am a screenshot:
Try to have your destination folder on the same hand so it would be easier to return the VHD in XenClient.
therefore resizer will start dumping your sector of a disk to another and ultimately will end.
move the VHD resized iN XenClientnow it's time to import your new VHD file in XenClient. Your new VHD should be about the same size as the previous record
Back in the terminal window on XenClient receiver. ( "Ctrl + 0" + "Alt + Tab" in case your hidden terminal window), you will just need to copy your file as follows:
cp /mnt/vhd/your_vhd_uuid_2.vhd / storage / diskMake sure there is enough space on your physical disk. Otherwise, remove your previous vhd of "/ storage / disk" with the "rm" command.
If you still retain your previous vhd (do as a best practice, so you can easily go back to your previous disc in case something goes wrong with your resized vhd), rename your "old" file, or whatever you feel comfortable to identify it later. for this, use the command " mv "as follows:
mv your_vhd_uuid.vhd your_vhd_uuid_old.vhdNow you must rename your resized vhd It is important that you rename the vhd resized on behalf of the vhd source, otherwise. your VM will mount the disk later.
mv your_vhd_uuid_2.vhd your_vhd_uuid.vhdGuess what. PUT yOUR oN !!! VM
your VM should now be able to start resized from the disk.
EXTEND YOUR VM dISK VOLUMEBut I'm afraid we did not go all the way. If you go to Windows Explorer, you will see your C: drive is the same size as before. You still need to expand volume to include the new unallocated space. To do this, go to Windows Disk Management and you will see something like this:
(Next screenshots are in Spanish, but you understand)
now, right click on C. volume and select "Extend volume" Make sure that your disk is added by specifying the new unallocated space (it should be done automatically by default.) And press "Next."
when finished, you can say now done !!!
If you have managed to get the full path, WELL dONE !!!
Remember to keep a copy of your vhd source as a backup, just in case you need to roll back.
And we hope that you enjoyed this post.
0 Komentar