Skip to content Skip to sidebar Skip to footer

How Can You Use Quotas to Limit the Number of Files a User Can Create?

C H A P T Due east R 7

File System Quotas

File system quotas control the amounts of online and total deejay space that can exist consumed by a specific user, a grouping of users, or an admin ready in a file system. An admin ready is a site-adamant group of users.

Quotas help control the size of a file organization past limiting the amount of infinite and the number of inodes each user can swallow. Quotas tin be especially useful on file systems that incorporate user home directories. Later quotas are enabled, you can monitor usage and suit the quotas as needs change.

This chapter describes the following topics:

  • Overview
  • Enabling Quotas
  • Checking Quotas
  • Changing and Removing Quotas

Overview

Yous can set up file organisation quotas on a user, grouping, or a site-defined admin set ground. Y'all, the system administrator, can prepare limits on the number of files, the number of blocks online, and the full number of blocks.

A file organisation provides a user with blocks for data and inodes for files. Each file uses one inode, and file data is stored in a disk allocation unit (DAU). DAU sizes are determined at the time the file system is created. Quotas business relationship for disk usage in multiples of 512 bytes.

The post-obit sections provide background information about using quotas:

  • Types of Quotas, Quota Files, and Quota Records
  • Soft Limits and Hard Limits
  • Quotas and Archive Media
  • Disk Blocks and File Limits

Table 7-1 shows the terms that are used extensively in this chapter'southward quota documentation.

TABLE 7-1 Quota Terminology

Term

Definition

grace catamenia

The amount of fourth dimension that can elapse during which a user is allowed to create files and/or allocate storage after users reach their soft limit.

soft limit

For disk quotas, a threshold limit on file arrangement resources (blocks and inodes) that a user tin can temporarily exceed. Exceeding the soft limit starts a timer. When a user exceeds the soft limit for the specified time (the grace period), no farther system resource can be allocated until the user reduces file organisation use below the soft limit.

hard limit

For deejay quotas, a maximum limit on file system resources (blocks and inodes) that users cannot exceed.

quota

The amount of system resource that a user is immune to swallow.

timer

A facility for tracking the fourth dimension elapsed after a user reaches a soft limit. When it reaches the grace period, a difficult limit is imposed on the user.


Types of Quotas, Quota Files, and Quota Records

Yous tin set quotas co-ordinate to user ID, group ID, or an administrator's site-specific group. This site-specific grouping is chosen an admin prepare ID. You can use an admin set ID, for example, to identify a collection of users working on a project for which file arrangement quotas are imposed.

Quotas are enabled when the system detects the presence of one or more quota files in the file system's root directory and the quota mount selection is in effect. Note that the quota mountain option is enabled by default, then you must non take disabled quotas past specifying the noquota mount option. If y'all mount the file system with noquota in effect, quotas are disabled. For more than data nigh mountain options, meet the mount_samfs(1M) man page.

Each quota file contains a sequence of records. Record nada is the record for the system administrator'south quotas. The organisation administrator's resource usage is accumulated in record cipher. Arrangement administrator quotas are never enforced, merely you can utilize any tape, including the system administrator's tape, as a template for subsequent records in the quota file. For more data well-nigh this practice, meet To Enable or Alter Limits for Users, Groups, or Admin Sets Using an Existing Quota File.

Record one is the record in the quota file for user one, group one, or admin set ID one, depending on the type of quota file. You tin can edit tape one and all subsequent records in order to gear up different quotas for unlike users. TABLE 7-2 shows the quota file names and the quotas they enable in /root.

TABLE 7-two Quota File Names

Quota File Name in /root Directory

Quota Type

.quota_u

UID (arrangement user ID)

.quota_g

GID (system group ID)

.quota_a

AID (organization admin fix ID)

You tin ready default quota limits for users by editing record zero in the quota file and allowing the values in record nix to be used every bit the initial quota settings for all other users. By default, if user quota limits take not been set specifically, the system uses the values in record zero.

Soft Limits and Difficult Limits

You can set both soft and difficult limits. A hard limit specifies a fixed amount of organization resources available for use, and the system never allows a user to exceed this limit. A soft limit specifies a level of organization resource use that can be exceeded temporarily. The soft limits are never larger than the hard limits. If a new user attempts to classify resources beyond his or her difficult limit, the operation is aborted. In this case, the operation (typically a write(2) or creat(2)) fails and generates an EDQUOT error.

Later on a user exceeds a soft limit, a timer starts, and the user enters a grace period. While the timer is ticking, the user is allowed to operate higher up the soft limit but cannot exceed the hard limit. Subsequently the user goes below the soft limit, the timer is reset. If the grace menses ends and the timer stops without the user having gone below the soft limit, the soft limit is then enforced every bit a hard limit.

For example, presume that a user has a soft limit of ten,000 blocks and a difficult limit of 12,000 blocks. If the user'due south block usage exceeds ten,000 blocks and the timer exceeds the grace period, this user is no longer able to allocate more disk blocks on that file system until their usage drops below the 10,000-block soft limit.

You, the administrator, tin can use the samquota(1M) control to see the timer value. The squota(ane) command is a user version of the samquota(1M) control. The squota(ane) user command contains options that a user can specify to obtain information about quotas that pertain to them.

