Regardless of what file system or storage types you have in place on your hard drives , all routine disk maintenance and configuration is done from one place: the Disk Management console, shown in Figure 5.12. Figure 5.12. The Disk Management console.You must be logged on as a Computer Administrator to use this tool. You can open the Disk Management console in several different ways, the two easiest being as follows :
The following are just some of the tasks that can be performed using the Disk Management console:
Some of the more complex of these tasks are discussed in more detail in the following sections, but most can be explained in brief.
Creating New Partitions and Logical DrivesTo create a new partition or logical drive from the Disk Management console, follow these steps:
Note The diskpart command-line utility can also manage disk partitions. For more information, search the Windows Help and Support Center for diskpart . There are two "Overview" articles named DiskPart; one is the diskpart program in the Recovery Console, and the other is for the full version. You want to read the article that starts "DiskPart.exe is a text-mode command interpreter..." Creating New Simple VolumesTo create a new simple volume from the Disk Management console, follow these steps:
You can create other types of volumes on dynamic disks in much the same fashion. Dynamic disk volumes, however, can't be read by Windows 9x or MS-DOS, so you may not want to use them if you dual-boot your computer. Formatting Disks and VolumesFormatting storage media is a fairly common task you can easily accomplish using the Disk Management console. Windows XP supports formatting numerous kinds of media, partly due to its excellent multimedia support. You can format hard drives, removable storage media (such as ZIP drives), and DVD-RAM disks to name a few of your options. Note Although you can format removable media from within the Disk Management console, you most likely won't. Instead it's more likely that you will use Windows Explorer, simply because it's easier to get to an Explorer window and because many of the advanced Disk Management console tools for fixed drives don't apply to removable storage. Windows XP is fairly intelligent and self-protective, and will not allow you to format the system or boot partitions from within the Disk Management console. Those options will be grayed out. To begin the process of formatting a hard drive or removable media device, right-click the volume (or unallocated space) of interest from within the Disk Management console and select Format, which opens the window shown in Figure 5.13. Depending on how large the volume to be formatted is, you will have the choice to format it as FAT16, FAT32, or NTFS. For hard disks, you probably want to use NTFS formatting, unless you have to be able to read and write the disk volume from MS-DOS, Windows 9x, or Linux. To share the volume with MS-DOS, use FAT16; to share with Windows 9x or Linux, choose FAT32. Figure 5.13. Formatting a new drive or partition.
Note We haven't mentioned standard floppy disks. Does anyone use them anymore? I have a huge pile of them sitting around gathering dust. The only way to format standard floppy disks is using Windows Explorer. Standard floppy disks are formatted using a special file system called FAT12, incidentally. Formatting removable media such as DVD-RAM, Flash, or ZIP disks follows the same process, except that you will not have the choice of file systems; all removable media (other than floppies) are formatted with the FAT (which is really to say FAT16) file system. Remember that in order to convert a basic disk to dynamic later on, be sure to select 512 bytes as the sector size. In most cases, this is the smallest size available (due to the physical construction of the hard drive itself) and will be selected by Windows XP automatically if the Allocation Unit Size setting is left as Default, as shown in Figure 25.6. The other options available to you during a format operation are fairly simple, but still deserve some mention.
Of course, should you need to format drives from the command prompt, you still can. The format command has the following syntax: format volume [/fs:filesystem] [/v:label] [/q] [/a:unitsize] [/c] The parameters for the format command are outlined in Table 5.6. Table 5.6. Parameters for the format Command
Creating Mounted DrivesWindows 2000 and XP let you join two separate drives or volumes into one larger, virtual volume. It's called mounting , and it works by making the entire contents of one volume appear in the place of a specified folder on another volume. For example, if I created a new empty folder named c:\mounted , I could format a new hard disk, and mount it to c:\mounted . The root folder of the new volume will appear as the contents of c:\mounted , and subdirectories in the new volume will appear as subdirectories of c:\mounted ...it's all very UNIX-like. One reason you might want to do this is if you needed to add space to an existing file system but don't want to change the directory structure. As long as you don't mind that the added space is only available in a specific set of folders, mounting a new drive is a nifty way to do it. To create a mounted drive from the Disk Management console, follow these steps:
Converting Basic Disks to Dynamic DisksDynamic disks have a slightly different partition structure than the basic disks that we inherited from MS-DOS. Dynamic disks have some advantages; they can have their partition sizes changed, for one thing. They can't be read by older operating systems, so if you dual-boot your computer you probably don't want to use them, but if you're running straight XP and use NTFS-formatted disks already, you might consider it. To convert a basic disk to dynamic from the Disk Management console, follow these steps:
Extending Dynamic VolumesTo extend a dynamic volume from the Disk Management console, follow these steps:
A few things to keep in mind when attempting to extend volumes:
Resizing Basic DisksIf you are using basic storage on your disk drive and you decide that you need to adjust your partition layout after it has been initially created, you have three possible means to this end: You can use the diskpart utility, you can delete and re-create partitions, or you can use a third-party utility such as Partition Magic. Using the extend command within the diskpart utility, you can add more space to existing primary partitions and logical drives as long as you meet the following requirements:
If you meet all the aforementioned requirements, you can extend a basic disk as follows:
If working from the command line is not your thing, and you are not ready to perform mass deletions (as required by the third method), you may want to consider using a third-party disk utility, such as Partition Magic from Symantec. Partition Magic allows you to redesign your partition table graphically within the Windows XP GUI and then on the subsequent restart performs the required actions to carry out your wishes. If you choose not to use either of the other methods presented, you can still resize your basic disks, with no out-of-pocket cost. It is more laborious, however. You'll need to back up all pertinent data on the partition(s) in question, delete the partitions, and then re-create them sized to your liking. After formatting the new partitions, you can then restore your data onto them. Yuck. If you are running with dynamic storage volumes, resizing your volumes is an easy process. You simply right-click on the volume that you want to extend and select Extend Volume. This will open the Extend Volume Wizard, which will allow you to enter the size you want to extend the volume to. After the wizard has finished, which is a relatively quick process, you will have a volume that is now larger...all without a restart of the computer or the time- intensive process of copying and recopying all the files in that volume. It's quite a time saver. Converting FAT16/FAT32 File Systems to NTFSShould you make the decision to upgrade your hard disk's file system from FAT16 or FAT32 to NTFS, you will need to perform the upgrade from the command line by using the convert command. The convert command has the following syntax: convert [ volume ] /fs:ntfs [/v] [/cvtarea: FileName ] [/nosecurity] [/x] The parameters for the convert command are outlined in Table 5.7. Table 5.7. Parameters for the convert Command
To convert your C: drive and apply standard security restrictions, for example, the command is convert c: /fs:ntfs Only hard disks can be updated; NTFS isn't used on removable media like floppies, flash disks and CD-RWs. You can format a USB or Firewire-attached hard drive with NTFS, however. Caution Converting your existing FAT or FAT32 volume to the NTFS file system will preclude you from uninstalling Windows XP at a later date. This is no big loss of freedom if you are upgrading from Windows 2000 or NT because those upgrades are not reversible anyway. But if you hoped to return to Windows 98 or Me, for example, because they don't read NTFS, it's obvious why uninstallation would be problematic . This sort of limitation is one reason why people who deal with multiboot scenarios stick with FAT-based disks. Note Unknown to most people, the convert command has quietly received an upgrade from the Windows 2000 version. Using the convert command in Windows 2000 would produce a volume that did not have the default NTFS permissions settings that you would get after installing Windows itself. The version of convert that comes with Windows XP fixes this problem by automatically applying the correct default permissions to all folders. When used with the /cvtarea switch to create an unfragmented MFT, there is virtually no difference anymore between a volume converted to NTFS during setup of Windows or by using the convert command. Converting the NTFS File System to FAT16/FAT32Reversion from NTFS to FAT16 or FAT32 is not supported by Windows XP; however using a third-party disk utility such as Partition Magic will allow you to perform this task. Hard Drive CleaningIt may seem that after getting your hard drives set up and configured to your liking all of your work is done. Nothing could be further from the truth, unfortunately . Over time, as I'm sure you know, Windows systems do accumulate hundreds and possibly thousands of unnecessary files and folders on your hard drives. Not only do these files and folders waste valuable space, they can slowly degrade system performance. In this section, I am going to blow the top off of some of Windows's secrets and show you how to keep your hard drives slim and trim. Temporary FilesTo Be Eliminated at Any CostWindows XP likes to store its temporary files in three places, more often than not. That is not to say that some rogue program will not deposit some temporary files in another location; just that in most cases you can look in three places to find the dead wood you've been collecting on your system. These three places are
There are two methods for cleaning up temporary files: the GUI-based Disk Cleanup utility and a command-linebased script you can use. Using the Disk Cleanup UtilityThe easiest way to help clean the dead wood from your hard drives is to use the Disk Cleanup utility on a regular basis. The Disk Cleanup utility is launched by clicking Start, All Programs, Accessories, System Tools, Disk Cleanup. You can also launch it by right-clicking on a drive icon in any Explorer window and choosing Properties, Disk Cleanup. There are two useful tricks to getting more out of Disk Cleanup. The first thing is to make use of two undocumented switches for the Disk Cleanup utility that can be accessed from the command line. The second is to schedule the Disk Cleanup utility to run automatically, using advanced settings of your choice, thus purging your hard disk of specific types of unwanted types of files on a regular basis. You can use the command line to gain additional categories of files to delete, as shown in Figure 5.14. Figure 5.14. Additional, more-or-less hidden configuration settings for Disk Cleanup.To use them, follow these steps:
You will probably want to create a Disk Cleanup setting and shortcut for each drive on your system. Defragmenting for Greater SpeedComputers store information on their hard disks in a disorganized fashion, using whatever bits and pieces of free space they find, and as files are added and deleted, the unused space gets more and more spread out in tiny little bits. Imagine if you had to place 50 pieces of paper flat on your desk, without overlapping. You would line them up nicely , one next to the other, in order, although it might nearly cover your desk. Now take 20 pages away at random, and put a 20 page essay down in their place. They can't all get put down side by side now, so you'll have to put each page wherever you can, in any empty space you can find. Fine, but now try to pick them up, in order. Oops! They're all scattered all over the place, and to find page 1, then page 2, then page 3...you're going to be at this for a while. That's fragmentation. And on your hard drive, there aren't just 50 places for pages to be scattered, but tens of millions. Over time, the slowdown from increasing fragmentation becomes significant. Cleaning it up by collecting the scattered pieces of each of your files and moving them into consecutive spaces on the disk is called defragmentation , and Windows comes with a tool to do a fair-to-middlin' job of it. To use the tool:
No matter which way you launch the GUI version of the disk defragmenter; your options are the same. To see whether defragmentation is severe (or more precisely, to see whether the Windows defragmenting tool is going to do anything about it) you can run an analysis on a volume by clicking the Analyze button. When the analysis is complete, you will receive a report similar to the one shown in Figure 5.15. Figure 5.15. The defragmentation analysis results window.
Should you decide to perform the defragmentation, click the Defragment button and watch the progress as shown in Figure 5.16. Figure 5.16. Defragmenting a volume.Defragmenting a volume is an extremely CPU- and hard drive-intensive operation, and it is severely hampered if you continue to work with the computer while it's going on. In particular, saving documents or otherwise writing files to the disk can make the defragmenter have to start over from scratch. As with the Disk Cleanup utility, the true power of the Disk Defragmenter comes if you use the Windows Task Scheduler to create a scheduled event for it and allow it run weekly during a low-usage time, such as early in the morning every Sunday. Tip The defragmentation tool provided with Windows is a "lite" version of a commercial product called Diskeeper. You can also buy disk defragmenters that do a more thorough job, and which, for example, can defragment the Windows page file. Check out PerfectDisk at www.raxco.com and Diskeeper at www.diskeeper.com (with one k) for two such products. Although you can perform disk deframentation with the GUI, you can also do it from the command line, which is helpful if you want to create a cleanup batch file or script. You can defragment a volume with the defrag command, which has the following syntax: defrag volume [/a] [/v] [/f] The parameters for the defrag command are outlined in Table 5.8. Table 5.8. Parameters for the defrag Command
Without options /a or /f , defrag makes its own decision whether to defragment or not. A few points should be kept in mind when attempting to perform disk defragmentation:
Backing Up Your DiskI'm sure I don't need to warn you of the importance of backing up your hard drive. Computers are so much more reliable today than they were even a decade ago, but they do still fail, and you can be sure that one day when you turn on your computer you'll see nothing on the screen but "Hard Drive Failure." All those photographs, emails, songs, all that work...all gone. It's a sickening feeling. And it could happen tomorrow. So: You have to back up. The good news is that it's not expensive, and it's not difficult. You can get a high-capacity tape drive, but these days, I find it's just as easy to use a 200 or 250GB Firewire or USB-2 portable hard drive. These currently cost less than $200less if you find a sale or rebate promotion, and the security they give you is well worth the cost (if it makes you feel better, when the first hard drive came out in 1956, that much disk space would have cost $13.6 billion in today's dollars). My own backups are about 40GB in size, so I can do one a week and easily fit four on a single portable drive. Windows XP (as well as Windows 2000) comes with a backup program that you can use to perform system backups. It's not very sophisticated; you can buy better, but this one is free, and it's provided with every copy of Windows. If you have a larger network, you should seriously think about acquiring an enterprise backup solution, such as Backup Exec or NetBackup. Note NTBackup is provided with Windows XP Home Edition, but it's not installed when you set up Windows. To install it, insert your Windows XP setup CD-ROM, and use Windows Explorer to browse to \VALUEADD\MSFT\NTBACKUP . Double-click ntbackup.msi to install the program. If you're not a Computer Administrator, right-click ntbackup.msi , select Run As, and use an Administrator account. The backup utility in Windows XP has undergone some changes from its predecessor in Windows 2000. The two major changes are support for XP's Volume Shadow Copy feature, and the replacement of the Emergency System Recovery disk with the Automated System Recovery feature on XP Professional. Volume Shadow CopyWhen Windows 2000 performed a backup, files that were in use while the backup was performed were often omitted from the backup set, including important user Registry files. Files that were actively being updated that did get backed up could be saved in an inconsistent state, with different parts of the file saved before, during, and after changes were made. Windows XP's Volume Shadow Copy feature solves both problems by letting Windows present the backup program with a view of the entire file system frozen at a moment in time. Internally, Windows keeps a copy of the original versions of any individual disk data blocks that are modified after the moment that the Shadow copy is created. The backup program can then be fed this original data, while every other application sees ongoing, changing data from moment to moment. When the backup has completed, Windows releases the frozen copies of the changed data, so overall there is no cost to the file system. Automated System RecoveryAutomated System Recovery (ASR) is an advanced restoration option of the Backup utility available only on Windows XP Professional, not on Home Edition. ASR can be used to restore your system if other disaster recovery methods fail or are not available for use. Using ASR, you can restore the operating system back to a previous state, which will allow you to start Window XP Professional in the event that other methods do not work. You should always consider ASR your last resort for recovery, after Safe mode, the Recovery Console, and Last Known Good Configuration, which are detailed in Chapter 12, "Windows Troubleshooting." You should make a point to keep your ASR media up to date as you make configuration changes to your computer in order to minimize the amount of recovery required should you ever need to use ASR. To use the ASR Wizard to create a set of ASR media, you only need to click on the Automated System Recovery Wizard button on the main page of the Backup tool, as shown in Figure 5.17. Figure 5.17. Start the Automated System Recovery Disk Wizard from the main page of the Backup utility.Using Windows BackupUsing the Backup utility consists of three distinct processes: creating one or more backup configurations, scheduling backups to occur automatically, and performing restorations. There are five types of backups you can perform:
In addition to your system's drives, you will see that NTBackup has a choice to back up something called System State. This is a collection of Registry data, device drivers, and system programs. When you back up your entire hard drive, this stuff is included, so you don't need to specify it in that case. It's mainly an option you can use to back up Windows itself before installing a new driver or application. The new System Restore feature does just as good a job of this, so System State is less necessary now than in the past. System Restore is discussed later in this chapter. Creating the Backup ConfigurationsThe Windows Backup utility makes it extremely simple to create a backup configuration. The basic steps to create the configuration are outlined here, although your options and decisions will vary depending on how your system and backup media devices are configured.
Additionally, you can choose to create a backup configuration manually, however you will still make all of the same decisions as when using the Backup Wizard. Excluding Files from BackupsIf you watch the backup procedure in action, you may see it copying large files that you know aren't valuable, and which you would just as soon not have backed up at all. Although you could manually locate and uncheck these files in the list of files to back up, you can also make settings in NTBackup to exclude them automatically. NTBackup ignores all files listed under Registry key HKEY_LOCAL_MACHINE\system\CurrentControlSet\Control\BackupRestore\FilesNotToBackUp (exclusions for all users), and under HKEY_CURRENT_USER\system\CurrentControlSet\Control\BackupRestore\FilesNotToBackUp (exclusions for the user running NTBackup). The FilesNotToBackUp list is also excluded by the System Restore feature, discussed in Chapter 12. Many file types are excluded by default. The default list of files types designated for exclusion are listed in Table 5.9. Table 5.9. Default FilesNotToBackUp Categories
You can add exclude additional files by following these steps:
Scheduling Your BackupsManaging a backup schedule is very easy in Windows XP. Simply switch to the Schedule Jobs tab from the Backup utility advanced view (see Figure 5.20). Each day on the calendar will show what type of backup is scheduled for that day. Holding the cursor over a backup will display the backup name. You can edit the backup properties, including rescheduling the backup, by clicking it. You can also create new backup configurations by clicking the Add Job button. Figure 5.20 shows the schedule of Normal backups I have in place on one of my Windows XP Professional computers. Figure 5.20. Scheduling backup jobs.After a Disaster: Performing the RestorationShould the day actually come that you need to put your backup system to the test, the actual process of performing the restoration is a relatively easy task in Windows XP Professionalas long as you are ready for the task. The basic steps to perform a restoration are outlined here, although your options and decisions will vary depending on how your system and backup media devices are configured.
Note Before performing a restore that includes the Registry, NTBackup examines Registry value HKEY_LOCAL_MACHINE\system\CurrentControlSet\Control\BackupRestore\KeysNotToRestore . Keys listed here are not restored. If a key name ends with \ , the key's subkeys are also not restored. If a key name ends with \* , the subkeys are merged based on Start values. This helps when restoring Windows onto a computer with a different hardware setup. For more information see support.microsoft.com/default.aspx?kbid=249694. The following list provides some additional help when deciding which advanced restore options to choose.
Note After restoring a full system, restart Windows. You may find that some of your hardware doesn't work when Windows comes back up. To fix this, open the Device Manager, right-click each of the non-functioning devices in turn, and select Uninstall. Restart Windows again. Log back on as a Computer Administrator, and the Found New Hardware wizard should pop up. Let it locate device drivers automatically. This ought to get everything working again. If you really do need to restore the Registry and Windows itself, however, you might be better off using the System Restore feature that's built into Windows. It does require that your hard disk is intact, but it's a more sophisticated system that's better for recovering from serious configuration goof-ups. |