다음을 통해 공유


How Disk Quotas Work

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Disk Quota Architecture

The following figure, “Disk Quota Architecture,” shows the architecture of disk quotas on an NTFS volume.

Disk Quota Architecture

Disk Quota Architecture

The following table, “Components of Disk Quota Architecture,” describes the components of the preceding figure, “Disk Quota Architecture.”

Components of Disk Quota Architecture

Architecture Component Description

Active Directory Domain

Domain where the NTFS volume must reside. Disk quotas are based on all users within the domain.

Administrator Interface

Volume Quota Property Page user interface where administrators set Group Policy for disk quotas on an NTFS volume.

User Policy

Applies disk quota Group Policy at the computer or user level for the NTFS volume. Group Policy is determined by the users and groups in the Active Directory domain account.

Dskquota.dll

Implements the disk quota Group Policy on the client side. The dll is loaded when the client computer processes the policy.

Dskquoui.dll

Implements the user interface associated with managing disk quotas.

System Log

Records an audit entry whenever disk quota events occur, such as a user approaching a limit.

Quota Settings

Disk quota settings enabled by the administrator.

Volume Quota Property Page

User interface page allowing administrators to set and manage disk quotas.

Ntioapi_h

Windows Server 2003 header file identifying NT systems. The header includes functions for setting disk quotas and querying volumes for disk quotas.

NtQueryQuotaInformationFile

Function declared in ntioapi_h. Sets information for users on the volume.

NtSetQuotaInformationFile

Function declared in ntioapi_h. Queries quota information for users on the volume.

NtQueryVolumeInformationFile

Function declared in ntioapi_h. Queries the volume quota information to determine if quotas are enabled.

NtSetVolumeInformationFile

Function declared in ntioapi_h. Identifies the volume ID. Sets volume quota information.

Registry

System-defined database in which information and configuration data for disk quotas is stored.

Security Identifier

A variable-length number that uniquely identifies a user in a domain.

User File

File owned by a user saving the file to the local NTFS volume.

When a user saves a file to a share on an NTFS volume, dskquota.dll accesses Group Policy to determine what, if any, disk quotas are applicable. Group Policy checks the user’s name from a list of user names in the domain to determine if that user is a member of the domain.

A user who is an administrator and wants to set disk quotas can do so by using Disk Management in the Computer Management console. When this is done, dskquota.dll recognizes that the administrator is logged on. Dskquota.dll calls dskquoui.dll and opens the Volume Quota Property Page, allowing the administrator to create and administer disk quotas. A list of user names and associated security identifiers (SIDs) are provided to the administrator from the domain controller. After a disk quota policy is created, modified, and saved, it is written to the registry. Policy data is applied to the user of the NTFS volume and to a user’s SID. Each file a user saves to a volume has an associated SID that identifies that file with the user. The SID in the file is then compared to the SID of the user from the Group Policy.

If the user is a member of the domain, Group Policy determines if disk quotas are enabled. If the user is approaching the disk quota limit, an event is written to the System log. If enforcement is enabled, the administrator can access the System log to determine what follow-up actions to take, such as preventing the user from accessing more disk space or allocating additional disk space to the user. A user who has not reached the warning level or disk quota limit can save the file to the local NTFS volume.

Disk Quota Interfaces

Disk quota relies on several disk management interfaces to correctly process disk quota control and logging of events. The following table, “Disk Quota Management Interfaces,” lists the interfaces used in setting and managing disk quotas on an NTFS volume.

Disk Quota Management Interfaces

Disk Management Interface Description

IDiskQuotaControl

Controls disk quota facilities of an NTFS volume.

IDiskQuotaEvents

Calls by the system whenever significant quota events occur.

IDiskQuotaUser

Represents single user quota entry in the volume quota information file.

IDiskQuotaBatch

Enables the administrator to add multiple quota user objects to a container.

IEnumDiskQuotaUsers

Enumerates user quota entries on the volume.

IUnknown

Provides pointers to other interfaces in any given object.

WMI

Windows Management Instrumentation. Enables identification and manipulation of objects.

Disk Quota Interface

Disk Quota Interface

When the Component Object Model (COM) accesses disk quotas, the IUnknown pointer is invoked. IUnknown has no functions for disk quota operations, so it calls QueryInterface to ask an object for an interface by which the disk quota operations can be invoked. WMI is then used to access the five-disk quota interfaces.

Disk Quota Physical Structure

The following figure, “Disk Quota Physical Structure,” shows the physical structure of the environment in which disk quotas are used.

Disk Quota Physical Structure

Disk Quota Physical Structure

Disk Quota Physical Structure Components

Component Description

Domain Controller

A server in an Active Directory domain running Windows Server 2003 that manages security for a domain. The domain controller must be in the same domain as the domain users.

Domain Users

