Cách cấu hình tăng hoặc giảm kích thước ổ cứng ảo .VMDK

1. Cách tăng và chia ổ:

When you created your virtual machine you of course created the number of disks and their sizes as per the requirements, best practice guidelines or just your best estimation for its use. However, as requirements change and the amount of data in your virtual machine grows, from time to time you need add additional storage. How do you resize the virtual disk (.VMDK)?

Resizing virtual disks is relatively straight forward. However, as with anything before making changes ensure you have a backup (especially when making changes to disks).
Note: You cannot change the disk size if you take a snapshot, plus if there was an issue with the disk the snapshot would be useless anyway.
Another thing to be aware of is you can only INCREASE the size of a virtual disk. You cannot reduce the size of a virtual disk, VMware does not currently allow it as it could risk losing data. If you want to reduce the disk size you could either use VMware converter to copy the VM and resize the disks at the same time or create a new smaller virtual disk and copy the data over to it.
To Increase the size of a virtual disk (.VMDK):

1. Shutdown the virtual machine.
2. Right click on the virtual machine and select “Edit Settings”.

3. On the “Hardware” tab, select the virtual disk you would like to resize and in the “Capacity” section enter the required size.

We are not finished yet. If you boot the virtual machine now the OS will not see the new size, it will only see the old size. You need to expand the volume into the new free space. Below are two methods of doing this, and deeding on the guest OS and your preference depends which one you will choose.
Method 1 (Windows DISKPART) will of course only work in windows.
Method 2 (GParted) will work for any OS, including Linux and Unix provided as the file system type is supported by your chosen partition utility.
Method 1 (Windows DISKPART):
Click Start –> Run and type “diskmgmt.msc”
2. You will see the free space after your volume.

Use DISKPART to extend the volume into all the free space:


list volume

select Volume 0



You will now see the volume has been extended to use all the free space.

Method 2 (GParted):
To resize the partition on the disk use your favorite partition resizing tool. If you don’t have one mine is GParted, which there is a live CD for.
Download the GParted Live CD
1. Click on the “Options” tab and go to “Boot Options”.

2. Tick “Force BIOS Setup” (This will boot into the BIOS screen when the VM is powered on – This is so that you can mount and ISO image before the OS boots.)

3. Click Ok to reconfigure the virtual machine.

4. Connect the ISO image or connect the CD drive with your GParted Live CD (This is easier with force BIOS option set in step 5).

5. Boot into GParted and you will see the current partion in the now much larger disk.

6. Right click on the partition and select “Resize/Move”.

7. Resize the partition to fill entire remaining space and click “Resize/Move”.

8. Click “Apply” to run the resize task. After sometime depending on the size the task will complete.

9. Reboot the computer, remove the CD and boot into the OS.

10. Depending on the OS it may perform a disk check like Windows Server 2003 here.

11. You should now see the disk has been resized.