7. Work with Partitions
Most hard disks are known by a single drive letter, usually C:. However, any drive can be divided into several partitions, each with its own drive letter.
Most
PC manufacturers these days ship partitioned hard disks. In fact, your
drive may have one primary partition with all your data, plus another,
smaller partition containing your PC's recovery data (to restore your
hard disk to the state it was in when you bought it), and sometimes a
third EISA Configuration
partition . If you decide to nix the
other two partitions, you can combine them and finally start using all
the space on your drive.
But
you also may want to chop up your drive into smaller partitions. For
example, if you have a 500 GB hard disk, you may choose to divide it up
into four 125 GB partitions, or perhaps a 300 GB partition and two 100
GB partitions. There are a bunch of reasons why you might want to do
this:
Organization
Use
multiple partitions to further organize your files and make your stuff
easier to find. For example, put Windows on one drive, work documents on
another, games on another, and music and other media on yet another.
Isolation of system and data
You can use partitions to isolate your programs from your data. For example, place Windows on drive C:, your personal documents on drive D:, and your virtual memory (swap file) and temporary files on drive E:.
This setup gives you the distinct advantage of being able to format
your operating system partition and reinstall Windows without touching
your personal data, and also makes it easier to back up just your data.
Performance
The data on your hard drive can become badly
fragmented with use, which hurts performance and increases the chances
of data corruption. Because files cannot become fragmented across
partition boundaries, you can dramatically reduce fragmentation by
separating frequently accessed files, like those in the Windows and Program Files
folders, from frequently updated files, like your virtual memory (swap
file) and temporary files, as well as infrequently updated files like
photos and music.
Dual-boot
To set up a dual-boot partition, you'll need to create a separate partition for each operating system you install.
Server
If
you're setting up a web server (or other type of network file server)
or if you're participating in peer-to-peer file sharing, it's a good
practice to put the publicly accessible folders on their own partition.
This not only helps to secure the operating system from unauthorized
access, but allows the OS to be upgraded or replaced without disrupting
the shared folders and programs.
7.1. The Disk Management nickel tour
Windows Vista comes with several disk partitioning tools, but the most useful is Disk Management, shown in Figure 8.
You can use Disk Management to view the partitions of any drive on your
system, as well as create, delete, and resize partitions, and even
change the drive letters for any drives or partitions on your PC. Open
the Start menu, and in the Search box, type diskmgmt.msc and press Enter.
The
main Disk Management window is divided into two panes, each of which
shows the same information in different ways. (You can change the
arrangement of the panes by going to View → Top or View → Bottom, but Disk Management won't remember any of your settings for next time.)
The Graphical View, shown in the lower pane by default, is easily the most useful, and is the subject of most of the rest of this section. The Volume List,
shown in the upper pane by default, shows only your hard disk drive
letters, and is a subset of the drive list in Windows Explorer. And the Disk List is merely a list of the physical disk devices in your PC, somewhat like the Disk Drives branch in Device Manager.
By default, the boxes in the Graphical View
representing multiple partitions (volumes) are not displayed
proportionally to their size; a 20 GB partition will appear to be
roughly the same size as a 100 GB partition. To fix this, go to View → Settings, choose the Scaling tab, and select the According to capacity, using linear scaling option in both sections. You can also customize the program's colors with the Appearance tab, but unless you follow the steps in the upcoming "Save Settings in Disk Management" sidebar, your changes will be lost as soon as you close the window. |
|
The Disk Management tool is actually what Microsoft calls a "snap-in" for the Microsoft Management Console (mmc.exe). Other snap-ins include Device Manager, the Services window, and the Group Policy Object Editor. The .msc file you launch to open the Disk Management tool is not actually the program, but rather just a small console file, which contains only the settings for the current view. Although you can't save your customizations to diskmgmt.msc, you can create a new console file with the snap-ins you need, and customize it to your heart's content: Open the Microsoft Management Console (mmc.exe). A new, blank Console Root window will appear in the MMC window. Go to File → Add/Remove Snap-in, and then click Add. Select Disk Management from the Available Standalone Snap-ins list, and then click Add. From the window that appears, select This Computer and then click Finish. You can add other snap-ins at this point, or just click OK when you're done. If
Disk Management is the only snap-in you selected, highlight the Disk
Management entry in the tree on the left to show the tool in the center
pane. Then go to View → Customize, turn off the Console tree and Action pane options, and click OK. Now, you can customize Disk Management as you see fit. For instance, to show only the Graphical View, select View → Top → Graphical View and then View → Bottom → Hidden. When you're finished customizing, go to File → Save to save your custom console view into a new .msc file such as Disk Management.msc.
The next time you use Disk Management, just open your custom .msc file instead of diskmgmt.msc to use your customized tool. |
Disk
Management takes an active role in making drives available in Windows
Explorer. Most of the time, as soon as you insert a flash memory card
into your card reader or pop in a CD or DVD, the new volume appears in
Disk Management and Explorer. But sometimes, Disk Management may fail to
acknowledge that you've connected a device (say, an external hard
disk), and as a result, its drive letter won't appear in Explorer. To
force Windows to recognize your drive changes, press the F5 key or go to Action → Rescan Disks,
and in a few seconds, the newly connected drive should appear in all
windows. If it doesn't, open up Device Manager, and from the Action menu there, select Scan for hardware changes.
In the Graphical View, you'll see different kinds of partitions; here are the most common:
Primary partition
Most
partitions are of this type. If you have more than one partition, the
first usable partition (one that can hold data) is almost always a
primary. Primary partitions are marked with a dark-blue stripe by
default.
The old-school approach is to have only one primary partition, followed by an extended
partition (discussed next). This is no longer needed for NTFS volumes;
in fact, if you're setting up a dual-boot system, each OS must have its
own primary partition.
Extended partition
The
extended partition is a holdover from earlier days, and was used when a
drive had two or more partitions. It doesn't actually hold data, it
merely serves as a container for one or more logical
drives (discussed next). Extended partitions and logical drives are
more or less obsolete today (Vista's Disk Management tool can't even
create them), but you may see them on older partitioned drives. The
extended partition is, by default, shown as a dark-green outline
surrounding any logical drives.
Logical drive
If
you have a drive with an extended partition, each volume inside is
called a logical drive. See the notes for primary and extended
partitions, earlier, for details. By default, logical drives are
identified in light blue.
EISA Configuration
This
is a tiny partition that holds configuration data for the rest of the
drive, and it is typically placed at the beginning of the disk. You'll
see this on most RAID drives
and often on drives installed in mass-produced PCs. Disk Management
can't delete EISA Configuration partitions, but Acronis Disk Director
can.
7.2. Create and delete partitions
Every
hard disk must be partitioned before it can be used, even if that disk
only gets a single partition.
First, open Disk Management (diskmgmt.msc), and make sure the Graphical View, shown by default in the lower pane, is visible. Enlarge the pane and the window if necessary to see all your drives.
To create a new partition, right-click a region of your disk marked Unallocated, and select New Simple Volume.
The steps in the New Simple Volume Wizard are pretty self-explanatory,
and basically involve dialing in a size for the new partition (use the
maximum if you want to use the whole drive), choosing a drive letter,
and picking a filesystem .
Or, to delete an existing partition, right-click the partition and select Delete Volume.
If
you delete a partition, all the data on that volume will be permanently
lost. This happens immediately, and there is no undo. Data on other
partitions of the same physical drive won't be affected. If you wish to
make a partition smaller or larger without erasing the data. |
|
In most cases, newly created or deleted partitions will appear (or disappear) in Windows Explorer immediately.
7.3. Resize and move partitions
Say
you just bought a laptop with an 80 GB hard disk and then discover that
Windows Explorer only sees about 70 GB of it. You open Disk Management
and discover that there's an extra partition, labeled "Recovery,"
consuming about 8 GB. How do you get rid of the extra partition and
reclaim all that space for your data?
Or,
perhaps you've decided to divide a 320 GB hard disk—one that's
currently holding an active Windows installation—into two 160 GB
partitions. How do you make space for the second partition without
deleting the single partition that's currently using the whole disk?
The
solution is to resize the partition, which—thanks to some improvements
in Disk Manager since Windows XP—is not all that hard to do. And you
don't even have to take the data off first. (Of course, despite this
confident prose, it's still wise to back up your entire drive before
messing with partitions.)
To begin, open Disk Management and expand the Graphical View pane so you can see all your drives.
In the case of the unwanted "Recovery" partition, start by right-clicking it in Disk Management and selecting Delete Volume.
You can't undo Delete Volume,
so make sure you can live without the "Recovery" partition before you
proceed. In most cases, it isn't necessary to keep this volume unless
you plan on wiping your hard disk and reinstalling Vista without
the original installation DVD. If you don't have a disc, check with
your PC's manufacturer to see whether they can provide you with one. |
|
Once the "Recovery" partition is gone, you'll have a swath of empty space marked Unallocated
at the end of your drive. (If it's at the beginning, you'll need a tool
like Disk Director, discussed in the next section.) Now all you have to
do is right-click your primary partition and select Extend Volume to resize the remaining partition so that it consumes the unused space.
If
you want to do the opposite—that is, make room at the end of the disk
for a new partition—just right-click the primary partition and select Shrink Volume. After a bit of pondering, Disk Management will show the Shrink dialog (Figure 9), which will probably show you less "available shrink space" than you thought you had coming.
Say
you have about 150 GB of data on your 500 GB drive, but the Shrink
window says you can only reclaim about 75 GB (7,500 MB) of free space.
Why so stingy?
It
turns out that Windows doesn't necessarily store all your data at the
beginning of a partition, but rather scatters it around to help reduce
fragmentation. As a result, there may be some data toward the end,
serving as a barrier to prevent Disk Management from shrinking your
drive past that point.
The solution is to use the command-line Disk Defragmenter tool (defrag.exe) with the -w parameter. When that's done, return to Disk Management and try Shrink Volume once more.
If the Shrink Volume
feature in Disk Management still won't give you as much space as you
need, you'll need a more capable program like Disk Director, covered
next.
7.4. Alternatives to Disk Management
The
Disk Management utility is not your only choice when it comes to
repartitioning drives, but as far as the tools included with Windows
Vista are concerned, it's the best one.
The other usable alternative is Vista's DiskPart utility (diskpart.exe), a way of viewing, adding, and removing partitions from the Command Prompt; see the upcoming sidebar "The DiskPart Command-Line Tool" for a walkthrough.
In
the good old days—also known simply as the old days—the only way to
resize partitions without deleting the data on them was to use a program
called PartitionMagic. But since Symantec bought PartitionMagic and
ruined it, the best choice now is Acronis Disk Director (http://www.acronis.com/), shown in Figure 10.
DiskPart
is essentially the command-line equivalent to the Disk Management tool,
and can be useful in certain situations (such as when Windows won't
start). You'll need to run DiskPart in administrator mode ; one way to do this is to open your Start menu, type diskpart in the Search box, and then when diskpart.exe appears in the search results, right-click it and select Run as administrator. Once it's running, type help at any time to see a list of commands. To get started, here's how to extend a volume in DiskPart: At the DISKPART> prompt, type: list disk
to display all the drives on your computer. Each drive will have a disk number, starting with 0 (zero). Unless you have only one drive, you'll have to tell DiskPart which drive to use, like this: select diskn
where n represents the number of the disk to modify. Next, at the DISKPART> prompt, type: list volume
to display all the volumes on the selected disk. Likewise, each volume has a volume number, starting with 0 (zero). Regardless of the number of volumes on the drive, you'll have to tell DiskPart which one to use, like this: select volume2
Now that you've selected the partition to expand, go ahead and issue this command: extend
to extend the volume. The extend command takes no options and displays no warning message or confirmation. The process begins immediately after you press the Enter key, and should take only a few seconds. When it's done, type exit to quit the DiskPart utility.
|
Among
other things, Disk Director lets you move partitions, resize from the
left (beginning) or right (end), and delete otherwise undeletable
partitions, such as the EISA Configuration volumes discussed earlier in
this section.
Unfortunately,
Disk Director costs money, and if it's not something you're going to
use every day, you may be interested in a free, albeit less convenient,
solution. You can use QTParted, the partition editor that comes with
Linux. Now, you don't have to install Linux, but rather only boot off a
Linux Live CD like the one available at http://iso.linuxquestions.org/mepis/.
It supports NTFS as well as FAT32, and lets you freely resize
partitions without destorying data. (Of course, it's always wise to back
up first.)
7.5. Different ways to mount a volume
As
explained earlier in this section, a hard disk can have one partition
or many. Other types of storage devices, such as CD and DVD drives, can
only have a single partition. These partitions, regardless of the nature
of the physical device on which they're located, are all recognized as volumes by the Disk Management tool and by Windows Explorer.
Mounting
is the method by which a volume is made accessible to Windows Explorer
and all your applications. In most cases, each volume has its own drive
letter, such as C: or D:. But a volume can also be accessed through a folder on any other volume, called a mount point
(available on NTFS drives only). Finally, there can be volumes on your
system that aren't mounted at all, such as those with filesystems Vista
doesn't support and those you don't want to show up in Windows Explorer.
You can change how any volume is mounted, except for the system volume (the one containing your boot files) and the boot volume (the one on which Windows is installed).
To
change the drive letter of a hard disk volume, right-click the
partition itself in the right side of the Graphical View pane in Disk
Management, and select Change Drive Letter and Paths.
Or,
to change the drive letter of a nonfixed disk, such as your DVD drive
or CompactFlash card reader, right-click the disk in the narrow lefthand
column, and select Change Drive Letter and Paths.
In either case, you can choose a new drive letter (e.g., H:) by clicking the Change button, shown in Figure 11. Click Remove if you don't want the drive to show up in Windows Explorer at all. Or, click Add to choose an empty folder as a mount point (or pick a drive letter where there is none).
If you select Mount in the following empty NTFS folder, click Browse
to point to an existing, empty folder on a hard disk that already has a
drive letter. If you were to mount the volume in the folder C:\backdoor, then the contents of the newly mounted drive would be accessible in C:\backdoor. A folder named some folder on the new drive would then appear as D:\backdoor\some folder. You can view all of the drives mounted in folders by going to View → Drive Paths. |
|
Click OK when you're done.