On Debian based distro you should use virt-resize
instead. This handle pretty much everything under the hood now. Let's assume your image is called Win7 (why not?). First thing make sure your VM is shut down:
Install the tool:
# apt-get install libguestfs-tools
Get the location of your VM disk:
# virsh dumpxml Win7 | xpath -e /domain/devices/disk/source
Found 2 nodes in stdin:
-- NODE --
<source file="/var/lib/libvirt/images/Win7.img" />
-- NODE --
<source file="/var/lib/libvirt/images/Win7.iso" />
You may need to adapt /var/lib/libvirt/images/Win7.img
in the following:
# virt-filesystems --long --parts --blkdevs -h -a /var/lib/libvirt/images/Win7.img
Name Type MBR Size Parent
/dev/sda1 partition 07 100M /dev/sda
/dev/sda2 partition 07 32G /dev/sda
/dev/sda device - 32G -
Create your 64G disk:
# truncate -s 64G /var/lib/libvirt/images/outdisk
You'll need to expand /dev/sda2 (not the boot partition):
# virt-resize --expand /dev/sda2 /var/lib/libvirt/images/Win7.img /var/lib/libvirt/images/outdisk
Examining /var/lib/libvirt/images/Win7.img ...
100% [progress bar] --:--
**********
Summary of changes:
/dev/sda1: This partition will be left alone.
/dev/sda2: This partition will be resized from 32G to 64G. The
filesystem ntfs on /dev/sda2 will be expanded using the
'ntfsresize' method.
**********
Setting up initial partition table on outdisk ...
Copying /dev/sda1 ...
Copying /dev/sda2 ...
100% [progress bar] 00:00
100% [progress bar] 00:00
Expanding /dev/sda2 using the 'ntfsresize' method ...
Resize operation completed with no errors. Before deleting the old
disk, carefully check that the resized disk boots and works correctly.
Make a backup just in case (or use mv
if you do not want the backup):
# cp /var/lib/libvirt/images/Win7.img /var/lib/libvirt/images/Win7.img.old
# mv /var/lib/libvirt/images/outdisk /var/lib/libvirt/images/Win7.img
Now boot !
For more info: man virt-resize
Seems the same question's already been asked on SuperUser - Where can I find Ubuntu Desktop releases on a vmdk
The following is the accepted answer:
I have not found any official ubuntu website distributing vmdk's.
According to http://www.vmware.com/appliances/directory/
very few suppliers of ubuntu desktop on vmdk exist (3 to be exact).
This seems to be focused on vm creation and distribution, and for now
I consider this the de-facto website to go to for ubuntu desktop
vmdk's: http://vmplanet.net/
These guys seem to have vm creation and distribution as a side-project
to their main line of business: http://www.quotrader.com/
http://www.bitconstructor.com/
but the highest-voted answer is as follows:
You can find many VMs on VMware's site.
Open the site and go to "Virtual Appliances"; Ubuntu LTS 11.4 is one
of the many images there.
The newest Ubuntu 11.04 VMware appliance starts out of the box with a
desktop looking like Gnome 2.x, but can be transformed to start the
Unity desktop from Ubuntu. Contrary to the basic Ubuntu 11.04 image
this one has the latest VMware Tools installed.
Note: The VMware's site also seems to have Ubuntu 12.04, both desktop and server versions but it's the VMWare store and you have to buy it.
The OP also adds:
just make sure you have installed the latest vmware player so you
don't have problems like I had with vmplayer not being able to run an
virtual image made with a newer version.
Best Answer
Well, you can create a Live-USB using LinuxLiveUSB-Creator which includes a ready-to-run portable Virtualbox for Windows to immediate use the Live Ubuntu.