All users in the domain who have access to the NTFS volume. Users must be in the same domain as the domain controller and the NTFS volume, and can be local or remote.

Disk Quota Policy

Applies disk quota policy at the computer or user level for the NTFS volume. The policy is determined for the users and groups in the Active Directory domain account.

NTFS Volume

NTFS-formatted volume. The volume can be a separate server from the domain controller, or be a partition on the domain controller.

User Accounts

A list of users in the domain, provided by the domain controller

In an Active Directory domain, when an NTFS volume is accessed by a domain user, Group Policy applies any disk quotas to those users if the administrator has enabled disk quotas. If a user is saving a file to the NTFS volume, Group Policy determines if disk quotas are enabled for the user. Disk quotas check the list of names against the names provided by the domain controller of the domain to determine if disk quotas are applicable to the user. If they are, disk quotas can do any of the following:

  • Allow the user to save the file to the NTFS volume

  • Prevent a user who has reached the quota from writing to the volume

  • Allow a user who has reached the quota to write to the volume.

  • Warn the user that the disk quota limit has been reached.

Disk Quota Processes and Interactions

Disk quotas are depend on NTFS. The information in the following sections discuss how Active Directory domains are used to provide information to set and store disk quotas, as well as how NTFS tracks disk quotas, and how disk quotas can be transferred from one volume to another.

Disk quotas are tracked on a per-user, per-volume basis; users are charged only for the files they own. Quotas are tracked per volume, even if the hard disk contains multiple volumes. If multiple shared folders are on the same volume, the quotas apply to all shared folders equally, and a user’s total use of all shared folders cannot exceed the assigned quota on that volume.

Setting Disk Quotas

The Disk Management snap-in in the Computer Management console allows an administrator to set a disk quota Group Policy. Dskquota.dll recognizes an administrator who logs on and opens the Computer Management console. The administrator is provided with a list of names from the domain controller. These names are then matched to the security identifier (SID) for current volume users, and the administrator is allowed to enable disk quotas. The administrator can set a policy that controls the use of a computer, domain, or site to enable quota management on individual volumes. The policy is applied to local or remote users as long as the users are located within the same domain as the NTFS volume. At the same time, the administrator can register an event for when a disk quota is reached by a user, such as simply warning the user that a limit has been reached, or preventing the user from saving additional files to the volume.

Enforcement of the user or computer policy is optional. When users reach an enforced disk quota limit, the system responds as though the physical space on the volume were exhausted. When users reach an unenforced limit they can continue to write to the volume as long as physical space is available, but an event is logged to the System log.

Storing Disk Quotas on a Volume

NTFS volumes contain a master file table (MFT), which stores information about all of the files on the volume. Within the MFT are metadata files of attributes of files on the volume.

One of the file attributes of the MFT is $Extend metadata record, one function of which is storing disk quota information for a file. The $Extend attribute is further defined by $Quota. When disk quotas are enabled, NTFS uses a Quota bit in the Standard Information file record attribute, and copies the file size to the Standard Information attribute. Because the attribute is considered a resident attribute, an attribute which can fit within the MFT file record for that file, the MFTcan quickly scan the record to determine the quota assigned to a user.

Disk quotas are stored in the $Quota metadata record. $Quota uses two indexes, $O and $Q. The first index, $O, indexes the owner of a file by the owner’s SID. The second index, $Q, keeps track of the default quotas, thresholds, and quota attributes. When a user is assigned a quota or adds files to a volume with disk quotas enabled, the user’s SID is added to the $O index then assigned an entry in the $Q index specifying the quota limit.

Tracking File Sizes

Disk quotas track the file size against the allocated disk file using the SID to look up the user’s disk quota entry allowance.

SIDs are stored in a user’s profile within the NTFS structure on the volume. The user’s name is obtained from a list of names in the domain in which the volume resides. NTFS tracks the user’s volume usage by tagging files and directories with the SID. When a user saves a file to the NTFS volume with disk quotas enabled, the SID in the file is resolved against the name in a cache file of stored SID names and quota information on the volume. When the file or directory is saved to the volume, the size of files and directories a user owns count against the set quota limit.

Transferring Disk Quota Settings Between Volumes

Transferring disk quotas between NTFS volumes saves an administrator from having to create identical disk quotas on multiple volumes.

When disk quotas are exported from one volume and imported on into another, disk quotas creates a transfer file, which is imported into another volume. The following figure, “Transferring Settings Between Volumes,”shows the information included in a Quota Settings Transfer file.

Transferring Settings Between Volumes

Transferring Settings Between Volumes

In the preceding figure,, the GUID contains a record for each user for whom the disk quotas policy applies. The SID is a unique structure that identifies the users or groups. cbSID identifies the size of the SID buffer. These settings are applied to an export file, and applied to a different volume when imported into that volume.

The following resources contain additional information that is relevant to this section.