Recipe 3.15. Enabling Disk QuotasProblemYou want to use disk quotas on an NTFS-formatted filesystem. SolutionUsing a graphical user interface
Using a command-line interfaceThe 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:
Using VBScript' This code enables disk quotas on a drive. ' This code works on 2003 and XP, but not 2000 systems. ' ------ 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 DiscussionNTFS 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 an option to track quota usage or enforce 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 3.16.
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 AlsoRecipe 3.16, 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) |