While this isn't a ''vi'' how-to, I'll try to walk you through a bit so you can get your quotas defined. What we want to change in this file is the number (currently 0 for both) for hard and soft limits. For reference, '''inodes''' are files on the file system. Each and every file gets a single inode. Hard and soft links each get their own inode, even though they point to another file. They are files, themselves.

While this isn't a ''vi'' how-to, I'll try to walk you through a bit so you can get your quotas defined. What we want to change in this file is the number (currently 0 for both) for hard and soft limits. For reference, '''inodes''' are files on the file system. Each and every file gets a single inode. Hard and soft links each get their own inode, even though they point to another file. They are files, themselves.

−

To test, we're going to change inodes on soft from 0 to 665 (currently using 664):

+

You can set both hard and soft limits. Hard limits are limits which are not allowed to be bypassed. The user, once reaching the hard limit, will be informed that there is no longer any space available on the disk.

−

<pre>

+

<center>[[image:hfs_quota_exceed.png]]</center>

+

Soft limits are able to be bypassed, temporarily. Users are permitted to exceed their soft limits for a grace period that may be specified per filesystem. Once the grace period has expired, the soft limit is enforced as a hard limit. Use the command ''edquota -t'' to change the grace period.

+

== More Information ==

+

More information on HFS+ can be found at http://en.wikipedia.org/wiki/Hierarchical_File_System

+

[[Category: Mac OS X]]

+

== More Information ==

== More Information ==

More information on HFS+ can be found at http://en.wikipedia.org/wiki/Hierarchical_File_System

More information on HFS+ can be found at http://en.wikipedia.org/wiki/Hierarchical_File_System

[[Category: Mac OS X]]

[[Category: Mac OS X]]

Revision as of 09:52, 5 January 2009

Contents

Introduction

HFS+ on Mac OS X supports volume=level quotas based on user and group IDs. The corresponding quota file names are .quota.user and .quota.group. These files reside in the file system's root directory. Each file contains a header, followed by a hash table of structures specifying various quota limits and usage values for user or group IDs.

Enabling Disk Quotas

To enable disk quotas on Mac OS X systems, we need to create .quota.ops.user (or .quota.ops.group) within the file system's root directory. For my example here, I'm using my MacBook Pro with a single partition.

First, we need to escalate our privileges to root.

ecrist@Swordfish:~-> sudo csh
Password:
root@Swordfish:~->

Next, we need to create an empty options file:

root@Swordfish:~-> touch /.quota.ops.user
root@Swordfish:~->

After the options file is created, we should be able to run repquoata -a to get a list of current disk usage, by user name. Note that this command, when run initially, may take a few moments.

My user name, ecrist, you'll notice, has a current usage of around 6GB (listed in 1K blocks).

Turn quotas on with the quotaon command:

root@Swordfish:~-> quotaon /
root@Swordfish:~->

The above command requires a filesystem device or mount path after quotaon. In my example, I've only got one mounted system. If you've got a USB device, or a second hard disk, use the mount point in place of / above.

At this point, disk quotas have been enabled, but there's currently no policy in place to enforce.

Setting Quota Limits

Once disk quotas have been enabled, we can set limits for our users. For this example, I've created a user, test, to test quotas.

We can edit user quotas with the edquota command. edquota has many options, see the man page for a complete description. For our uses, we're going to use the -u (user) option, followed by a user name.

root@Swordfish:~-> edquota -u test

You will get a vi session with a temp file opened for editing. In our example, after running the above command, we have the following on our screen:

While this isn't a vi how-to, I'll try to walk you through a bit so you can get your quotas defined. What we want to change in this file is the number (currently 0 for both) for hard and soft limits. For reference, inodes are files on the file system. Each and every file gets a single inode. Hard and soft links each get their own inode, even though they point to another file. They are files, themselves.

You can set both hard and soft limits. Hard limits are limits which are not allowed to be bypassed. The user, once reaching the hard limit, will be informed that there is no longer any space available on the disk.

Soft limits are able to be bypassed, temporarily. Users are permitted to exceed their soft limits for a grace period that may be specified per filesystem. Once the grace period has expired, the soft limit is enforced as a hard limit. Use the command edquota -t to change the grace period.