Quotas and Archive Media

Y'all can utilize quotas to limit the corporeality of data that a user is allowed to accept on annal media in Sun StorEdge QFS and Sunday StorEdge SAM-FS file systems.

Example. The stage(1) control brings data online from archive media. It is possible for a user quota to be exceeded when the stage(1) control is invoked at the organization level in the post-obit way:

A user quota is observed when a user issues the stage(ane) -due west command, as follows:

The arrangement stages files until the user'due south quota is met. After that time, no more than files are staged.

Disk Blocks and File Limits

It is possible for a user to exceed an inode quota, without using any blocks, past creating all empty files. It is as well possible for a user to utilise but one inode and withal exceed the block quota by creating a file that is large plenty to consume all data blocks in the user's quota.

File arrangement quotas are expressed in terms of the number of 512-byte blocks that a user can allocate. Withal, disk space is allocated to user files in terms of DAUs. The DAU setting is specified by the -a allocation_unit option to the sammkfs(1M) command. Information technology is preferable to gear up a block quota to a multiple of the file system DAU. If this is not washed, users can classify just upwardly to the block count, rounded down to the nearest DAU.

Enabling Quotas

You can enable quotas through a process that includes editing arrangement files, creating quota files, and entering diverse quota commands.

TABLE 7-iii shows the commands used when manipulating quotas.

Table vii-3 Quota Commands

Command

Description

squota(1)

Displays quota statistics for a user. This is a subset of the samquota(1M) command.

samchaid(1M)

Changes file admin fix ID attributes.

samquota(1M)

Displays quota statistics for a user, group, or admin set. This command likewise enables an administrator to edit quota records.

samquotastat(1M)

Reports which, if whatever, quotas are active on a file organisation.

When information technology is run, the samfsck(1M) control checks the file arrangement to make sure that usage values recorded in the quota files match the actual file organization usage totals. If they do not match, the samfsck(1M) command issues notices, and it updates all existing, wrong quota records if a file system repair is performed.

The following sections provide more details on how to configure a file system to use quotas and how to enable quotas.

Guidelines for Setting Up Quotas

Earlier you enable quotas, you lot should decide how much disk infinite and how many inodes to allocate to each user. If y'all want to exist certain that the total file system space is never exceeded, you can carve up the total size of the file system between the number of users. For case, if three users share a 100-megabyte slice and have equal disk space needs, you could allocate 33 megabytes to each. In environments in which non all users are likely to push their limits, you might want to set up private quotas then that they add together upwards to more the total size of the file organization. For case, if iii users share a 100-megabyte slice, you could allocate 40 megabytes to each.

You tin use the following quota commands, in the formats shown, for displaying quota data:

  • The squota(one) control is for terminate users. It enables them to call back quota information for themselves on a user, group, or admin set basis.
  • The samquota(1M) control is for system administrators. It enables y'all to retrieve quota data or to set quotas. The -U, -One thousand, and -A options on the samquota(1M) command make up one's mind whether the command is being used for a user, a group, or an admin set. CODE EXAMPLE seven-1 shows this.
  • CODE EXAMPLE 7-1 Using samquota (1M) to Retrieve Information
    #                    samquota -U janet                                        /mount_point                    #Prints a user quota                  
    #                    samquota -G pubs                                        /mount_point                    #Prints a group quota                  
    #                    samquota -A 99                    /mount_point                    #Prints an admin fix quota                  


procedure icon  To Configure a New File System to Use Quotas

The following procedure shows how to configure a new file organization to utilize quotas. This procedure applies if you are creating a new file system at this time and no files currently reside in the file system.

To configure an existing file arrangement to apply quotas, see To Configure an Existing File System to Apply Quotas.

1. Become superuser.

2. Create the file organization.

To create the file system, either follow the steps outlined in the Sunday StorEdge QFS and Sun StorEdge SAM-FS Software Installation and Configuration Guide or apply the examples in Configuration Examples to guide you through creating the mcf file, creating the mount point, initializing the file system, and so on.

iii. Utilize the mount(1M) command to mount the file system.

Mountain the file system using the mountain(1M) command, every bit follows:

4. Apply the dd(1M) command to create the quota file(s).

The arguments to this command differ depending on the type of quota you are creating, equally follows:

  • To create admin set quotas, use the following command:
  • # dd if=/dev/zero of=/qfs1/.quota_a bs=4096 count=1            

  • To create group quotas, use the post-obit control:
  • # dd if=/dev/zero of=/qfs1/.quota_g bs=4096 count=1            

  • To create user quotas, use the post-obit command:
  • # dd if=/dev/null of=/qfs1/.quota_u bs=4096 count=1            

For more information about the dd(1M) command, run across the dd(1M) human being page.

v. Use the umount(1M) command to unmount the file organisation.

Unmount the file organization in which the quota files have been created using the umount(1M) command. For example:

The file organisation needs to be unmounted and so it can be remounted and have its quota files read at mount fourth dimension. For more information about the umount(1M) control, see the umount(1M) human being page.

half-dozen. Employ the samfsck(1M) command to perform a file system check.

Run the samfsck(1M) control on the file arrangement. For example, the following control performs a file organization cheque. The -F option resets the in-apply values in the quota files.

7. Utilize the mount(1M) command to remount the file system.

