DOWNLOAD THE CODE:
Download the Code 39120.zip

In Windows 2000, Microsoft introduced disk quota policies, with which you can limit the amount of disk space that users consume on NTFS volumes. Disk quota policies also determine how the system responds when a user exceeds his or her quota limit or reaches a predefined warning level.

When you put disk quotas in place, you decide how the system will respond when users attempt to consume more disk space than you've permitted. If a greedy user creates a file that would exceed his or her allotted disk space, the user typically receives an Insufficient disk space error. The system forbids the user to write additional data to the volume without first deleting other files. Disk quotas are based on file ownership and, as such, are independent from the physical location of files on the volume. In other words, if a user simply moves files from one folder to another on the same volume, the overall space usage doesn't change.

Upon reaching his or her quota limit, the user can only delete files or physically move files to another volume that's under the control of another user. From the viewpoint of the quota system, compressing (or decompressing) files doesn't affect the amount of disk space consumed and subsequently doesn't affect the user's space allowance. Disk quotas are based on uncompressed file sizes.

Disk quota limits are transparent to most programs. When a user reaches his or her limit, the volume simply appears full—at which point, programs raise errors and execute error-handling code to recover. Disk quotas are also transparent to the user. When a user asks how much space remains on a particular disk, the system reports only the user's quota availability—whether the user asks through the OS's UI or through a script.

Typically, you use Group Policy Editor (GPE) to set disk quota policies. However, you can manually configure some settings—for example, you can enable or disable disk quota management—without maintaining a policy. You can also use COM components in a script to determine users' quota disk usage and create an HTML-based report.

Manually Configuring Quotas
To manually control quotas without maintaining a policy, you simply open the My Computer folder, right-click the appropriate NTFS volume, and click Properties. On the Quota tab, you can set the various options. You have three approaches for disk quota management:

  • You can disable quotas by clearing the Enable quota management check box.
  • You can enable but not enforce quotas by selecting the Enable quota management check box and clearing the Deny disk space to users exceeding quota limit check box. If you choose this approach, the system tracks usage but doesn't raise quota error events or reject write operations because of disk quota violations.
  • You can enable and enforce quotas by selecting the Enable quota management check box and the Deny disk space to users exceeding quota limit check box.

The Quota tab also includes a mode that lets you track quotas. By clearing the Deny disk space to users exceeding quota limit check box and selecting one of the logging options, you enter quota-tracking mode. This mode essentially permits users to exceed their quota. The system never denies access to a volume; instead, the system regularly monitors and reports on disk-space usage on a per-user basis. In other words, while in quota-tracking mode, the disk quota system limits its actions to log events rather than to blocking operations.

You can also choose to enable quota tracking and quota enforcement simultaneously. To do so, select the Deny disk space to users exceeding quota limit check box, along with one of the logging options. You can configure the system to add an entry to the system log file whenever a user attempts to exceed his or her allotted disk space.

Enabling disk quotas increases server overhead and slightly degrades file-server performance. A good technique for minimizing the effect of disk quotas on system performance is to selectively enable quotas. When quotas are enabled, you can use Win2K's auditing capabilities to monitor and record disk usage. In this way, you can get a precise idea of how users are using the space and decide whether and when to run the system with the quota feature enabled. You can use a common file format such as Microsoft Excel (.xls) files to export auditing output to other applications and managers.

Determining Disk Quotas Programmatically
Let's look at an alternative approach, based on the use of COM components, to selectively extract disk usage information and generate HTML code to create Web-deployable reports. In Win2K and later, the Windows shell provides the DiskQuotaControl object, which lets you manage disk quota properties for a given volume. Using the DiskQuotaControl component, you can programmatically set default quota limits, enable and disable a particular volume's disk quota system, and decide whether to deny or provide extra disk space to users who exceed their limit.

Before you start working with this COM object, you need to ensure that quotas are enabled or that disk quotas have been enabled at least once on the system. If you run a script that uses the DiskQuotaControl component on a disk that has never had quotas enabled, the script will return nothing but a zero. When you enable quota management, the system takes a while to update disk statistics usage per user.

   Prev. page   [1] 2     next page



You must log on before posting a comment.

If you don't have a username & password, please register now.