Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Quota is based upon filesystems, but you can always create a virtual filesystem and mount it on a specific (empty) directory with the usrquota and/or grpquota flags. In steps this will be:
1. create the mount point
2. create a file full of /dev/zero, large enough to the maximum size you want to reserve for the virtual filesystem
3. format this file with an ext3 filesystem (you can format a disk space even if it is not a block device, but double check the syntax of every - dangerous - formatting command)
4. mount the newly formatted disk space in the directory you've created as mount point, e.g.
Code:
mount -o loop,rw,usrquota,grpquota /path/to/the/formatted/disk/space /path/of/mount/point
5. Set proper permissions
6. Set quotas
and the trick is done.
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986
Rep:
To answer your question, you could have a quota on a specific directory, but you would need to create a new partition specifically for that directory. Otherwise, the quotas apply to users and groups on a specific volume.
To answer your question, you could have a quota on a specific directory, but you would need to create a new partition specifically for that directory. Otherwise, the quotas apply to users and groups on a specific volume.
Actually the filesystem with quota can be either a block device (like a partition) or a reserved disk space (pseudo-device). If you don't want to re-partition the hard disk, the latter can be a solution.
Once the virtual filesystem is created after that can i increase the size of filesystem.
Yes. Once I increased the size of a virtual filesystem on a Fedora Core 5 machine and never experienced any problem with it. I had a filesystem of 150 Mb in /usr/virtual-disk/data.ext3 and I mounted it on /data. The following commands worked for me
Code:
umount /usr/virtual-disk/data.ext3
cd /usr/virtual-disk
e2fsck -f data.ext3
resize2fs -p data.ext3 300M
mount -o loop,rw,usrquota,grpquota /usr/virtual-disk/data.ext3 /data
I doubled the size of the filesystem and no data was lost. Anyway, better to do a backup of any valuable data when performing filesystem operations.
Great solution for a quick creation of quoted directories (for samba shares for example). This even allows for free space monitoring in the directories by Nagios or alike if needed. Thanks a lot folks!
Just wanted to sum things up, I had to dig around a bit to find the right commands.
3. format this file with an ext3 file-system (you can format a disk space even if it is not a block device, but double check the syntax of every - dangerous - formatting command)
Great solution for a quick creation of quoted directories (for samba shares for example). This even allows for free space monitoring in the directories by Nagios or alike if needed. Thanks a lot folks!
Just wanted to sum things up, I had to dig around a bit to find the right commands.
3. format this file with an ext3 file-system (you can format a disk space even if it is not a block device, but double check the syntax of every - dangerous - formatting command)
I also found a similar set of tools for reiserfs, couldn't find a resize tool for jfs.
In this solution the space gets eaten away from the host partition(s), use with caution, be sure to save some space for future expansions.
Hi friends... thanks for the steps to create virtual disks. I'm still new and need your support. I've created the above directory successfully. I wish to know where to configure should i need to mount the directory once the machine start. Please guide me. Thanks...
* /var/virtual_disks/directory_with_size_limit.ext3 is the file you created containing the new file system
* /path/of/mount/point is the directory that you want to use and that should have limited size.
So for example if you wanted to limited the size that /var/log can use to 1 GB, then /path/of/mount/point should be replaced with /var/log and /var/virtual_disks/directory_with_size_limit.ext3 should be a 1 GB file.
Last edited by pbalm; 12-09-2017 at 09:53 AM.
Reason: fix quote
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.