Quotas are enabled when the organisation detects the presence of ane or more quota files in the root directory of a file system.



caution icon

Caution - You do not need to include the quota mount option in the /etc/vfstab or samfs.cmd file. The quota mount option is enabled past default on the mount(1M) command, and quotas are enabled automatically when the system detects the presence of quota files. Make sure that yous do non accept the noquota mountain option specified in your samfs.cmd or /etc/vfstab files.

If quota files are present and if the file system is mounted without quotas enabled, when blocks or files are allocated or freed, the quota records become inconsistent with actual usages. If a file system with quotas is mounted and run without the quota mountain selection, run samfsck(1M) with its -F option to update the quota file usage counts before again remounting the file arrangement with quotas enabled.


For more information about the mount(1M) control, meet the mount_samfs(1M) man folio.

8. Use the samquota(1M) command to ready quotas for users, groups, or admin sets.

Subsequent sections in this affiliate provide procedures and show examples of this process. For more data about the samquota(1M) command, run across the samquota(1M) human page.


procedure icon  To Configure an Existing File System to Use Quotas

This process applies if you are creating quotas for a file organization that is already populated with files.

If you are configuring a new file system to apply quotas, run across To Configure a New File System to Use Quotas.

1. Use the su(1) command to become superuser.

2. Use the mountain(1M) control to ensure that the file organization is mounted.

Examine the /etc/mnttab file using the mount(1M) command with no arguments, every bit follows:

3. Employ the cd(1) control to alter to the root directory.

Change to the root directory of the file system for which quotas are to be enabled. For example:

four. Verify that quotas practice not already exist on the file system.

From the root directory, employ the ls(1) -a control to think the list of files in this directory. If at least one quota type (u, g, or a) is established for a file organization, you tin institute any other quota type after. Be conscientious not to modify existing quota files when adding new ones subsequently.

If any of the following files are nowadays, quotas are, or previously have been, enabled for this file arrangement: .quota_u, .quota_g, .quota_a.

5. Use the dd(1M) command to create the quota file(s).

Create the quota files for the type(due south) of quota(s) y'all wish to enforce. Determine the highest existing ID numbers of the types of quotas you wish to enforce. Make the initial, zero quota files large plenty to agree the tape for those IDs; each quota file record requires 128 bytes.

Example i. If you desire to enable admin set quotas, and the highest admin set ID in apply on the file organization is 1024, the calculation is equally follows:

  • (1024+1)*128 = 131200
  • 131200/4096 = 32.031...

Employ the following command:

# dd if=/dev/cypher of=/oldfs1/.quota_a bs=4096 count=33          

Example 2. If you want to enable grouping quotas, and group IDs upwardly to 2000 are in use, the adding is equally follows:

  • (2000+1)*128 = 256128
  • 256128/4096 = 62.531...

Use the following command:

# dd if=/dev/nix of=/oldfs1/.quota_g bs=4096 count=63          

Example 3. If you lot want to enable user ID quotas, and user IDs upwardly to 4799 are in utilize, the calculation is as follows:

  • (4799+1)*128 = 1228800
  • 1228800/4096 = 300.0

Employ the following control:

# dd if=/dev/goose egg of=/oldfs1/.quota_u bs=4096 count=300          

For more than information about the dd(1M) command, encounter the dd(1M) human page.

6. Use the umount(1M) command to unmount the file organisation in which the quota files accept been created.

For example:

The file system needs to exist unmounted and so it can exist remounted and have its quota files read at mount time. For more information about unmounting a file organisation, see Unmounting a File Organization.

7. Use the samfsck(1M) command to perform a file system check.

Use the samfsck(1M) -F command to perform a file system bank check. The samfsck(1M) command updates the quota files with correct, current usage information.

For example:



Note - The command in this step updates only the records already allocated in the quota files.


8. Utilise the mount(1M) command to remount the file system in which the quota files have been created.

The organization enables quotas when it detects the presence of one or more quota files in the /root directory.



caution icon

Circumspection - You do not need to include the quota mount pick in the /etc/vfstab or samfs.cmd file. The quota mount option is enabled by default on the mountain(1M) command, and quotas are enabled automatically when the system detects the presence of quota files. Brand sure that you do not take the noquota mountain pick specified in your samfs.cmd or /etc/vfstab files.

If quota files are nowadays and if the file organization is mounted without quotas enabled, when blocks or files are allocated or freed, the quota records become inconsistent with actual usages. If a file arrangement with quotas is mounted and run without the quota mount selection, run the samfsck(1M) -F command to update the quota file usage counts before again remounting the file system with quotas enabled.


For more information about the mountain(1M) command, see the mount_samfs(1M) man folio.

9. Use the samquota(1M) command to set quotas for users, groups, or admin sets.

Subsequent sections in this chapter provide procedures and evidence examples of this process. For more information almost the samquota(1M) command, meet the samquota(1M) human being page.


procedure icon  To Assign Admin Set up IDs to Directories and Files

1. Employ the su(1) command to get superuser.

2. Prepare the admin IDs.

