Tuesday, September 28, 2010

Maintaining Disk Storage Volumes

Windows Server 2003 disk volumes are efficient and stable if formatted with NTFS, but somewhat less so when formatted with FAT or FAT32. The NTFS file system logs all file transactions, replaces bad clusters automatically, and stores copies of key information for all files on the NTFS volume. With these mechanisms, NTFS actively protects the integrity of the volume structure and the file system metadata (the data related to the file system itself). User data, however, can occasionally be corrupted, and can certainly become fragmented. Users also have the annoying habit of storing enormous amounts of archaic and non-business data on volumes to which they have access. In this topic, you will learn how to maintain the integrity of disk volumes and to optimize those volumes by performing defragmentation and by setting storage limits through disk quotas.


CHKDSK

CHKDSK, or “Check Disk”, is a tool available in Windows Explorer or from the command-line that allows you to scan a disk volume for file system errors and, option-ally, to test for and attempt to recover bad sectors on your hard disk.

To use Check Disk from Windows Explorer, open the properties dialog box for the volume you want to check. On the Tools tab, click Check Now. In the Check Disk dialog box, as shown in below Figure , select the tasks you wish to launch.


When you select Automatically Fix File System Errors, Check Disk will attempt to fix inconsistencies in the file system catalog, such as files that appear in the catalog but don’t appear in a directory on the volume. Check Disk makes three passes over the drive to examine the metadata, which is the data describing how files are organized on the disk. The passes attempt to ensure that all files on the volume are consistent with the master file table (MFT), that the directory structure is correct, and that the security descriptors are consistent.

If you select Scan For And Attempt Recovery Of Bad Sectors, Check Disk makes a fourth pass which tests the sectors in the volume reserved for user data (as opposed to file system metadata, which is always checked). If a bad sector is found, data is recovered and moved to a good sector if the volume is fault-tolerant; if the volume is not fault-tolerant, data cannot be recovered using Check Disk and must be restored from backup. The bad sector is then removed from active use and future data will not be written to the sector.

All files with open handles must be closed before Check Disk can run. If all handles cannot be released (which will be the case if you run Check Disk against a system volume), you will be prompted to schedule Check Disk to run when the system is restarted. When Check Disk is running, the volume will be inaccessible to other processes. Depending on the size of the volume, the check options you have selected, and the other processes running on the computer, Check Disk can take a significant amount of time to complete, and it is quite processor-and disk-intensive while it runs.

Check Disk can also be run from the command prompt using CHKDSK. Without switches, CHKDSK runs in read-only mode on the current drive. You’ll see a report showing disk space usage. CHKDSK supports several switches allowing you to fix file system errors (/f) and bad sectors (/r), just like the Explorer version.

Disk Defragmenter

Files are stored on a volume in units called clusters. Cluster size is configured when for-matting a drive; many NTFS volumes use a default cluster size of 4 KB. Each cluster can only contain one file, even if that file is smaller than the cluster size. If a file is larger than the cluster size, the file is saved to multiple clusters, with each cluster containing a pointer to the next segment of the file. When a drive is new, all clusters are free, so as files are written to the drive they tend to occupy physically adjacent clusters. But quickly, as files are deleted or expanded and contracted in size, free clusters are no longer completely contiguous, so a file may be saved to several clusters that are not physically close to each other on the disk drive. This fragmentation of a file results in slower read and write performance and, over time, fragmentation of multiple files on a server can degrade performance significantly.

Windows Server 2003 provides a defragmenter toolset—both a command-line and a graphical utility—with which volumes can be analyzed and defragmented. The tools are significantly improved over Windows 2000, as they can now defragment volumes with cluster sizes greater than 4 KB, and can defragment the master file table. You can use the tools to defragment any local disk volume. But to schedule defragmentation, or to defragment a remote volume, you must look for a third-party tool such as Diskeeper from Executive Software.

To use the built-in Disk Defragmenter, as shown in below Figure, open the properties of a disk volume and, from the Tools tab, click Defragment Now. Alternatively, open the Disk Defragmenter snap-in in the Computer Management console or a custom Microsoft Management Console. Select a volume and click Analyze. The tool will display a recommendation. If the tool indicates that the volume is dirty, there may be corruption and CHKDSK should be run before defragmenting.



If the recommendation is to defragment, click Defragment. You can defragment any type of volume: FAT or NTFS, basic or dynamic. The volume can have open files, but open files may not be efficiently defragmented and may slow the process, so it is recommended to close all open files before defragmenting. Disk Defragmenter will move files around the drive in an attempt to collect all clusters of a file into contiguous clusters. The result will also consolidate free space, making it less likely that new files will be fragmented.

Disk Quotas

Windows 2000 introduced quota management as a built-in feature, allowing adminis¬trators to implement storage limits without an investment in third-party utilities. Windows Server 2003 supports the same functionality. When quotas are enabled, quota manager tracks the files on a volume that are owned by a user. It then compares the calculated total of disk usage by that user to limits that have been configured by an administrator and, when those limits are reached, notifies the user that the volume is near quota, or prevents the user from writing to the disk, or both.

Quota manager reports the amount of free space on a volume based on the user’s quota, so if a user has a 50 MB quota on a 500 GB RAID volume, the user will see free space reported as 50 MB when the user first accesses the volume. When the user approaches the quota limit, the messages that appear are similar to a volume that is filling up or is full; the system warns that space is low and suggests deleting unneeded files.

Configure Quotas

Configuring quotas requires the following steps: enabling quotas on a volume, configuring default quota settings, and configuring quota entries for exceptions to the default.

Quotas are disabled by default in Windows Server 2003, and must be enabled on a volume-by-volume basis. To enable quotas, open the properties of the volume and click the Quota tab. The Quota properties of a volume are shown in below Figure.

Select the Enable Quota Management check box. If you want to deny users who have exceeded their limit the ability to write additional files to the volume, select Deny Disk Space To Users Exceeding Quota Limit. If this box is not selected, users can continue to write to the volume.


Quotas are managed in two ways: first, by quota entries for specific users, setting a storage limit for each user (or setting “no limit” for a user), and second, by default quota settings that apply to all users for whom a quota entry does not exist. On the Quota tab, you can configure the default quota settings. Configure a default limit or “no limit” that will apply to as many users as possible, so that you can minimize the num¬ber of quota entries you must create for users whose limits are different from this default. Note that you can configure the disk space limit as well as a warning level, which should obviously be lower than the limit.

Finally, specify logging options. Quota manager registers events in the System log, identifying the user by name and specifying that they have exceeded their warning or quota limits.

After configuring the defaults for the volume on the Quota tab, click Quota Entries to open the Quota Entries dialog box, as shown in below Figure.



Click the New, Quota Entry button on the toolbar or choose New Quota Entry on the Quota menu, and you can select one or more users for which to create a quota entry. It is unfortunate that Windows Server 2003 does not allow you to assign quota entries based on groups (as most third-party quota management tools do), but in the Select Users dialog box you can at least select multiple users before clicking OK. The limits you configure in the Add New Quota Entry dialog box will apply to all selected users, individually.

Exporting Quota Entries

If you want to apply the same quota entries to another NTFS volume, you can export the entries and import them to the other volume. Select one or more quota entries and, on the Quota menu, click Export. On the other volume, choose Import.

Monitoring Quotas and Storage

The Quota Entries dialog box displays disk storage per user and whether that storage is at or above warning levels or limits. You can sort by column to identify users who have exceeded their quota levels or limits. There is no mechanism to alert you about quota limits, so you must monitor the Quota Entries dialog box or the System Log in Event Viewer.

No comments:

Post a Comment