Windows 2003 partition magician: Diskpart

  
                  As everyone knows, under Windows Server 2003, the normal version of the partition magic can not run, and Windows built-in command line tool Diskpart can do most of the work of the partition magic, its function is very powerful. After entering Diskpart, the dedicated prompt shown in the figure is Diskpart> (note: this is not a path), in this environment you can enter a lot of related sub-commands that are also dedicated to it. In the carefully designed case below, you can see how Diskpart expands the partition without destroying the data, which undoubtedly provides a new way for us to manage partitions.
Step 1: Open the Diskpart integrated environment
Start to safe mode with command prompt and enter Diskpart.
Next, enter the list disk to display the installed hard disk. As you can see from the figure, there is only one hard disk, which is displayed as disk 0 (if two hard disks are installed, the second hard disk will be displayed as disk 1). Then type "select disk 0" to select this hard disk (also known as setting the focus attribute for the hard disk). Then enter the list partition to display the partition. Obviously, there are two primary partitions and two extended partitions.
Step 2: Delete partition 3
Enter select partition 3 to make partition 3 (5004MB) have focus attribute, then enter delete partition to delete the partition. Please compare the values ​​of the first and second List partition commands in the figure. It is easy to see that the original partition 3 has indeed been deleted.
Tip: After entering select Partition 3, if you enter the list partition command, you can see that there is an * in front of partition 3. Any hard disk or partition with a focus attribute has an * in front of it, which allows the user to see the current operation object at a glance.
Step 3: Partition expansion
Enter select partition 1 to make it have the focus attribute, and then enter Extend. The last allocated space that was just deleted from the partition can be automatically added to the first partition. Then enter the list partition to observe the capacity change of the partition 1, please compare the values ​​of the first and third list partition commands in Figure 1, you can see this.
Note: When expanding a partition with focus to the nearest unallocated space, for a normal partition, the unallocated space must be on the same disk and must be next to the partition with focus.
If the partition to be expanded is in NTFS format, no data will be lost after expansion; if it is a non-NTFS file system format, this command will fail, but no changes will be made to the partition or data will be destroyed.
Diskpart cannot extend the current boot partition, nor can it expand the partition containing the page file. As can be seen from the figure, there are two primary partitions in "My Computer", and partition 5 is the active partition. Otherwise, partition 1 cannot be expanded.
Extend command syntax:
extend [size=n]
Parameter description: size=n represents the size of the space added to the current partition (in MB), if you do not specify the size, the disk expands to occupy All nearest unallocated spaces.
No matter what changes have been made to the hard disk partition, including creation, deletion, expansion, etc., it does not need to restart the computer to take effect (this is what the partition magician can't do), but in "My computer "(Diskpart works in the command prompt window, you can open "My Computer" from the desktop at the same time) but can't see these partitions. Why is this, it turns out that it has not been assigned a drive letter (that is, a drive letter) ), the following assumes that the first partition specifies the drive letter as an example.
First make the first partition have the focus attribute, and then enter the command Assign, Diskpart will automatically assign a drive letter to it. Of course, it can also be specified manually by the command assign letter=X. When manually specified, it cannot be the same as the existing drive letter. After this processing, you can view these partitions under "My Computer". //This article comes from the computer software and hardware application network www.45it.com
Step 4: Set partition 1 as the active partition
first use select parttition 1 to have the focus attribute and then enter the command active. Finally, enter Exit to exit the Diskpart integration environment and let the computer restart automatically. However, it should be noted that on "My Computer", there must be a complete operating system in partition 1, otherwise the computer will not start properly.
If you are used to Diskpart, you will feel that its design is in line with people's thinking habits. Generally, the focus is specified first, then the operation is performed, and the partition status can be displayed at any time during the operation to grasp the progress. Enter Help to view all the subcommands. When the input is wrong, it will automatically list the subcommand and a brief description to guide you to the right path. In addition, after installing Windows 2003, the most familiar partition magician (non-server version) can't run normally. Using Diskpart has become a good choice. As mentioned above, you must specify the focus before performing any operation under Diskpart. Indicates which object to operate on, which makes the operation logic clear; on the other hand, if you misdirect the focus and perform destructive commands, such as deleting partitions, it will cause irreparable damage. Therefore, please feel free to use the list command to view the status of each partition. There is an asterisk (*) sign before the focus partition.

Copyright © Windows knowledge All Rights Reserved