Click here to monitor SSC
Av rating:
Total votes: 33
Total comments: 3


Ben Lye
Implementing Windows Server 2008 File System Quotas
19 November 2009

File system Quotas are used to restrict the amount of space users can consume or to report on the space consumed by them. They  are useful for reporting on those users or folders that are consuming large amounts of disk space on a file server. Ben Lye shows that File system quotas are quick and easy to set up, with three different methods available for configuring them

Disk quotas have been available in Windows since Windows 2000 was released, and could be used by administrators to limit the amount of space users could use on an NTFS volume.  Disk quotas are based on file ownership rather than folder structure and because of this they are not particularly useful in all situations.  For example, if your server had a single storage volume and you need to apply quotas to different folders on the volume then disk quotas will not help.

File system quotas, which were first introduced in Windows Server 2003 R2, and are a part of the File Server role in Windows Server 2008 (and Windows Server 2008 R2), offer many benefits over disk quotas.  With file system quotas we can set quotas for specific folders on the volume, we can use templates to ensure consistent application of quotas, and we can set quotas which are automatically applied to all sub-folders of a folder.

Additionally, file system quotas are useful not just for limiting the amount of space users can consume, but also for reporting on space used – quotas can be set with so-called “soft” limits which are used for monitoring rather than enforcing limits.  This functionality can be extremely useful for quickly determining which users or folders are consuming large amounts of disk space on a file server.

Quota thresholds can be configured so that users or administrators receive notifications when quotas have been reached or are about to be reached.  Multiple thresholds can be configured for individual quotas, and actions can include sending e-mail messages, logging to the Windows event log, running commands or scripts, or generating storage reports.

In Windows Server 2008 file system quotas are managed with the File Server Resource Manager (FSRM) console (which is installed as a role service in the File Services role), the command line utility dirquota, or with Windows PowerShell using a COM API.

Figure 1: Windows Server 2008 File Server Resource Manager

There are two kinds of quota available - hard quotas which set a limit and enforce it, and soft quotas which set a limit but only report on it.  Soft quotas are useful for monitoring disk space use.  Quotas are commonly applied using quota templates, which are a mechanism for easily applying the same quota settings to one or more folders.  Quota Templates are the recommended way to configure quotas and FSRM includes some example templates which cover a range of scenarios, including using both hard and soft quota types.

Before we start to configure quotas which will generate e-mail messages, the quota File Server Resource Manager needs to be configured with an SMTP server, and optionally, the default administrator recipients, and the default “from” address.

Like all aspects of quota management, the FSRM settings can be applied using three different tools and you can choose the method appropriate to your needs.

To configure FSRM using the FSRM console:

  1. Launch the File Server Resource Manager
  2. Select the root node, labelled “File Server Resource Manager”
  3. In the Action Pane click “Configure Options...”
  4. Enter an SMTP server and if desired configure the other settings

  5. Click the “OK” button

To configure FSRM using the command line:

  1. Open an elevated command prompt window
  2. Enter the command “dirquota admin options /From:quota-admin@example.com /AdminEmails:quota-admin@example.com /SMTP:smtp.example.com”

To configure FSRM using Windows PowerShell:

  1. Open Windows PowerShell
  2. Enter these commands (or save them as a script and run it):
# Create a new COM object to access the FSRM settings

$fsrm = New-Object -com Fsrm.FsrmSetting

 

# Set the default administrators e-mail address

$fsrm.AdminEmail = "quota-admin@example.com"

 

# Set the from address

$fsrm.MailFrom = "quota-admin@example.com"

 

# Set the SMTP server

$fsrm.SmtpServer = "smtp.example.com"

Quota Example – Home directories with a 5GB limit

A common use of file system quotas is to put limits on the size of user’s personal storage space (folders which are often referred to as home directories) on a file server.  The requirements of this scenario are to limit the space each user can use to 5GB, alert administrators when 90% of the quota has been reached, and automatically apply quotas to new home directories.  The solution requires the implementation of new quota template and an auto apply quota.

Step 1: Create the new quota template

The first step is to create a new template, which we will use later to apply the quota to the file system.  Using a template means we can easily make changes to all folders where we have applied the template quota settings.  The template can be created using the FSRM, the dirquota command line tool, or PowerShell, meaning you can choose the tool with which you feel comfortable with and that fits most of your scenarios.

To create the new quota template using the FSRM:

  1. Launch the File Server Resource Manager
  2. Expand “Quota Management” -> “Quota Templates”
  3. In the Action Pane click “Create Quota Template”
  4. Enter the template name and set the space limit

    Note: To set a soft quota (for monitoring only) check the “Soft Quota” radio button

  5. Click the “Add” button to add a notification threshold
  6. Set the notification percentage to 90, check the “Send e-mail to the following administrators”, and enter an appropriate destination e-mail address. You can also customise the message text.

  7. Click the “OK” button twice

