This module provides Ruby access to manipulating the disk quotas.
- Linux 2.4.x, 2.6.x and newer
- Solaris 2.6, 7, 8
- FreeBSD
- NetBSD
- OpenBSD
- Dragonfly BSD
- Mac OS X
Common parameters:
-
devis a device file (e.g. /dev/hda0) or a mount point (e.g. /mnt/foo), where supported. Mount point look up is implemented on BSD and Linux targets. -
quotafileis a quota(s) file -
idcan be an integer to mean uid, otherwise it can be a UserID or a GroupID object to signal uid or gid respectively. -
diskquotais a DiskQuota structure. It stores all the fields of the quota settings. For possible field names and meaning of them see the local quotactl man pages on your system.
Functions:
-
Quota.quotaon(dev, quotafile)to turn quota on. -
Quota.quotaoff(dev)to turn quota off. -
Quota.getquota(dev, id)returns a DiskQuota structure on success. -
Quota.setquota(dev, id, diskquota)updates both the limit and usage settings from the provided quota structure. -
Quota.setlimit(dev, id, diskquota)updates only the limit settings from the provided quota structure. This is not supported on all systems. -
Quota.setusage(dev, id, diskquota)updates only the usage settings from the provided quota structure. This is not supported on all systems. -
Quota.sync(dev)flushes all the changes made to the quota system. -
Quota::UserID.new(id)orQuota::UserID[id]to create a new uid object. -
Quota::GroupID.new(id)orQuota::GroupID[id]to create a new gid object. -
Quota::DiskQuota.newto create a new DiskQuota structure.
Constants:
-
Quota::BlockSize(number), quota block size on the given system. Can be used for converting between quota blocks count and bytes. -
Quota::VERSION(string), version of Ruby/Quota.
The field names depend on underlying system used, but appropriate aliases and mappings are provided.
Preferred generic field names:
bhardlimit- hard limit in blocksbsoftlimit- soft limit in blockscurblocks- current usage in blocksihardlimit- hard limit in inodes (~files)isoftlimit- soft limit in inodes (~files)curinodes- current usage in inodes (~files)btimelimit- grace period for over the soft limit of blocksitimelimit- grace period for over the soft limit of inodes
Aliases:
btimelimit<>btimeitimelimit<>itimecurinodes<>curfilescurblocks<>curspacecurblocks<>curbytesihardlimit<>fhardlimitisoftlimit<>fsoftlimititimelimit<>ftimelimit
BSD:
bhardlimitbsoftlimitcurblocksihardlimitisoftlimitcurinodesbtimeitime
Linux:
bhardlimitbsoftlimitcurspaceihardlimitisoftlimitcurinodesbtimeitime
Linux <2.4.22:
bhardlimitbsoftlimitcurblocksihardlimitisoftlimitcurinodesbtimeitime
Solaris:
bhardlimitbsoftlimitcurblocksfhardlimitfsoftlimitcurfilesbtimelimitftimelimit
Mac OS X:
bhardlimitbsoftlimitcurbytesihardlimitisoftlimitcurinodesbtimeitime