Utilise the samchaid(1M) command to change the admin set IDs for the directory or file, every bit follows:

  • To set IDs for a file or directory, specify the directory name or path. For case:
  • To gear up IDs for a directory tree, utilize the -R and (if necessary) the -h options. The -R selection specifies a recursive functioning, and the -h option changes links, not targets. For example:
  • # samchaid -R -h 22 /qfs1/joe /qfs1/nancee            

For more information well-nigh the samchaid(1M) command, see the samchaid(1M) man folio.

Setting Infinite Quotas

An infinite quota is a kind of special quota. Users with infinite quotas are never denied access to whatsoever available file organisation resource. Y'all tin can gear up infinite quotas on a user, grouping, or admin set footing by setting both the hard block and difficult file limits to zero. The file system treats an infinite quota every bit a special quota. You can prepare infinite quota values into record cypher of the user, group, or admin set ID quota files, and from there they tin can become the default values for new users, groups, or admin set IDs.


procedure icon  To Fix an Space Quota

single-step bulletApply the samquota(1M) command to set an infinite quota.

For instance, the following command sets an infinite quota:

#            samquota -U fred -b 0:h -f 0:h /qfs1          

You tin use the samquota(1M) command to fix infinite quotas for item users, groups, or admin gear up IDs by setting nil values for all hard and soft limits. CODE EXAMPLE 7-ii shows how to set space quotas.

CODE EXAMPLE 7-ii Setting Space Quotas
# samquota -G sam -b 0:s,h -f 0:s,h /sam6                
# samquota -One thousand sam /sam6                
                
                
                
                  Online Limits                Total Limits                
                  Blazon    ID    In Use     Soft     Hard    In Use     Soft     Hard                
/sam6                
Files  group   101       339        0        0       339        0        0                
Blocks group   101       248        0        0      2614        0        0                
Grace catamenia                    0s                          0s                
---> Infinite quotas in effect.                

Enabling Default Quota Values

You can apply the samquota(1M) command to enable a default quota for a user, group, or admin prepare. This is accomplished past setting default limits into user, grouping, or admin set zero (0).


procedure icon  To Enable Default Quota Values for Users, Groups, or Admin Sets

single-step bulletUse the samquota(1M) command to set an space quota.

For instance, the following samquota(1M) command sets default quotas for all admin fix IDs:

            #                        samquota -A 0 -b 12000:s -b 15000:h -b 12G:south:t -b 15G:h:t \          
            -f 1000:s -f 1200:h -t 1w /qfs1          

On beginning reference, the preceding command sets whatever user'south uninitialized admin prepare quota limits every bit follows:

  • The soft online block limit is prepare to 12,000 blocks.
  • The difficult online block limit is set to 15,000 blocks.
  • The full soft block limit is ready to 12 gigablocks.
  • The full difficult block limit is set up to 15 gigablocks.
  • The soft file limit is set up to 1000 files.
  • The difficult file limit is set to 1200 files.
  • The grace period is gear up to 1 week.

Annotation that if a quota record already exists, the existing values remain in issue. This occurs, for case, if the admin group already has blocks assigned to information technology.

You lot can fix similar default quotas for users or groups by specifying -U 0 or -G 0, respectively, in identify of -A 0.

For more data about the samquota(1M) control, see the samquota(1M) man folio.

Enabling Limits

You can apply the samquota(1M) command to enable a set of limits for a item user, grouping, or admin set.


procedure icon  To Enable Limits for Users, Groups, or Admin Sets

single-step bulletUse the samquota(1M) command to set limits for users, groups, or admin sets.

CODE Example 7-3 shows commands that enable various limits.

Lawmaking Case 7-three Quota Commands
# samquota -U joe -b 15000:s -b 20000:h -b 12G:s:t -b 15G:h:t \                
                  -f 500:due south -f 750:h -t 3d /qfs1                
# samquota -G proj -b 15000:s -b 20000:h -b 12G:due south:t -b 15G:h:t \                
-f 500:s -f 750:h -t 3d /qfs1                
# samquota -A 7 -b 15000:s -b 20000:h -b 12G:southward:t -b 15G:h:t \                
-f 500:s -f 750:h -t 3d /qfs1                

For more than information nigh the samquota(1M) command, see the samquota(1M) man page.


procedure icon  To Enable or Change Limits for Users, Groups, or Admin Sets Using an Existing Quota File

After quotas are established, y'all tin can use an existing quota file every bit a template when creating limits for another user, group, or admin set. The following procedure shows this. You lot tin also utilise this procedure to change any of the quota settings.

1. Use the samquota(1M) control to retrieve a quota file.

Employ the -eastward option with ane or more of the following additional options: -U adminsetID, -Thousand groupID, or -A adminsetID. Direct the output to a temporary file.

#            samquota -G sam -f 200:southward:o   -f 300:h:o   -f 200:south:t -f 300:h:t \          
            -b 40000:due south:o -b 60000:h:o -b 40M:s:t -b 60M:h:t -t 0s:o -t 0s:t /sam6          

Yous can apply any temporary file. In Stride ii, you utilize an editor to alter one or more than fields, so yous can utilize a group quota entry as a template to create a user quota entry. Lawmaking EXAMPLE 7-four shows how to create and recollect file quota.group to use as a template.

Code EXAMPLE 7-four File quota.group
#                  samquota -Thou sam -e /sam6 > /tmp/quota.group                
#                  cat /tmp/quota.grouping                
                
