Windows Fdisk and Diskpart commands



***If you do decide to mess around with diskpart or fdisk I recommend you do this on a computer that you do not use on a daily basis or on a spare hard drive ***

Nearly every windows version uses fdisk except windows 2000/Xp Listed below are the commands for both Windows 95/98 and 2000/Xp operating systems.

Windows 95/98

Fdisk/X this switch ignores Extended disk access support
Fdisk/status this command shows you the status of your hard drive
Fdisk/actok this command prevents fdisk from checking the integrity of the hard drive speeds up the process if this command is used.
Fdisk/mbr this command is used to rewrite the master boot record
Fdisk/cmbr X This command recreates the master boot record on a specified hard drive (change the letter X to the number the harddrive is)
Fdisk1/PRI:100 is the command to create a 100 meg partition on the hard drive
Fdisk1/log:250 is the command to create a 250 meg logical drive on the hard drive
Fdisk1/Ext:500 is the command to create a 500 meg extended partition on the hard drive
Fdisk/Q this command prevents fdisk from booting the system after leaving fdisk

Windows XP/Windows 2000
These two versions of windows do have their own version of fdisk it is called diskpart.

To get to Diskpart in Windows XP
Click on start then select run and type Diskpart in the dialog box that comes up or you can just open the command prompt window and type in Diskpart.

If you are not comfortable using the command prompt to do this there is another way
To begin log in with administrator rights and Click on start then go to control panel and click on performance and maintenance then administrative tools, computer management then select Disk management and configure the harddisk(s) from there.

Windows 2000
At the command prompt type in CD C:\program files\resource kit and press enter then type in diskpart at the command prompt once you have done that the command prompt will have changed to something like this.

Microsoft DiskPart version 1.0
Copyright ©) 1999-2001 Microsoft Corporation.
On computer: DEADADDI-HQBI6R
DiskPart>

If you donít have diskpart on windows 2000 you can download it here
http://www.microsoft.com/downloads/d...displaylang=en

***Before you can issue any commands on a object you first have to select it and once you have selected the object it will remain in focus until you select another object.***

List commands

The List commands used in diskpart are List Disk, List volume and List partition.
The list disk command displays a list of all drives connected in your computer along with size, free space and if they are configured as a basic or dynamic drive(s).
The List Volume command displays a list of available volumes, label, format type , type of volume, drive letter and if the volume contains a O.S.
The List partition command displays the partition table of the current drive that is in focus along with the partition type, size and offset.

Select commands

The select commands are
Select disk X
Select volume X
Select partition X

Replace X with the number of the drive you want to put into focus if you donít know which object is currently in focus just type any of these commands in list disk ,list volume or list partition and a asterisk (*) appears next to the drive with focus.

When you select an object, the focus remains on that object until you select a different object. For example, if the focus is set on disk 0, and you select volume 1 on disk 1, the focus shifts from disk 0 to disk 1, volume 1. Some commands will automatically change the focus. As a example, when you create a new partition, the focus will automatically switch to the new partition created.

Create a partition
The three commands that are used to create partitions are
Create partition primary [size=X] [offset=X]
Create partition extended [size=X] [offset=X]
Create partition logical [size=X] [offset=X]

Change the letter X in size to the size you want the partition on the drive to be if you leave it blank diskpart will use all available space.
Change the letter X in offset to set the byte size if you leave it blank the partition will begin at the first free space big enough to hold the partition created.

Assign the partition a letter
After you create a partition you have to assign it a drive letter first you have to put the drive in focus and then use the assign command to give the drive a letter.
Assign [letter=Y] change the letter Y to the letter you want to use ***Note Some letters will not be available such as A or C ***

Extend a partition
If you create a partition that is too small and it is not a current system or boot volume you might be able to extended it to do this.
Type extend [size=X] [disk=X]
change the X in size to the number of megabytes you want to add to the partition the disk parameter is only used with dynamic drives.

The unallocated space must be a higher offset than the currently selected partition, if the partition you want to extend has never been formatted or is formatted with the NTFS file system then it will lose no data, if it has been formatted in another file system other than ntfs then extending it will fail and the partition will remain unmodified or changed.

Delete a partition
***You canít delete a system or boot partition or any partition that contains a active paging file
Also double check you have the right partition in focus before you delete any partition***


The first step in deleting the partition currently in focus type delete partition and press enter
Then type select disk 1 or what ever the number of the disk is.
then type select partition 2 or what ever number the partition is that you want to delete is
then type delete partition and it will be deleted.

Clean commands
The clean command will erase any partition that windows doesnít recognize or to remove partitioning information if you made a mistake and it will also overwrite the MBR (master boot record) and any hidden sector information.

Clean all
The clean all command removes all partitions and volume information from the harddrive currently in focus forcing each sector to be zeroed which completely erases all data on the drive.

Fix boot
The fixboot command is only available when you are using the Recovery Console
Using the fixboot command without any parameters will write a new partition boot sector to the system partition you are logged on to.
fixboot X:

Fixmbr
Fixmbr Repairs the master boot record of the boot disk. The fixmbr command is only available when you are using the Recovery Console
fixmbr [device_name]

The device (drive) on which you want to write a new master boot record. The name can be obtained from the output of the map command. A example of a device name is:
\Device\HardDisk0.

Map
Displays a mapping of drive letters to physical device names. The information it gives you is useful when you run the fixboot and fixmbr commands. The map command is only available when you are using the Recovery Console
Map [arc]


Thank you for reading this.