vmware-vdiskmanager -r old_disk.vmdk -t 2 new_disk.vmdkIt is pretty simple, but I also want to reduce the virtual disk capacity at the same time. The original capacity was 40 GiB, and I would like to reduce it to 28 GiB. It turns out that this is not something you can do with a simple command line. I thought I could just add the -s
I thought about using the shrink option (-k), but this option is not to shrink the virtual disk capacity, it is only for reducing the size of the vmdk file itself that was created with the growable option. The virtual disk capacity stays the same. If you actually want to reduce the capacity of your virtual disk, then you will need to:
- Create a new virtual disk with the desirable capacity. You can do this by either using VMware Server or Workstation GUI or using the vmware-vdiskmanager tool. For example, in my case:
vmware-vdiskmanager -c -t 2 -s 28GB -a ide new_disk.vmdk
- Add your new virtual disk to your virtual machine. In VMware Server, you click on Virtual Machine Settings, select Hard Disk, and then click on Add.
- Shrink the logical partition of your existing virtual disk to fit on the new virtual disk. You can use GParted for this as described here.
- Copy your logical partition from the original to the new virtual disk. You can also use GParted for this as described here. If you are copying a boot partition, then it will require you an additional step. After you copied the logical partition to the new disk, you will need to add the boot flag to it. To do that, just right click on the partition, select Manage Flags, then check the boot option as shown below.