Sunday, March 22, 2009

Diskpart.exe command utility

Diskpart.exe command prompt utility can be used to enable storage configuration from a script, a remote session, or another command prompt. (Not for Dynamic Disks)

In Windows Vista you cannot always extend volume or shrink volume in the Disk Management tool even though there is room for it. It usually is because there are unmovable system files at the end of the volume. Here are some tips on how to solve this.

Here are the DISKPART command parameters from within Windows Vista.

DISKPART> help

Microsoft DiskPart version 6.0.6002

ACTIVE      - Mark the selected basic partition as active.
ADD         - Add a mirror to a simple volume.
ASSIGN      - Assign a drive letter or mount point to the selected volume.
ATTRIBUTES  - Manipulate volume or disk attributes.
AUTOMOUNT   - Enable and disable automatic mounting of basic volumes.
BREAK       - Break a mirror set.
CLEAN       - Clear the configuration information, or all information, off the disk.
CONVERT     - Convert between different disk formats.
CREATE      - Create a volume or partition.
DELETE      - Delete an object.
DETAIL      - Provide details about an object.
EXIT        - Exit DiskPart.
EXTEND      - Extend a volume.
FILESYSTEMS - Display current and supported file systems on the volume.
FORMAT      - Format the volume or partition.
GPT         - Assign attributes to the selected GPT partition.
HELP        - Display a list of commands.
IMPORT      - Import a disk group.
INACTIVE    - Mark the selected basic partition as inactive.
LIST        - Display a list of objects.
ONLINE      - Online an object that is currently marked as offline.
OFFLINE     - Offline an object that is currently marked as online.
RECOVER     - Refreshes the state of all disks in the selected pack. Attempts recovery on disks in the invalid pack, and resynchronizes mirrored volumes and RAID5 volumes that have stale plex or parity data.
REM         - Does nothing. This is used to comment scripts.
REMOVE      - Remove a drive letter or mount point assignment.
REPAIR      - Repair a RAID-5 volume with a failed member.
RESCAN      - Rescan the computer looking for disks and volumes.
RETAIN      - Place a retained partition under a simple volume.
SAN         - Display or set the SAN policy for the currently booted OS.
SELECT      - Shift the focus to an object.
SETID       - Change the partition type.
SHRINK      - Reduce the size of the selected volume.
UNIQUEID    - Displays or sets the GUID partition table (GPT) identifier or master boot record (MBR) signature of a disk.

If you want to install Windows 7 you can use the command line from the Windows 7 DVD and for example run the following to scrink before creating the new partition. You need to boot from the Windows 7 DVD select language select Repair instead of Install.

diskpart
select disk 0
select partition 1
shrink
exit

For more information see Microsoft’s articles “A Description of the Diskpart Command-Line Utility” and “How to extend a data volume in Windows Server 2003, in Windows XP, in Windows 2000, and in Windows Server 2008”.

Another option is to use the Gnome Partition Editor GParted. Here is a tip on how to resize a Windows Vista Partition.

1 comment:

  1. Windows 7 adds Diskpart options "Attach", "Detach", "Expand", "Compact" and "Merge" also.

    ReplyDelete