Tuesday, November 10, 2009

Resizing a VMWare Virtual Hard Disk - Linux and Windows OS

http://hagaycarmi.wordpress.com/

*** As this procedure is risky DON’T forget to create a backup of the VM ***

Stage 1 – resizing the VMDK file

On windows:

1. Shutdown the VM.

2. Open CMD and browse to C:\Program Files\VMware\VMware Server

3. From the command prompt, run the command: vmware-vdiskmanager -x 20Gb -t 3 "C:\Users\Marcus\test-OS\ubuntu_test-0001.vmdk"
The last command will set the vmdk file to 20 GB.

On Linux:

1. Shutdown the VM.

2. Open console and browse to the VM directory (Usually under /vmfs/volumes/vol_name/VM_directory)
3. Execute the same command (vmware-vdiskmanager)






Stage 2 – Expanding VM OS File System

On Windows:

1. Boot the OS
2. Open CMD and run diskpart.exe to expand the NTFS File System: http://support.microsoft.com/kb/325590
3. Reboot the OS.
You can also boot the VM OS using Live CD with Gparted: http://gparted.sourceforge.net/livecd.php

On Linux:

1. Reboot with Live CD
2. Check FS integrity: fsck -n /dev/sda1
3. Drop the Journaling from the ext3 FS: tune2fs -O ^has_journal /dev/sda1
4. Use fdisk or parted command to expand the partition.
5. Reboot into Live CD once more.
6. Check FS: e2fsck -f /dev/sda1
7. Resize the ext2 to "fit" the partition: resize2fs /dev/sda1
8. Check FS again: fsck -n /dev/sda1
9. Create the Journal : tune2fs -j /dev/sda1
10. reboot

No comments: