JavaScript is required to for searching.
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
search filter icon
search icon

Document Information

Preface

1.  File System Overview

2.  About the Master Configuration File

3.  mcf File Examples

4.  Configuring the File System

5.  Configuring a Shared File System

6.  Administering File System Quotas

About File System Quotas

Types of Quotas, Quota Files, and Quota Records

Soft Limits and Hard Limits

Disk Blocks and File Limits

Enabling Quotas

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

Setting Infinite Quotas

Enabling Default Quota Values

Enabling Limits

How to Enable or Change Limits for Users, Groups, or Admin Sets Using an Existing Quota File

Checking Quotas

Changing and Removing Quotas

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

How to Correct Quotas

7.  Advanced File System Topics

8.  SMB Service in SAM-QFS

9.  Configuring WORM-FS File Systems

10.  Tunable Parameters

11.  Using QFS File Systems with SANergy (SAN-QFS)

12.  Mount Options in a Shared File System

13.  Using the samu Operator Utility

Enabling Quotas

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

Guidelines for Setting Up Quotas

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:

How to Configure a New File System to Use Quotas

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.

  1. Become superuser.
  2. Create the file system.

    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.

  3. Mount the file system.

    For example:

    # mount /qfs1
  4. Use the dd command to create the quota files.

    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.

  5. Unmount the file system in which the quota files have been created.

    For example:

    # umount /qfs1

    The file system must be unmounted so it can be remounted and have its quota files read at mount time.

  6. Perform a file system check.

    In the following example, the -F option resets the in-use values in the quota files.

    # samfsck -F qfs1
  7. Remount the file system.

    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.

  8. Use the samquota command to set quotas for users, groups, or admin sets.

    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.

How to Configure an Existing File System to Use Quotas

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.

  1. Become superuser.
  2. Use the mount command to examine the /etc/mnttabfile and ensure that the file system is mounted.
    # mount

    Make sure that the file system is listed in the mount list that is displayed.

  3. Change to the root directory of the file system for which quotas are to be enabled.

    For example:

    # cd /oldfs1
  4. Use the ls -a command to retrieve the list of files in this directory and verify that quotas do not already exist on the file system.

    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.

  5. If the quota files do not exist for the types of quotas you wish to enforce, use the dd command to create the quota files.

    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.

  6. Unmount the file system in which the quota files have been created.

    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.

  7. Perform a file system check.

    This command updates records allocated in the quota files with current usage information, for example:

    # samfsck -F /oldfs1
  8. Remount the file system in which the quota files have been created.

    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.

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

    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.

How to Assign Admin Set IDs to Directories and Files

  1. Become superuser.
  2. Set the admin IDs.

    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.

Setting Infinite Quotas

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.

Enabling Default Quota Values

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:


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.

Enabling Limits

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.

How to Enable or Change Limits for Users, Groups, or Admin Sets Using an Existing Quota File

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.

  1. Retrieve a quota file and direct the output to a temporary file.

    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
  2. Save the file and exit the editor.
  3. To apply the changes, execute the file using the shell.

    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.