To create the new quota template using the dirquota command line utility:

  1. Open an elevated command prompt (or Windows PowerShell) window
  2. Create a text file called notification.txt containing the text of the notification message (an example of this text message can be downloaded from this article)
  3. Enter this command:

dirquota Template Add /Template:"Default Home Directory (5GB Limit)" /Limit:5GB /Type:Hard /Add-Threshold:90 /Add-Notification:90,M,notification.txt

Note: To set a soft quota (for monitoring only) change “/Type:Hard” to “/Type:Hard”

To create the new quota using Windows PowerShell:

  1. Open Windows PowerShell
  2. Enter these commands (or save them as a script and run it):
# Create a new COM object to access quota templates
$fqtm = New-Object -com Fsrm.FsrmQuotaTemplateManager

# Create a new template object
$template = $fqtm.CreateTemplate()

# Set the template’s name
$template.Name = "Default Home Directory (5GB Limit)"

# Set the quota limit
$template.QuotaLimit = 5GB

# Set the quota type to hard limit (the flag for a hard limit is 0x100)
$template.QuotaFlags = $template.QuotaFlags -bor 0x100

# Add a quota threshold
$template.AddThreshold(90)

# Add a threshold e-mail action
$action = $template.CreateThresholdAction(90, 2)

# Set the e-mail message recipient
$action.MailTo = "[Admin Email]"

# Set the e-mail message subject
$action.MailSubject = "[Quota Threshold]% quota threshold exceeded"

# Set the e-mail message text
$action.MessageText = "User [Source Io Owner] has exceeded the [Quota Threshold]% " + `
"quota threshold for the quota on [Quota Path] on server [Server]. The quota limit " + `
"is [Quota Limit MB] MB, and " + ` "[Quota Used MB] MB currently is in use ([Quota " + `
"Used Percent]% of limit)."

Note: To set a soft quota (for monitoring only) change “$template.QuotaFlags = $template.QuotaFlags -bor 0x100” to “$template.QuotaFlags = $template.QuotaFlags -bxor 0x100” to disable the hard limit flag.

Step 2: Create the Quota

The next step is to use the new quota template to apply the quota to the file system.

In this example we’ll say that the home directories are all subfolders of C:\Home.  Because we want any new home folders to automatically have the quota applied we need to create an Auto apply Quota.  Auto apply quotas are applied to all existing subfolders and any future folders.

To create the quota using the FSRM:

  1. Launch the File Server Resource Manager
  2. Expand “Quota Management” -> “Quotas”
  3. In the Action Pane click “Create Quota”
  4. Enter the quota path and choose the appropriate template

     

  5. Click the “Create” button

To create the quota using the dirquota command line tool:

  1. Open an elevated command prompt window
  2. Create a text file called notification.txt containing the text of the notification message (an example of this text message can be downloaded from this article)
  3. Enter the command “dirquota autoquota add /Path:C:\Home /SourceTemplate:"Default Home Directory (5GB Limit)"”

To create the quota using Windows PowerShell:

  1. Open Windows PowerShell
  2. Enter these commands (or save them as a script and run it):

# Create a new COM object to access quotas

$fqtm = New-Object -com Fsrm.FsrmQuotaManager

 

# Create the new quota

$quota = $fqtm.CreateAutoApplyQuota("Default Home Directory (5GB Limit)", "C:\Home")

 

# Save the new quota

$quota.Commit()

 

Quota Exceptions / Folder-Specific Quotas

Naturally there will be occasions when a folder needs to be excluded from a template or auto apply quota.  In these situations you can easily add a specific quota for that folder to either increase the limit or to disable the quota entirely.

To create the quota exception using the FSRM:

  1. Launch the File Server Resource Manager
  2. Expand “Quota Management” -> “Quotas”
  3. Select the folder you wish to make the exception for
  4. In the Action Pane click “Edit Quota Properties...”
  5. Enter new limit for the quota

  6. Click “OK”

Note: Check the “Disable quota” box to disable the quota

To create the quota exception using the dirquota command line tool:

  1. Open an elevated command prompt window
  2. Enter the command ...
    “dirquota quota add /Path:C:\Home\John_Smith /SourceTemplate:"Default Home Directory (5GB Limit)" /Limit:10GB /Overwrite”

Note: To disable the quota append the command with "/status:disabled".

To create the quota exception using Windows PowerShell:

  1. Open Windows PowerShell
  2. Enter these commands (or save them as a script and run it):
# Create a new COM object to access quotas

$fqtm = New-Object -com Fsrm.FsrmQuotaManager

 

# Get the existing quota

$quota = $fqtm.GetQuota("C:\Home\John_Smith")

 

# Set the new quota limit

$quota.QuotaLimit = 10GB

 

# Save the quota