# Blazon  ID                
#                Online Limits                          Full   Limits                
#            soft            hard                    soft            hard                
# Files                
# Blocks                
# Grace Periods                
#                
samquota -G 101 \                
                  -f      200:s:o -f      300:h:o         -f      200:s:t -f      300:h:t \                
                  -b    40000:due south:o -b    60000:h:o         -b 40000000:s:t -b 60000000:h:t \                
                  -t  0s:o                               -t 0s:t   /sam6                

2. Use an editor to edit the file from Step 1.

For example, Code Case seven-5 shows the file that was generated in Step one opened in the half dozen(i) editor. This file likewise shows that group ID 101 is changed to 102. This has the outcome of generating a command to copy the quotas set up for grouping 101 to group 102.

Code EXAMPLE 7-5 File quota.group Subsequently Editing
# Blazon  ID                
#                Online Limits                          Total   Limits                
#            soft            hard                    soft            hard                
# Files                
# Blocks                
# Grace Periods                
#                
samquota -G 102 \                
                  -f      200:s:o -f      300:h:o         -f      200:s:t -f      300:h:t \                
                  -b    40000:s:o -b    60000:h:o         -b 40000000:s:t -b 60000000:h:t \                
                  -t  1d:o                               -t 1d:t   /sam6                

iii. Salvage the file and leave the editor.

four. Execute the file using the shell.

This footstep applies the changes made in the editor. For example:

In this example, the -x option directs the trounce to echo the commands it executes. You can omit the -x selection if desired.

In similar style, you can employ this procedure to generate quota commands that re-create quota limits between users, groups, admin IDs, file systems, and other entities.

Checking Quotas

After yous have enabled disk and inode quotas, you lot can cheque these quotas. The samquota(1M) control is an administrator command that generates a quota report on an individual user, group, or admin set. The squota(1) control is a user command that enables users to cheque their ain private quotas. Tabular array seven-4 shows commands you can use to check quotas.

TABLE vii-4 Commands for Checking Quotas

Command

Task

squota(1)

This is a user command. It displays user quotas and other information specific to a single user. For more data, see the squota(i) man folio.

samquota(1M)

This is an ambassador command. Information technology displays user, grouping, and admin ready quotas, and it displays electric current disk apply. This control also displays information about users who are exceeding their quotas. For more information, see the samquota(1M) human being page.

procedure icon  To Check for Exceeded Quotas

The post-obit procedure shows how to check quotas for backlog usage.

ane. Become superuser.

ii. Use the samquota(1M) command to display the quotas in effect.

Use the samquota(1M) command in one of the following ways to display quotas for mounted file systems in which quotas are enabled:

  • To brandish user quotas, specify the post-obit command:
  • # samquota -U              userID              [              file              ]            

For userID, specify the numeric user ID or user name of the user whose quotas are being examined.

For file, specify a specific file system for the selected user, group, or admin gear up. The file statement tin can also be the proper noun of whatever file in the file system. Typically, file is the name of the root directory of the file system.

Case 1. CODE Case vii-6 retrieves user hm1259's quota statistics in the sam6 file system on the server and displays output indicating that this user is not exceeding his quota.

CODE Example seven-half dozen Checking for Exceeded Quotas for User hm1259
#                  samquota -U hm1259  /sam6                
                
                  Online Limits                Total Limits                
                  Type    ID    In Use     Soft     Hard    In Utilise     Soft     Hard                
/sam6                
Files   user 130959        13      100      200        thirteen      100      200                
Blocks  user 130959       152      200     3000       272     1000     3000                
Grace flow                    0s                          0s                

Case ii. CODE EXAMPLE 7-7 retrieves user memil'south quota statistics in all mounted Sun StorEdge QFS and Sun StorEdge SAM-FS file systems and displays output indicating that this user is exceeding the quota. Note the plus sign (+) in the Blocks row of the output. The plus sign would appear in the Files row, also, if the soft quota limit were being exceeded for files.

Code Example 7-vii Checking for Exceeded Quotas for User memil
#                  samquota -U memil                
                
                  Online Limits                Full Limits                
                  Type    ID    In Utilize     Soft     Difficult    In Utilize     Soft     Difficult                
/sam6                
Files   user 130967         4      500      750         4      500      750                
Blocks  user 130967     41016+   40000    50000     41016    50000    50000                
Grace period                    1w                          0s                
---> Warning:  online soft limits to be enforced in 6d23h36m45s                
/sam7                
Files   user 130967         four      500      750         iv      500      750                
Blocks  user 130967      4106    40000    50000      4106    50000    50000                
Grace period                    1w                          0s                

If a difficult limit has been exceeded, or if the soft limit has been exceeded and the grace flow has expired, the offending In Use field is marked with an asterisk character (*). If a quota tape's limits are adamant to be inconsistent, (for instance if a soft limit is larger than a difficult limit), an exclamation bespeak is used to mark the field, and all allocation operations are prevented.

TABLE 7-5 shows the fields in the samquota(1M) output.

Table seven-5 samquota (1M) Output Fields

Field Name

Content

In Use

Current block usage.

Soft

Soft block limit

Hard

Difficult block limit

Grace Flow

Amount of time the user is immune to exceed the soft limit


  • To brandish group quotas, specify the following command:
  • # samquota -G              groupID              [              file              ]            

