Expand Windows NTFS drive on a vmware machine
We use Vmware Server quite heavily at RedBalloon and it gives us a huge amount of flexibility and scalablity without breaking the budget.
An example of this flexibility is how we dealt with a recent problem where one of the drives on our Domain Controller was too small, but we had space available on the underlying Ubuntu Linux VMware Host.
So the plan is to shut down the server, increase the size of the virtual drive, resize the filesystem and we should be good to go.
BTW - this is not for the faint hearted and if done wrong can hose your system.
Here are the steps:
First of all run a chkdsk on the windows drive you are about to resize from within windows:
Then make a backup the disk you are about to resize - it's a virtual disk so we copy the files on the host machine. From the VM directory
sudo cp myDisk.* backup
Expand the original disk with the vmware virtual disk manager and fix the permissions
sudo chown admin:admin myDisk*
You now have a big disk - but the windows NTFS filesystem is only using the original size of the disk. There is no built in way to resolve this in Window but never mind, Linux comes to the rescue again!
Reboot into a Ubuntu Live CD
Open a terminal and run the following commands to resize the filesystem
This is the most dangerous step - as it's where you can really mess up your system.
# Then delete your the relevant partition and recreate a larger one
# Note that it needs to be recreated identically except that the end of the partition is bigger. I.e. it needs the same start point on the disk.
Reboot and windows will run a chkdsk on the drive, then boot and you are all done.

