Managing Partitions

 < Day Day Up > 



Common management tasks for partitions include converting FAT and FAT32 partitions to NTFS, changing volume labels, extending partitions, and deleting partitions. These tasks are discussed in this section.

Converting a Partition or Volume to NTFS

If you created a partition or volume using FAT or FAT32, you can convert it to NTFS without having to reformat using the FORMAT command. The advantage of this is that the file and directory structure is preserved and no data is lost. To convert from FAT or FAT32 to NTFS, use the CONVERT command.

Conversion: Preliminary Checks

Before you use CONVERT, you should do the following:

  • Check to see if the partition is being used as the active boot partition or a system partition containing the operating system. With Intel x86 systems, you can convert the active boot partition to NTFS. If you do this, however, CONVERT must have exclusive access to the partition, which can only be obtained during startup. So if you attempt to convert the active boot or system partition to NTFS, you will see a prompt asking if you want to schedule the drive to be converted the next time the system starts. If you click Yes, you can restart the system to begin the conversion process. Just keep in mind that it usually takes several restarts to completely convert the active boot partition.

  • Check to see if the drive has enough free space to perform the conversion. You’ll need a block of free space that’s roughly equal to 25 percent of the total space used by the partition or volume. For example, if the partition stores 20 GB of data, CONVERT will need about 5 GB of free space. CONVERT checks for this free space before running and aborts if there isn’t enough.

Caution

There isn’t a utility for converting NTFS to FAT. The only way to go from NTFS to FAT or NTFS to FAT32 is to delete the partition or volume and then to recreate the partition as a FAT or FAT32 volume.

Handling Basic Conversions

CONVERT is run at the command prompt. If you want to convert a drive, use the following syntax:

convert volume /FS:NTFS 

where volume is the drive letter followed by a colon, drive path, or volume name. For example, if you wanted to convert the D drive to NTFS, you’d use the following command:

convert D: /FS:NTFS
Tip

For volumes converted from FAT or FAT32 to NTFS, the Master File Table (MFT) is created in a different location than on a volume originally formatted with NTFS, which can result in a slowdown in performance. For optimal performance, you might want to use a designated conversion area as discussed in Using the CvtArea Parameter.

On converted boot and system volumes, CONVERT applies the same default security that is applied during Windows Setup. On other volumes, CONVERT sets security so the Users group has access but doesn’t give access to the special group Everyone. To give Everyone access to the data on the disk, you can remove the security settings using the /NoSecurity parameter, such as

convert D: /FS:NTFS /nosecurity
Caution

The /NoSecurity parameter removes all security attributes and makes all files and directories on the disk accessible to the group Everyone.

CONVERT has several additional parameters. You can use the verbose switch (/V) to get more detailed information during the conversion and the force dismount switch (/X) to force the partition or volume to dismount before the conversation if necessary. The main reason for dismounting a drive prior to conversion is to ensure that no application or process tries to use the drive while it is being converted. You can’t, however, dismount a boot or system drive. These drives will be converted when the system is restarted.

The basic conversion procedure works well with most types of disks. Sometimes, however, you may find that this procedure doesn’t yield ideal results. For example, a converted drive could actually slow instead of accelerate. To work around this problem, you can use the /Cvtarea parameter, which sets the name of a contiguous file in the root directory to be a placeholder for NTFS system files.

Using the CvtArea Parameter

Ideally, the more often a file is accessed, the closer it should be placed to the beginning of the drive to decrease the amount of time required to find and read the file. When a drive is formatted, certain NTFS system files should be placed at the beginning of the drive precisely for this reason. However, when you use the basic conversion process, Windows is unable to place the new NTFS system files at the beginning of the disk because that space is already used by other files that need to be retained. As a result, a converted drive could perform somewhat slower than it did when formatted as FAT or FAT32.

Windows Server 2003 and Windows XP resolve this problem by allowing you to designate a conversion area using the CvtArea parameter followed by the name of a temporary file to use. The syntax is

convert volume /FS:NTFS /CVTAREA:FileName 

where FileName is a file created in advance for use as a temporary location, such as

convert C: /FS:NTFS /CVTAREA:temp.txt

This specifies that the Master File Table (MFT) and other NTFS metadata files are written to an existing, contiguous placeholder file called temp.txt. When you use CONVERT without the CvtArea parameter, the FAT system files at the beginning of the disk aren’t moved. They are deleted and subsequent regular files are placed in the location of the old system files. When you use CONVERT with the CvtArea parameter, CONVERT looks for the listed file name and puts a placeholder at the beginning of the disk instead of placing regular files in that location. When the drive is converted to NTFS, CONVERT deletes the CvtArea file and replaces it with the newly completed NTFS system files. Thus, using the /CvtArea parameter can result in a less fragmented file system after conversion.