For groupID, specify the numeric group ID or the grouping name for the grouping of users whose quotas are beingness examined. For instance, the following command retrieves user quota statistics for the group turtles in the qfs3 file system:

# samquota -M turtles /qfs3          

  • To display admin set quotas, specify the post-obit command:
  • # samquota -A              adminsetID              [              file              ]            

For adminsetID, specify the numeric admin gear up ID of the site-specific administrator set whose quotas are being examined. For example, the following command retrieves user quota statistics for the admin fix 457 in all mounted Sunday StorEdge QFS and Sun StorEdge SAM-FS file systems:

Changing and Removing Quotas

Y'all can change quotas to adjust the amount of deejay space or number of inodes allocated to users. You lot tin besides remove quotas from users or from an entire file system. The following sections describe how to change and remove quotas. The topics are every bit follows:

  • To Change the Grace Menstruum
  • Changing the Grace Menstruation Expiration
  • To Inhibit Additional File Arrangement Resource Allocations
  • To Remove a File Arrangement's Quotas
  • To Correct Quotas

procedure icon  To Alter the Grace Menses

You can employ the samquota(1M) control to change the soft time limit grace period.

1. Use the samquota(1M) control to call back quota statistics.

You can use the samquota(1M) command on a user, group, or admin set up ground. Lawmaking Example 7-eight shows how to retrieve quota statistics.

CODE Instance 7-viii Using samquota (1M) to Retrieve Quota Statistics
#                  samquota -U                                    userID                                      [                                    file                                      ]                
#                  samquota -M                                    groupID                                      [                                    file                                      ]                
#                  samquota -A                                    adminsetID                                      [                                    file                                      ]                

Table 7-6 shows the arguments to these commands.

TABLE vii-six samquota (1M) Command Arguments

Argument

Description

userID

Specify the numeric user ID or user proper noun of the user whose quotas are being changed.

groupID

Specify the numeric group ID or the grouping name for the grouping of users whose quotas are existence changed.

adminsetID

Specify the numeric admin set ID of the site-specific administrator set up whose quotas are existence changed.

file

Specify a specific file arrangement for the selected user, group, or admin ready. The file argument can as well be the name of any file in the file system. Typically, file is the name of the root directory of the file organisation.

2. Examine the output from the samquota(1M) control.

Examine the output and determine what the new limits should be.

3. Employ the samquota(1M) command to change the soft time limit grace period.

Code Instance 7-ix shows using the samquota(1M) command options to use to change the soft time limit grace period.

Lawmaking EXAMPLE 7-9 Using samquota (1M) to Change Soft Time Limit Grace Periods
# samquota -U                  userID                  -t                  interval                  file                
# samquota -G                  groupID                  -t                  interval                  file                
# samquota -A                  adminID                  -t                  interval                  file                

TABLE 7-7 shows the arguments to these commands.

Table seven-7 samquota (1M) Command Arguments

Statement

Clarification

userID

Specify the numeric user ID or user name of the user whose quotas are being inverse.

groupID

Specify the numeric group ID or the group proper name for the group of users whose quotas are beingness inverse.

adminsetID

Specify the numeric admin set ID of the site-specific ambassador set whose quotas are being inverse.

interval

Specifies the interval to use for the grace period. Specify an integer number for interval to indicate the quantity, and then specify a unit multiplier, if desired. By default, the unit multiplier is southward to betoken that the interval is being specified in seconds. You lot tin also specify w (for weeks), d (for days), h (for hours), or grand (for minutes).

file

Specify a specific file system for the selected user, group, or admin set. The file statement can also be the name of any file in the file arrangement. Typically, file is the name of the root directory of the file system.

Example. Assume that you lot want to alter the grace period for user memil. CODE EXAMPLE 7-x shows the samquota(1M) command used to verify the quotas and its output.

Code EXAMPLE 7-10 Irresolute the Grace Menses
#                  samquota -U memil /sam6                
                
                  Online Limits                Total Limits                
                  Type    ID    In Use     Soft     Hard    In Use     Soft     Hard                
/sam6                
Files   user 130967         4      500      750         iv      500      750                
Blocks  user 130967     41016+   40000    50000     41016    50000    50000                
Grace period                    3d                          0s                
---> Warning:  online soft limits to be enforced in 2d23h59m7s                

You enter the following command to lower the soft time limits:

# samquota -U memil -t 1d /sam6          

Code EXAMPLE 7-11 shows the samquota(1M) command to use to verify the new quotas.

Lawmaking EXAMPLE seven-xi Verifying the New Quotas
#                  samquota -U memil /sam6                
                  Online Limits                Total Limits                
                  Type    ID    In Utilize     Soft     Hard    In Use     Soft     Hard                
/sam6                
Files   user 130967         4      500      750         four      500      750                
Blocks  user 130967     41016+   40000    50000     41016    50000    50000                
Grace period                    1d                          0s                
---> Warning:  online soft limits to exist enforced in 23h58m31s                

Irresolute the Grace Period Expiration