Nice blog, here's my question, ive looked up the vmware-vdiskmanager -x command and i understand the vmware-vdiskmanager is the utility and the -x is responsible for resizing, where i am having trouble is that i have the option of sizing all partitions to 2gb so i have a bunch of *.vmdk files.
So my question is "Do i apply the change to only one file or is there a different method employed when the 2gb option is selected?"
Thanks a lot
Ryan
You should apply this to the main .vmdk file - this will be the one that doesn't have a sequence number beside it.
eg: a 6GB disk might look like:
mydisk.vmdk
mydisk-001.vmdk
mydisk-002.vmdk
mydisk-003.vmdk
You should do any operations on the mydisk.vmdk which is a text file (have a look inside to get a better understanding of how it works).
Cheers,
Mark
Actually, you can deal with that under windows, if you have converted the disk to a dynamic disk. You can add a new volume in the new free space, and extend the existing volume onto the new volume using disk management, but only if the volume is not the boot volume (Or maybe boot disk), so best practice under windows server is to have a small(10G or less?) C drive, and install all your programs or data onto an expandable D drive.
Jeff
I don't understand the steps you take after having booted into a Live CD.
Are you using fdisk to re-create the /*host*/ partition on which the virtual disk resides? The host partition is already large enough. Likewise, how do you run ntfsresize on /dev/sdb? The virtual disk only consists of a vmdk file, not a device. ntfsresize will see a vmdk file, not a ntfs filesystem, correct?
I'd like to understand the procedure before I begin...
Thanks for helping,
Fred
On re-reading the article I realise it wasn't totally clear. When you reboot using Ubuntu you are rebooting the virtual machine into ubuntu - as you are going to be doing low level stuff to the windows disk which you can't do when running windows.
When you have booted up the vmware machine with ubuntu you will be able to reference the virtual NTFS disk as something similar to /dev/sda1. You then follow the commands above to resize the disk. Then reboot the virtual machine and you should have a big disk!
PLEASE REMEMBER TO MAKE A BACKUP COPY OF ALL THE VMDK FILES OR THE ENTIRE MACHINE SO IF YOU GET IT WRONG YOU CAN TRY AGAIN.
Cheers,
Mark
Great stuff. Thanks.
Hints:
*Boot virtual machine with Live CD of your choice
*sudo fdisk /dev/sdb
-> recreate partition
-> set partition type to "7" ntfs
-> set partition to active
*sudo ntfsresize -s 30G /dev/sdb1
Backup is good! I had to re-do the procedure 3 times before I got it right.
Fred
So, the slight adjustment is: sudo /usr/sbin/ntfsresize /dev/$DEVICEID
Also to be noted is that something like /dev/hda will not work even if there is only one partion. You have to specify /dev/hda1
# losetup /dev/loop0 my-disk-flat.vmdk
# fdisk /dev/loop0
# /sbin/sfdisk -d /dev/loop0
(repartition remember the starting sector and size)
# dmsetup create myntfs --table '0 <partition size> linear /dev/loop0 <starting sector>'
# ntfsresize /dev/mapper/myntfs
# dmsetup remove myntfs
# losetup -d /dev/loop0
I do not know how the 2GB split feature works but if it is just a clean logical break every 2GB, then you could in principle use disk mapper's striping feature to bundle them all up. However I think it would take less time to boot up a live CD in the guest.
Any ideas?
It mounts fine as an NTFS volume after the resizing, but for some reason Windows XP does not like to boot off of it.
ntfsresize -n -s 3276800 /dev/sdb1 (for the dry run)
ntfsresize -s 3276800 /dev/sdb1 (for real(!) )
Windows booted up, ran its chkdsk without error, restarted, reinstalled the disk driver, restarted again and it's up and running flawlessly!!
http://www.batteryfast.com/toshiba/pa3285u-1brs.ph... Battery For Toshiba PA3285U PA3284U A10 A15 E10 E15 F10 laptop battery,
http://www.batteryfast.com/toshiba/pa3123u-1brs.ph... New BATTERY For TOSHIBA 5000 5100 PA3123U PA3178U laptop battery,
http://www.batteryfast.com/toshiba/pa3176u-1bas.ph... Battery For Toshiba Portege M200 M205 PA3128U PA3191U black laptop battery,
http://www.batteryfast.com/toshiba/pa3209u-1brs.ph... Battery for Toshiba Satellite 1100 1110 PA3209U-1BRS laptop battery,
http://www.batteryfast.com/toshiba/pa3399u-1bas.ph... Battery for Toshiba PA3399U-1BRS PA3399U-2BAS 1BAS laptop battery,
http://www.batteryfast.com/toshiba/pa3356u-1brs.ph... Toshiba PA3356U-3BAS PA3356U-3BRS PA3456U-1BRS Battery laptop battery,
http://www.batteryfast.com/toshiba/pa3420u.php toshiba pa3420u-1brs l10 l15 l20 laptop battery,
http://www.batteryfast.com/toshiba/pa3451u.php TOSHIBA PA3451U-1BRS PABAS067 laptop battery,
http://www.batteryfast.com/toshiba/pa3383.php Battery For PA3383 TOSHIBA Satellite PA3383U-1BRS 12cells laptop battery,
http://www.batteryfast.com/toshiba/pa3431u-1brs.ph... TOSHIBA SATELLITE M65 BATTERY PA3431U-BRS PABAS068 laptop battery,
http://www.batteryfast.com/clevo/m540.php clevo m540 laptop battery,
http://www.batteryfast.com/clevo/m375.php clevo m375 m360 M300N M310N laptop battery,
http://www.batteryfast.com/clevo/dr202.php clevo dr202 me202bb laptop battery,
http://www.batteryfast.com/fujitsu/s2000.php fujitsu fpcbp64 s2000 s2010 s2020 laptop battery,
http://www.batteryfast.com/fujitsu/cbp109.php fujitsu fucbp109 S7011 S7021 S7025 laptop battery,
http://www.batteryfast.com/fujitsu/fpcbp49.php fujitsu fpcbp49 P1000 P2000 laptop battery,
http://www.batteryfast.com/uniwill/un255.php uniwill 255-3S4400-G1L1 un255 laptop battery,
follow the commands above to resize the disk. Then reboot the virtual machine and you should have a big disk!
<A href="http://www.vipwargold.com/" target=_blank><FONT size=4><STRONG>war gold</STRONG></FONT></A><FONT size=4><STRONG> </STRONG></FONT><A href="http://www.vipwargold.com/" target=_blank><FONT size=4><STRONG>buy war gold</STRONG></FONT></A><FONT size=4><STRONG> </STRONG></FONT><A href="http://www.vipwargold.com/" target=_blank><FONT size=4><STRONG>warhammer gold</STRONG></FONT></A><BR><A href="http://www.cheaperzone.com/" target=_blank><FONT size=4><STRONG>warhammer gold</STRONG></FONT></A><FONT size=4><STRONG> </STRONG></FONT><A href="http://www.cheaperzone.com/Buy-WOW-Gold/WOW-Gold.Html" target=_blank><FONT size=4><STRONG>buy warhammer gold</STRONG></FONT></A><FONT size=4><STRONG> </STRONG></FONT><A href="http://www.cheaperzone.com/" target=_blank><FONT size=4><STRONG>war gold</STRONG></FONT></A><BR><FONT size=4><A href="http://www.vipwarhammergold.com/" target=_blank><FONT size=4><STRONG>warhammer gold</STRONG></FONT></A><STRONG> </STRONG><A href="http://www.vipwarhammergold.com/" target=_blank><STRONG>buy warhammer gold</STRONG></A><STRONG> </STRONG><A href="http://www.vipwarhammergold.com/" target=_blank><STRONG>war gold</STRONG></A></FONT><BR><FONT size=4><A href="http://www.buyfastgold.com/" target=_blank><FONT size=4><STRONG>warhammer gold</STRONG></FONT></A><STRONG> </STRONG><A href="http://www.buyfastgold.com/buy-warhammer-gold/" target="_blank">http://www.buyfastgold.com/buy-warhammer-gold/" target=_blank><STRONG>buy warhammer gold</STRONG></A><STRONG> </STRONG><A href="http://www.buyfastgold.com/" target=_blank><FONT size=4><STRONG>war gold</STRONG></FONT></A></FONT><BR><FONT size=4><A href="http://warhammer-gold.rgtrcredit.com/" target=_blank><FONT size=4><STRONG>warhammer gold</STRONG></FONT></A><STRONG> </STRONG><A href="http://warhammer-gold.rgtrcredit.com/Buy-warhammer-gold.html" target="_blank">http://warhammer-gold.rgtrcredit.com/Buy-warhammer..." target=_blank><STRONG>buy warhammer gold</STRONG></A><STRONG> </STRONG><A href="http://warhammer-gold.rgtrcredit.com/" target=_blank><STRONG>war gold</STRONG></A></FONT><BR><FONT size=4><A href="http://warhammer.hellgate-pd.com/" target=_blank><FONT size=4><STRONG>warhammer gold</STRONG></FONT></A><STRONG> </STRONG><A href="http://warhammer.hellgate-pd.com/buy-warhammer-gold.html" target="_blank">http://warhammer.hellgate-pd.com/buy-warhammer-gol..." target=_blank><STRONG>buy warhammer gold</STRONG></A><STRONG> </STRONG><A href="http://warhammer.hellgate-pd.com/" target=_blank><FONT size=4><STRONG>war gold</STRONG></FONT></A></FONT><BR><FONT size=4><A href="http://www.vipaocgold.com/" target=_blank><FONT size=4><STRONG>aoc gold</STRONG></FONT></A><STRONG> </STRONG><A href="http://www.vipaocgold.com/buy-aoc-gold/" target=_blank><STRONG>buy aoc gold</STRONG></A><STRONG> </STRONG><A href="http://www.vipaocgold.com/" target=_blank><STRONG>age of conan gold</STRONG></A></FONT><BR><FONT size=4><FONT size=4><FONT size=4><A href="http://www.aocsale.com/" target=_blank><FONT size=4><FONT size=4><STRONG>age of conan gold</STRONG></FONT></FONT></A></FONT><STRONG> </STRONG><A href="http://www.aocsale.com/buy-aoc-gold/" target="_blank">http://www.aocsale.com/buy-aoc-gold/" target=_blank><STRONG>buy age of conan gold</STRONG></A><STRONG> </STRONG><A href="http://www.aocsale.com/" target=_blank><STRONG>aoc gold</STRONG></A></FONT></FONT><BR><FONT size=4><A href="http://www.gold-warhammer.com/" target=_blank><FONT size=4><STRONG>warhammer gold</STRONG></FONT></A></FONT