You create the placeholder file by using the FSUTIL command prior to running CONVERT. CONVERT does not create this file for you. For optimal results, the size of this file should be 1 KB multiplied by the number of files and directories in the file system. The easiest way to determine the number of files and directories in the file system is to check the properties of each of the top-level folders on the drive, record the total number of files and folders, and then compute the totals for all top-level folders. To do this, follow these steps:

  1. Start Windows Explorer, right-click a top-level folder on the drive, and then select Properties.

  2. Note the total number of files and folders for the Contains: entry and then click OK.

  3. Repeat this procedure for each top-level folder, and then add the totals.

Once you have the total number of file and folders, multiply this by 1 KB to determine the size of the placeholder file. For example, if there were 1,000 files and folders, the placeholder file’s size would need to be 1,000 KB. To create the placeholder file, type

fsutil file createnew FileName ByteSize 

where FileName is the name of the file to create and ByteSize is the size of the file in bytes. To create a 1,000 KB file named Temp.txt, we would create a file with 1024000 bytes (each KB is 1024 bytes), such as

fsutil file createnew temp.txt 1024000
Note

Keep in mind, convert overwrites this file with NTFS metadata. After conversion, any unused space in this file is freed.

Changing or Deleting the Volume Label

The volume label is a text descriptor for a volume that has a drive letter. It can be a maximum of 11 characters (including spaces) and is displayed when the drive is accessed in various utilities, such as Windows Explorer. You can change or delete a volume label using the LABEL command.

You can change the volume’s label by using the syntax

label drive: label 

where drive: is the drive letter followed by a colon and label is the text description to assign, such as

label f: AppData
Note

A useful command when working with volume labels is VOL. VOL lists the current volume name (if any).

Extending Partitions

If you create a partition that’s too small, you’ll sometimes want to be able to extend it. Previously, you could only extend partitions using third-party utilities. Now DiskPart provides a solution for extending partitions in one specific scenario: when you want to extend the last partition on the disk, you can do so using the EXTEND command. The last partition is the only one that DiskPart will extend and it does so regardless of whether you are working with a primary partition, extended partition, or logical drive. Keep in mind, however, that you can’t extend boot or system partitions and that you can only extend partitions formatted as NTFS.

The steps you follow to extend the last partition on a disk are as follows:

  1. Invoke DiskPart by typing diskpart at the command prompt.

  2. List the disks on the computer by typing list disk and check the free space.

  3. Select the disk you want to work, such as disk 2, by typing select disk 2.

  4. List the partitions on the selected disk by typing list partition.

  5. Select the last partition in the list. For instance, type select partition 6.

  6. Extend the partition by typing extend size=N

    where N is the amount of space to add in megabytes, such as

    DISKPART> extend size=1000
Note

The size is rounded to the nearest cylinder boundary, which typically results in a slightly larger or smaller disk space being added. Here, the space added is 1004 MB. If no size is given, the partition is extended to fill the unallocated space on the disk.

Tip

You can extend logical drives within extended partitions as well. Here, you extend the logical drive, not the extended partition itself. When you do this, DiskPart will automatically add space to the extended partition and then add it to the selected logical drive.

Deleting Partitions

To change the configuration of a drive that’s fully allocated, you might need to delete existing partitions. Deleting a partition removes the associated file system, and all data in the file system is lost. Before you delete a partition, therefore, you should back up any files and directories that the partition contains.

On a basic disk, you can delete the partition with focus using DELETE PARTITION. You cannot, however, use this command to delete the system or boot partition, or any partition that contains the active paging file or crash dump (memory dump). To see how DELETE PARTITION is used, consider the following example:

  1. Invoke DiskPart by typing diskpart at the command prompt.

  2. List the disks on the computer by typing list disk and hitting Enter and select the basic disk you want to work with by typing select disk followed by the disk number.

  3. List the partitions on the selected disk by typing list partition.

  4. Select the partition to delete by typing select partition followed by the partition number and then delete it by typing delete partition.

More Info

DiskPart allows you to delete only known data partitions. You can override this behavior if you are certain you know what you are doing. To do this, add the Override parameter to the DELETE PARTITION command.



 < Day Day Up > 



Microsoft Windows Command-Line Administrator's Pocket Consultant
MicrosoftВ® WindowsВ® Command-Line Administrators Pocket Consultant
ISBN: 0735620385
EAN: 2147483647
Year: 2004
Pages: 114

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net