If a user has exceeded their soft quota limit, changing the grace period itself does not change the expiration timer of any grace periods that have already started. If the grace period is already in effect, yous can apply the samquota(1M) command to alter the grace period in one of the following ways:

  • Clear the grace period. The next time the user allocates a file or cake (and is all the same over a soft limit), the grace period timer is reset to the grace period and starts counting down.
  • Reset the grace flow. When an expiration flow is reset, the timer is reset to the nowadays grace period, which starts counting down immediately.
  • Gear up the grace menses to a value. The timer is set to a value, and it starts counting downwardly immediately from that value. At that place are no restrictions on this value. The value can be larger than the grace period.
  • Expire the grace period. The timer is set to elapse immediately.

Example. Lawmaking Case vii-12 retrieves information most group sam and shows that this grouping is over its soft limit.

CODE Instance 7-12 Exceeding a Soft Limit
#                  samquota -Thousand sam  /sam6                
                
                  Online Limits                Total Limits                
                  Type    ID    In Apply     Soft     Hard    In Apply     Soft     Hard                
/sam6                
Files  group   101        32     2000     2000        32     2000     2000                
Blocks group   101     41888*   40000 60000000     43208 60000000 60000000                
Grace flow                    1w                          1w                
---> Online soft limits under enforcement (since 30s ago)                

Code Example 7-13 clears the timer so it starts counting the next time a user in group sam attempts to classify a cake or file in /sam6.

Lawmaking EXAMPLE vii-13 Immigration the Timer
#                  samquota -G sam -x clear /sam6                
Setting Grace Timer:  continue?                  y                
#                  samquota -G sam  /sam6                
                
                  Online Limits                Total Limits                
                  Type    ID    In Use     Soft     Difficult    In Use     Soft     Difficult                
/sam6                
Files  group   101        32     2000     2000        32     2000     2000                
Blocks group   101     41888+   40000 60000000     43208 60000000 60000000                
Grace period                    1w                          1w                
---> Alarm:  online soft limits to be enforced in 6d23h59m56s                

CODE Instance 7-14 resets the grace period.

Code Instance seven-14 Resetting the Grace Period
#                  samquota -M sam -x reset /sam6                
Setting Grace Timer:  continue?                  y                
#                  samquota -G sam  /sam6                
                  Online Limits                Full Limits                
                  Blazon    ID    In Use     Soft     Hard    In Employ     Soft     Hard                
/sam6                
Files  group   101        32     2000     2000        32     2000     2000                
Blocks grouping   101     41888    40000 60000000     43208 60000000 60000000                
Grace menses                    1w                          1w                
---> Warning:  online soft limits to exist enforced in 6d23h59m52s                

Code Case 7-15 expires the grace menstruum.

Code Case seven-15 Expiring the Grace Period
#                  samquota -G sam -10 expire /sam6                
Setting Grace Timer:  continue?                  y                
#                  samquota -K sam  /sam6                
                
                  Online Limits                Full Limits                
                  Type    ID    In Use     Soft     Difficult    In Employ     Soft     Hard                
/sam6                
Files  group   101        32     2000     2000        32     2000     2000                
Blocks group   101     41888    40000 60000000     43208 60000000 60000000                
Grace menses                    1w                          1w                
---> Online soft limits nether enforcement (since 6s agone)                

CODE Instance 7-16 sets a very long expiration period.

CODE Instance 7-16 Setting a Very Long Grace Period
#                  samquota -Thou sam -x 52w /sam6                
Setting Grace Timer:  go along?                  y                
#                  samquota -G sam  /sam6                
                
                  Online Limits                Total Limits                
                  Type    ID    In Utilise     Soft     Hard    In Use     Soft     Hard                
/sam6                
Files  grouping   101        32     2000     2000        32     2000     2000                
Blocks group   101     41888+   40000 60000000     43208 60000000 60000000                
Grace menses                    1w                          1w                
---> Warning:  online soft limits to be enforced in 51w6d23h59m54s                


procedure icon  To Inhibit Additional File System Resource Allocations

When the file system detects that quota values are non consistent for a user, group, or admin set up, it prevents that user, group, or admin set from using any more organisation resources. You can inhibit file organization resources allocations past creating inconsistent quota values. The samquota(1M) command detects these inconsistent values, and reports them in its output. For example, the software inhibits further allocation if the difficult block or file limits are lower than the soft cake or file limits, or if a user's soft limit is larger than the user'due south hard limit.

The file organization treats an inconsisent quota setting as a special quota. Y'all tin can set inconsistent quota values into record zero of the user, group, or admin set ID quota files, and from there they tin become the default values for new users, groups, or admin gear up IDs.

The following process shows how to inhibit further system resource allocations for a user, group, or admin set.

1. Become superuser.

2. Obtain, save, and examine current quota data.

Lawmaking Example 7-17 shows how to use the samquota(1M) command to retrieve electric current group quota information for group sam and write it to a backup file.

CODE Instance 7-17 Retrieving Grouping Quota Data
#                  samquota -Thou sam -e /sam6 | & tee restore.quota.sam                
                
# Blazon  ID                
#                Online Limits                          Total   Limits                
#            soft            hard                    soft            hard                
# Files                
# Blocks                
# Grace Periods                
#                
samquota -Thou 101 \                
                  -f     2000:south:o -f     2000:h:o         -f     2000:s:t -f     2000:h:t \                
                  -b    40000:s:o -b 60000000:h:o         -b 60000000:south:t -b 60000000:h:t \                
                  -t  1w:o                               -t 1w:t \                
                  -ten 51w6d23h59m:o                       -x clear     /sam6                

