Skip Navigation Links | |
Exit Print View | |
![]() |
Sun QFS File System 5.3 Configuration and Administration Guide Sun QFS and Sun Storage Archive Manager 5.3 Information Library |
2. About the Master Configuration File
4. Configuring the File System
5. Configuring a Shared File System
6. Administering File System Quotas
Types of Quotas, Quota Files, and Quota Records
Guidelines for Setting Up Quotas
How to Configure a New File System to Use Quotas
How to Configure an Existing File System to Use Quotas
How to Assign Admin Set IDs to Directories and Files
How to Enable or Change Limits for Users, Groups, or Admin Sets Using an Existing Quota File
How to Change the Grace Period
Changing the Grace Period Expiration
Inhibiting Additional File System Resource Allocations
How to Inhibit Additional File System Resource Allocations
How to Remove the Quotas for a File System
7. Advanced File System Topics
9. Configuring WORM-FS File Systems
11. Using QFS File Systems with SANergy (SAN-QFS)
You can enable quotas through a process that includes editing system files, creating quota files, and entering various quota commands.
Before you enable quotas, you should determine how much disk space and how many inodes to allocate to each user. If you want to be sure that the total file system space is never exceeded, you can divide the total size of the file system by the number of users. For example, 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 not all users are likely to reach their limits, you might want to set individual quotas so that they add up to more than the total size of the file system. For example, if three users shared a 100-megabyte slice, you could allocate 40 megabytes to each.
You can use the following quota commands, in the formats shown, for displaying quota information:
The squota command enables end users to retrieve quota information for themselves on a user, group, or admin set basis.
The samquota command enables system administrators to retrieve quota information or to set quotas.
Use the -U option for a user. For example:
# samquota -U janet /mount-point
Use the -G option for a group. For example:
# samquota -G pubs /mount-point
Use the -A option for an admin. For example:
# samquota -A 99 /mount-point
Use this procedure if you are creating a new file system and no files currently reside in the file system. To configure an existing file system to use quotas, see How to Configure an Existing File System to Use Quotas.
Before you start this procedure, make sure that you do not have the noquota mount option specified in your samfs.cmd or /etc/vfstab files.
Either follow the steps outlined in the Sun QFS and Sun Storage Archive Manager 5.3 Installation Guide, or use the examples in Chapter 3, mcf File Examples to create the mcf file, create the mount point, initialize the file system, and so on.
For example:
# mount /qfs1
The arguments to this command depend on the type of quota you are creating, as follows:
To create admin set quotas:
# dd if=/dev/zero of=/qfs1/.quota_a bs=4096 count=1
To create group quotas:
# dd if=/dev/zero of=/qfs1/.quota_g bs=4096 count=1
To create user quotas:
# dd if=/dev/zero of=/qfs1/.quota_u bs=4096 count=1
For more information, see the dd(1M) man page.
For example:
# umount /qfs1
The file system must be unmounted so it can be remounted and have its quota files read at mount time.
In the following example, the -F option resets the in-use values in the quota files.
# samfsck -F qfs1
The system enables quotas when it detects the presence of one or more quota files in the root directory.
Note - You do not need to include the quota mount option in the /etc/vfstab or samfs.cmd file. The quota mount option is enabled by default with the mount command, and quotas are enabled automatically when the system detects the presence of quota files.
For more information about the mount command, see the mount_samfs(1M) man page.
Subsequent sections in this chapter provide procedures and show examples of this process. For more information about the samquota command, see the samquota(1M) man page.
Use this procedure if you are creating quotas for a file system that is already populated with files. If you are configuring a new file system to use quotas, see How to Configure a New File System to Use Quotas.
Before you start this procedure, make sure that you do not have the noquota mount option specified in your samfs.cmd or /etc/vfstab files.
# mount
Make sure that the file system is listed in the mount list that is displayed.
For example:
# cd /oldfs1
If any of the following files are present, quotas have been enabled for this file system: .quota_u, .quota_g, or .quota_a
If any quota type is established for a file system, you can establish any other quota type later. Be careful not to modify existing quota files when adding new ones.
Determine the highest existing ID numbers of the types of quotas you want to enforce. Make the initial, zero, quota files large enough to hold the records for those IDs (each quota file record requires 128 bytes).
For example, if you want to enable admin set quotas, and the highest admin set ID in use on the file system is 1024, the calculation is as follows:
(1024 + 1) x 128 = 131200
131200/4096 = 32.031...
You would use the following command:
# dd if=/dev/zero of=/oldfs1/.quota_a bs=4096 count=33
For more information about the dd command, see the dd(1M) man page.
For example:
# umount /oldfs1
The file system must be unmounted so it can be remounted and have its quota files read at mount time. For more information about unmounting a file system, see Unmounting File Systems in Sun QFS and Sun Storage Archive Manager 5.3 Installation Guide.
This command updates records allocated in the quota files with current usage information, for example:
# samfsck -F /oldfs1
The system enables quotas when it detects the presence of one or more quota files in the /root directory.
You do not need to include the quota mount option in the /etc/vfstab or samfs.cmd file. The quota mount option is enabled by default with the mount command, and quotas are enabled automatically when the system detects the presence of quota files.
Note - If quota files are present and if the file system is mounted with quotas disabled, the quota records become inconsistent with actual usages when blocks or files are allocated or freed. If a file system with quotas is mounted and run with quotas disabled, run the samfsck -F command to update the quota file usage counts before again remounting the file system with quotas enabled.
For more information about the mount command, see the mount_samfs(1M) man page.
Subsequent sections in this chapter provide procedures and show examples of this process. For more information about the samquota command, see the samquota(1M) man page.
Use the samchaid command to change the admin set IDs for the directory or file, as follows:
To set IDs for a file or directory, specify the directory name or path. For example:
# samchaid 100 admin.dir
To set IDs for a directory tree, use the -R and (if necessary) the -h options. The -R option specifies a recursive operation, and the -h option changes links, not targets. For example:
# samchaid -R -h 22 /qfs1/joe /qfs1/nancee
For more information, see the samchaid(1M) man page.
Users with infinite quotas are never denied access to any available file system resource. You can set infinite quota values into record zero of the user, group, or admin set ID quota files. You can then use this record as the default value for a new user, group, or admin set ID.
You can use the samquota command to set the quota limit to zero.
For example:
# samquota -U fred -b 0:h -f 0:h /qfs1
You can set infinite quotas for particular users, groups, or admin set IDs by setting zero values for all hard and soft limits. The following example shows how to set infinite quotas.
# samquota -G sam -b 0:s,h -f 0:s,h /sam6 # samquota -G sam /sam6 Online Limits Total Limits Type 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 period 0s 0s ---> Infinite quotas in effect.
You can use the samquota command to enable a default quota for a user, group, or admin set through default limits in user, group, or admin set zero. For example, the following command sets default quotas for all admin set IDs:
# samquota -A 0 -b 12000:s -b 15000:h -b 12G:s:t -b 15G:h:t \ -f 1000:s -f 1200:h -t 1w /qfs1
This command sets any user's uninitialized admin set quota limits as follows:
The soft online block limit (-b limit:s) is set to 12,000 blocks.
The hard online block limit (-b limit:h) is set to 15,000 blocks.
The total soft block limit (-b limit:s:t) is set to 12 gigablocks.
The total hard block limit (-b limit:h:t) is set to 15 gigablocks.
The soft file limit (-f limit:s) is set to 1000 files.
The hard file limit (-f limit:h) is set to 1200 files.
The grace period (-t _limit_) is set to one week.
Note - If a quota record already exists, the existing values remain in effect. This situation might occur, for example, if the admin group already has blocks assigned to it.
You can set similar default quotas for users or groups by specifying -U 0 or -G 0, respectively, in place of -A 0.
You can use the samquota command to enable a set of limits for a particular user, group, or admin set. For example, the following commands enable limits for users, groups, and admin sets, respectively.
# samquota -U joe -b 15000:s -b 20000:h -b 12G:s:t -b 15G:h:t \ -f 500:s -f 750:h -t 3d /qfs1 # samquota -G proj -b 15000:s -b 20000:h -b 12G:s: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:s:t -b 15G:h:t \ -f 500:s -f 750:h -t 3d /qfs1
For more information, see the samquota(1M) man page.
After quotas are established, you can use an existing quota file as a template for creating limits for another user, group, or admin set. You can also use this procedure to change any of the quota settings.
Use the samquota command with the -e option and with one or more of the following options: -U user-ID, -G group-ID, or -A adminset-ID.
The following example shows how to retrieve the quota.group file to use as a template.
Note - You can use a group quota entry as a template to create a user quota entry.
# samquota -G sam -e /sam6 > /tmp/quota.group # cat /tmp/quota.group # Type 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
For example:
# sh -x /tmp/quota.group
The -x option directs the shell to echo the commands it executes. You can omit the -x option if desired.