Recipe 7.15. Enabling Disk Quotas


Problem

You want to use disk quotas on an NTFS-formatted file system.

Solution

Using a graphical user interface

  1. Open Windows Explorer.

  2. Browse to the drive on which you want to enable quotas, right-click it, and select Properties.

  3. Click the Quota tab.

  4. Check the box beside Enable quota management. This turns on disk quota tracking.

  5. Check the box beside Deny disk space to users exceeding quota limit to turn on disk quota enforcement.

  6. Configure the default quota limit if you want to have one.

  7. Under the quota logging options, check the appropriate boxes if you want to have messages logged to the event log every time a user exceeds her quota warning or limit levels.

  8. Click OK.

  9. A dialog box will pop open that informs you the disk needs to be scanned to collect disk statistics. Click OK.

Using a command-line interface

The following command enables disk quota enforcement on drive D:

> fsutil quota enforce d:

The following command enables disk quota tracking on drive D:

> fsutil quota track d:

The following command disables disk quotas on drive D:

> fsutil quota disable d:

You cannot modify the default limit and warning settings with fsutil.


Using VBScript
' This code enables disk quotas on a drive. ' ------ SCRIPT CONFIGURATION ------ strComputer = "." strDrive = "<Drive>"  ' e.g. D: intEnable = 2  ' 0 = Disabled, 1 = Tracked, 2 = Enforced intDefaultLimit  = 1024 * 1024 * 500  ' 500 MB intDefaultWarning = 1024 * 1024 * 400 ' 400 MB ' ------ END CONFIGURATION --------- set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") set objDisk = objWMI.Get("Win32_QuotaSetting.VolumePath='" & strDrive & "\\'") objDisk.State = intEnable objDisk.ExceededNotification = True objDisk.WarningExceededNotification = True objDisk.DefaultLimit = intDefaultLimit objDisk.DefaultWarningLimit = intDefaultWarning objDisk.Put_ WScript.Echo "Quotas enabled on " & objDisk.Caption

Discussion

NTFS disk quotas are based on the files a user owns on a volume, not where those files are located on a volume. Quotas are set on a per-volume basis so it doesn't matter where within a volume a user owns files; they all count against any configured quota for that volume. If you have multiple volumes you want quotas on, you have to configure each separately.

When you initially enable quotas, you have a choice between tracking quota usage and enforcing quota usage. Tracking quota usage means that a message will be written to the System event log when a user exceeds his warning or limit quota thresholds. The user isn't notified of this and can continue to exceed his quota limits. Enforcing quota usage means that when the user exceeds his quota limit and attempts to add more files to the volume, he receives an "insufficient disk space" error message. Events are still logged to the System event log just as with quota tracking.

There are two default settings that you can configure when quotas are enabled. The first is the default warning threshold. After a user exceeds this size, a message is logged to the event log. The default limit threshold is the maximum amount of storage that individual users can use. If you want to apply nondefault quota parameters to specific users or groups, see Recipe 7.16.

Quotas do not apply to the Administrator account.


You can also enable quotas using Group Policy if your computers are in an Active Directory domain. You can find the quota settings under Computer Configuration\Administrative Templates\System\Disk Quotas. If your users have administrative rights over the machine you've enabled quotas on, those users can disable or modify the quota configuration. If you use Group Policy to configure quotas, users cannot change them even if they are administrators.

See Also

Recipe 7.16 for configuring disk quotas for users; MS KB 183322, "How to Enable Disk Quotas in Windows 2000," MS KB 307984, "HOW TO: Create Disk Quota Reports in Windows XP," MS KB 308664, "How To Export and Import Disk Quota Settings to Other Volumes in Windows XP," and MS KB 320686, "Disk Quota Charges Increase If You Turn On the NTFS Compression Functionality"



Windows XP Cookbook
Windows XP Cookbook (Cookbooks)
ISBN: 0596007256
EAN: 2147483647
Year: 2006
Pages: 408

Similar book on Amazon

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