Вы находитесь на странице: 1из 2

Extending partitions in Windows using DiskPart

Purpose
This article provides steps to expand a virtual disk (VMDK) and then extend a partition using DiskPart in
Microsoft Windows.

Resolution
Caution: VMware strongly recommends that you have backups in place before performing any disk
partition operation. Also make sure the virtual machine has no snapshots, before starting to extend the
VMDK. If the virtual machine has snapshots use "Delete all" from the Snapshot Manager to commit them.
Verify again in the Snapshot Manager, in the Edit Settings and the virtual machine datastore that the
snapshots were committed.
To expand VMDK and extend a partition:

1. Verify that the virtual machine does not have any snapshots by going into the virtual machine's
directory and looking for Delta files. Run the command:
#ls -lah /vmfs/volumes/datastore_name/vm_name/*delta*
-rw------- 1 root root 1.8G Oct 10 10:58 vm_name-000001-delta.vmdk

2. If the virtual machine does have snapshots, commit them using these commands:
#vmware-cmd -l /vmfs/volumes/datastore_name/vm_name/vm_name.vmx
#vmware-cmd /vmfs/volumes/datastore_name/vm_name/vm_name.vmx
removesnapshots removesnapshots() = 1

3. Power off the virtual machine. (This is the one you want to expand)
4. To expand the VMDK using the VI Client (if the option exists), Go to the Resource Allocation tab,
5.

click Edit (left side) edit the settings of the virtual machine and click the hard disk you want to
expand.
Enter a new value in the New Size field:

To extend the C: partition, find a helper virtual machine and attach the disk from the first virtual
machine to the helper (helper machine is another virtual machine that has the same OS as the
first virtual machine).
To add an existing virtual disk to the helper virtual machine:

a. Go to the Edit Settings menu of the virtual machine.


b. Click Add > Hard Disk > Use Existing Virtual Disk.
c. Navigate to the location of the disk and select to add it into the virtual machine. (Takes
you to the datacenters [i.e. Xizor-1 or Xizor-2] find the first server the one that is being
expanded)
Note: A helper virtual machine is a virtual machine that has the same operating system to
which you attach the disk.

6. Start the virtual machine (if down).


7. Verify the volume in question has been mounted and has been assigned a drive letter. This can
be set in Windows Disk Management or by selecting the volume and typing assign from within
the DiskPart command. Setting the new drive into the Helper virtual machine.
In versions of Windows prior to 2008, open a command prompt and run the DiskPart command
(this also works in 2008):
C:\Documents and Settings\username>diskpart
Microsoft DiskPart version 5.1.3565
Copyright (C) 1999-2003 Microsoft Corporation.
On computer: USERNAME-HELPER-VM
DISKPART> list volume
Volume ###
---------Volume 0 D
Volume 1 C
Volume 2 E

Ltr Label Fs Type Size Status Info


--- ----------- ----- ---------- ------- --------- -------CD-ROM 0 B
NTFS Partition 30 GB Healthy System
NTFS Partition 10 GB Healthy

Find the volume you want to expand from the first virtual machine. Next step will use that volume
number.
DISKPART> select Volume 2
Volume 2 is the selected volume.
DISKPART> extend
DiskPart successfully extended the volume.
DISKPART> exit
Leaving DiskPart...
Note: Ensure to choose the correct volume. The Size is the old value.

8. In Windows 2008, click Start > Computer Management > Disk Manager, right-click on the
partition and select Extend Volume.

9. Power off and detach the disk from the helper virtual machine. Keep all default settings and do
10.

not delete the VMDK from the disk.


Power on the first virtual machine and verify the disk size change.

Вам также может понравиться