To obtain quota information about a user quota, specify the -U userID selection in place of the -G pick. To obtain quota information near an admin set quota, specify the -A adminID option in identify of the -K choice.

three. Use the samquota(1M) command to set soft quotas to nonzero quotas and hard quotas to null quotas.

Use the samquota(1M) command to reset the quotas to invalid values. The following control sets the quotas for grouping sam to be inconsistent:

# samquota -G sam -f 1:s -f 0:h -b ane:southward -b 0:h /sam6          

To make the quotas for users or admin sets inconsistent, specify the -U userID or -A adminID options in place of the -Chiliad option.

4. Apply the samquota(1M) control to verify your changes.

Use the samquota(1M) command to verify that the quota has been correctly changed. The following example obtains quota information for a group quota of the group sam:

Enter the samquota(1M) command over again to verify the changed quotas. CODE Case 7-18 shows this.

CODE EXAMPLE 7-eighteen Verifying Changed Quotas
#                  samquota -G sam  /sam6                
                
                  Online Limits                Total Limits                
                  Type    ID    In Use     Soft     Hard    In Use     Soft     Hard                
/sam6                
Files  group   101        32!       ane        0        32!       1        0                
Blocks group   101     41888!       ane        0     43208!       1        0                
Grace menstruation                    1w                          1w                
---> Quota values inconsistent; nix quotas in effect.                

In the preceding output, a zero quota is in effect. Note the exclamation bespeak characters (!) to indicate the over-quota condition in the output.

v. Use the sh(i) and samquota(1M) commands to restore the group's quota.

CODE EXAMPLE 7-19 shows the commands to restore and verify the changed quotas.

CODE Instance vii-xix Restoring the Group Quota
#                  sh restore.quota.sam                
Setting Grace Timer:  go along?                  y                
Setting Grace Timer:  continue?                  y                
#                  samquota -G sam  /sam6                
                  Online Limits                Total Limits                
                  Blazon    ID    In Use     Soft     Hard    In Employ     Soft     Hard                
/sam6                
Files  group   101        32     2000     2000        32     2000     2000                
Blocks group   101     41888+   40000 60000000     43208 60000000 60000000                
Grace menstruation                    1w                          1w                
---> Warning:  online soft limits to be enforced in 6d23h59m54s                

To perform this performance on a user quota, specify the -U userID option in place of the -G option. To perform this operation on an admin set quota, specify the -A adminID option in place of the -G pick.


procedure icon  To Remove a File System's Quotas

To remove or disable quotas for a file arrangement, y'all demand to remove quota specifications from the mount procedure. The post-obit process shows how to disable quotas for a file system.

1. Use the su(1) command to become superuser.

2. Add the noquota mount selection to the /etc/vfstab or samfs.cmd file. (Optional)

Perform this footstep but if you have the quota mountain selection in the /etc/vfstab or samfs.cmd file.

Apply a viewer, such as half-dozen(one) or cat(1) to examine the /etc/vfstab or samfs.cmd file for the presence of the quota mount option.

If this mount selection is present, edit the file and remove the quota mount pick.



Note - Starting time with the Sun StorEdge QFS and Sun StorEdge SAM-FS 4.1 releases, Sun Microsystems no longer recommends using the /etc/vfstab and samfs.cmd files for enabling or disabling quotas.


3. Use the umount(1M) command to unmount the file system.

If the file organization is mounted, use the umount(1M) command to unmount the file system.

For example:

If you accept difficulty unmounting the file arrangement, see Unmounting a File Arrangement.

iv. Remount the file organization using the mountain(1M) control.

If you did not perform Step 2, include the noquota choice on the mount(1M) command.

For example:

5. Dispense with the quota files.

If you expect to reinstate the quota feature at a after appointment, do non destroy the quota files. To preserve the quota files and reinstate quotas at a afterwards date, unmount the file system, run the samfsck(1M) command with its -F selection on the file system, and remount the file organization again with the quota mount selection. The quota mount pick tin can be specified in either the /etc/vfstab file or in the samfs.cmd file as a mountain option, or information technology tin can exist specified on the mountain(1M) command with the -o quota option.

If y'all do not expect to reinstate the quota feature at a subsequently date, or if you desire to reclaim the space consumed by the quota files, use the rm(1) control to remove the .quota_u, .quota_g, and .quota_a files. For case:


procedure icon  To Correct Quotas

1. Become superuser.

2. Apply the umount(1M) control to unmount the file system.

If the file organization is mounted, utilise the umount(1M) command to unmount the file organisation.

For example:

If you lot have difficulty unmounting the file system, see Unmounting a File Arrangement.

three. Use the samfsck(1M) -F control to perform a file system check.

The samfsck(1M) command updates the quota files with right, electric current usage information. Note, however, that it updates only records already allocated in the quota files. For instance:

4. Use the mount(1M) command to remount the file system.

For example:

dennywheint.blogspot.com

Source: https://docs.oracle.com/cd/E19232-01/817-4091-10/chapter7.html

Postar um comentário for "How Can You Use Quotas to Limit the Number of Files a User Can Create?"