Linux Directory Quota
Quick and dirty Linux directory quota.
This arose out of the need to place a size quota on a directory without having to resort to quota software or manual usage checking. It utilizes Linux virtual filesystem support to do the trick. The following assumes we want a ~100MB quota on a directory.
- Make a mount point
mkdir -p /mnt/quotadir
- Create an image file for the virtual file system
dd if=/dev/zero of=/mnt/quota.img bs=1024 count=100000
- Format the drive
mkfs.ext3 /mnt/quota.img
- Mount the drive
mount -o loop /mnt/quota.img /mnt/quotadir
- A permanent fstab entry would be
/mnt/quota.img /mnt/quota ext3 loop 1 2