$quota.Commit()

 

Note: To disable the quota, insert the line “$quota.QuotaFlags = $quota.QuotaFlags -bor 0x200” before saving the quota

How Quotas Affect Clients

When a client maps a network drive to a folder which has a hard quota applied the size of the volume and the amount of available disk space shown is equal to the quota settings.

Figure: Mapped drive showing hard quota limit as volume size

When a hard quota is met or exceeded clients will receive a message telling them that the volume is out of disk space.

Figure: Insufficient disk space message

Viewing Quotas

Administrators can view hard and soft quotas using FSRM, and viewing quotas this way can be a quick method for finding large folders or large consumers of space.

Figure: Quotas in File Server Resource Manager

File system quotas are quick and easy to set up, with three different and flexible methods available for configuring them.  Properly applied they can be a good tool to help ensure efficient use of storage resources, a convenient countermeasure against storage waste, and a useful tool for reporting on storage utilisation.  There is an IO performance penalty for using quotas, but the benefits will probably outweigh the small performance cost.



This article has been viewed 28715 times.
Ben Lye

Author profile: Ben Lye

Ben Lye is a senior systems administrator at a multi-national software company. He has over 10 years experience supporting and administering Windows and Exchange, and has been MCSE and MCP certified since 1999. Ben is passionate about automating and streamlining routine tasks, and enjoys creating and using tools which make day-to-day administration easier.

Search for other articles by Ben Lye

Rate this article:   Avg rating: from a total of 33 votes.


Poor

OK

Good

Great

Must read
 
Have Your Say
Do you have an opinion on this article? Then add your comment below:
You must be logged in to post to this forum

Click here to log in.


Subject: delegate to manage folder quotas
Posted by: jheredia (view profile)
Posted on: Monday, February 15, 2010 at 1:17 PM
Message: How I can delegate to manage folder quotas on out file server, The Help Desk people do not have Administrator rigths over the File server, except to the shares of the user, I create a mmc tool win win 2008, but it do not run if the Help desk do not have windows server 2008, also about the rights? the is a easy script? to run as power shell so the can increase folder quotas in windows 2008?

Subject: FSRM Email Notification Frequency
Posted by: Brichardi05 (view profile)
Posted on: Friday, December 17, 2010 at 8:57 AM
Message: Hi Ben,

You article is very helpful to me as I am tasked to implement FSRM in our organization. The only problem that I ran into is that FSRM will only send email notificaton once at 85%, 95%, and 100% (depending on you setting). How do I cofigure FSRM so it send out repeated email to user(s) when they are at 85/95/100 percent of their quota limit. I have search on the net and even posted question on "social.technet.microsoft" but still don't find answer for it.

Your help is greatly appreciated.

Thank you,

Subject: FSRM Notification
Posted by: BenTob (view profile)
Posted on: Friday, February 11, 2011 at 1:29 AM
Message: Hi Ben,

thank you for this article. It is really helpful.

But I still have a Problem using Powershell to set Quotas, specially with the Notifications. I'm not able to do that as you mentioned and using your exampla copy-past; even I'm Admin on the server.

What are the important point to look at?

Thank you so much,
BenTob

 





How to Kill a Company in One Step or Save it in Three
 The majority of companies that suffer a major data loss subsequently go out of business. Wesley David... Read more...

Migrating to Microsoft BPOS - Part II
 In his last article, Johan gave us a crystal clear guide to preparing to migrate from an on-premises... Read more...

Monitoring Mailbox Moves
 Mailboxes moves happen all the time, and given how precious the data in mailboxes can be, you should... Read more...

Emulating the Exchange 2003 RUS for Out-of-Band Mailbox Provisioning in Exchange 2007
 Exchange's Recipient Update Service was important in Exchange 2000 or 2003 in order to complete the... Read more...

The Postmasters
 The Exchange Team introduces themselves, and keeps you up-to-date Read more...

Upgrade Exchange 2003 to Exchange 2010
  In this article, the first of two in which Jaap describes how to move from Exchange Server 2003... Read more...

Upgrade Exchange 2003 to Exchange 2010 - Part II
 In Jaap's second article on upgrading straight from Exchange Server 2003 to 2010, he explains how to... Read more...

Goodbye Exchange ExMerge, Hello Export-Mailbox
 ExMerge was a great way of exporting a mailbox to an Exchange PST file, or for removing all occurences... Read more...

Using Exchange 2007 for Resource Booking
 The process of booking various resources to go with a meeting room just got a whole lot easier with... Read more...

Managing Exchange 2007 Mailbox Quotas with Windows PowerShell
 The use of PowerShell with Exchange Server 2007 can do a great deal to ease the task of managing... Read more...

Over 400,000 Microsoft professionals subscribe to the Simple-Talk technical journal. Join today, it's fast, simple, free and secure.

Join Simple Talk