The Windows Disk Management 5

 

 

 

 

 

Managing Disk Quotas

 

The NTFS file system supports disk quotas, which allow administrators to control the amount of data that each user can store on an NTFS file system volume. Administrators can optionally configure the system to log an event when users are near their quota, and to deny further disk space to users who exceed their quota. Administrators can also generate reports, and use the event monitor to track quota issues. You can determine whether a file system supports disk quotas by calling the GetVolumeInformation() function and examining the FILE_VOLUME_QUOTAS bit flag. The following screenshots shows the steps on how to set the disk quota per user on NTFS.

 

Invoking the hard disk property page

 

 

The hardisk Quota settings from disk property page

 

Setting the hard disk Quota

 

Creating new hard disk Quota entry based on user

 

Finding user to set the hard disk Quota

 

Setting the hard disk limit (Quota)

 

The disk Quota have been set for two users

 

User-level Administration of Disk Quotas

 

Disk quotas are transparent to the user. When a user asks how much space is free on a disk, the system reports only the available quota allowance the user has available. If the user exceeds this allowance, the system returns the ERROR_DISK_FULL error, just as it would to indicate that the disk was full. To obtain more free disk space after exceeding the quota allowance, the user must do one of the following:

 

  1. Delete some files.
  2. Have another user claim ownership of some files.
  3. Have the administrator increase the quota allowance.

 

Programs that need to retrieve the actual amount of free disk space can call the GetDiskFreeSpaceEx() function and look at the TotalNumberOfFreeBytes parameter.

 

System-level Administration of Disk Quotas

 

The system administrator can set quotas for specific users on a volume. The administrator can also set default quotas for the volume. A new user on the volume receives the default quota unless the administrator established a quota specifically for that user. The administrator can query the level of quota tracking and enforcement (or quota states), the default quota limits, and the per-user quota information. The per-user quota information contains the user's hard quota limit, warning threshold, and the quota usage. The administrator can also enable or disable quota enforcement. There are three quota states, as shown in the following table.

 

State

Description

Quota disabled

Quota usage changes are not tracked, but the quota limits are not removed. In this state, performance is not affected by disk quotas. This is the default state.

Quota tracked

Quota usage changes are tracked, but quota limits are not enforced. In this state, no quota violation events are generated and no file operations fail because of disk quota violations.

Quota enforced

Quota usage changes are tracked and quota limits are enforced.

 

 

Disk Quota Limits

 

The disk space that each file uses is charged directly to the user who owns the file. The owner of a file is identified by the security identifier (SID) in the security information for the file. The total disk space charged to a user is the sum of the length of all data streams. In other words, property set streams and resident user data streams affect the user's quota.

Quota is not charged for re-parse points, security descriptors, or other metadata that is associated with the files. Compressing or decompressing files does not affect the disk space reported for the files. Therefore, quota settings on one volume can be compared to settings on another volume.

The following list identifies the types of disk quota limits:

 

  1. Warning threshold. You can configure the system to generate a system logfile entry when the disk space charged to the user exceeds this value.
  2. Hard quota. You can configure the system to generate a system logfile entry when the disk space charged to the user exceeds this value. You can also configure the system to deny additional disk space to the user when the disk space charged to the user exceeds this value.

 

The NTFS file system automatically creates a user quota entry when a user first writes to the volume. Entries that are created automatically are assigned the default warning threshold and hard quota limit values for the volume.

 

Disk Quota Interfaces

 

The following interfaces are used with disk quotas:

 

Interface

Description

IDiskQuotaControl()

Controls the disk quota facilities of a single NTFS file system volume. The client can query and set volume-specific quota attributes through IDiskQuotaControl. The client can also enumerate all per-user quota entries on the volume. A client instantiates this interface by calling the CoCreateInstance() function using the class identifier CLSID_DiskQuotaControl.

IDiskQuotaEvents()

A client must implement the IDiskQuotaEvents interface as an event sink that receives the quota-related event notifications. Its methods are called by the system whenever significant quota events have occurred. Currently, the only event supported is the asynchronous resolution of user account name information.

IDiskQuotaUser()

Represents a single user quota entry in the volume quota information file. Through this interface, you can query and modify user-specific quota information on an NTFS file system volume. This interface is instantiated by using IEnumDiskQuotaUsers(), IDiskQuotaControl::FindUserSid(), IDiskQuotaControl::FindUserName(), IDiskQuotaControl::AddUserSid(), or IDiskQuotaControl::AddUserName().

IDiskQuotaUserBatch()

Adds multiple quota user objects to a container that is then submitted for update in a single call. This reduces the number of calls to the underlying file system, improving update efficiency when a large number of user objects must be updated. This interface is instantiated by using the IDiskQuotaControl::CreateUserBatch() method.

IEnumDiskQuotaUsers()

Enumerates user quota entries on the volume. This interface is instantiated by using the IDiskQuotaControl::CreateEnumUsers() method.

 

 

 

 

< Windows Disk 3 | Win32 Programming Index Page | Windows Disk Index | Windows Disk 6 >