View previous topic :: View next topic |
Author |
Message |
gustavolinux n00b
Joined: 13 Aug 2008 Posts: 28
|
Posted: Wed Aug 13, 2008 7:13 pm Post subject: help: to limit a folde`s size without using quotas |
|
|
Friends, could anybody there give me a light, please, to solve the following problem: I need a way to limit the size of a folder, but without using group or user quotas... is there a good solution?
For example, I want to avoid that folder X grows up more than 100MiB, no matters who writes to the folder...
If there is no such way, maybe do you think that it is possible to create a new user account just to control the size of the folder X? I mean to put this new user as the owner of the folder X and allow any access to the folder... Do you think that, if someone writes to the folder, the quota of the new user would be consumed and reach an unbreakable limit?
thanks in advance |
|
Back to top |
|
|
timeBandit Bodhisattva
Joined: 31 Dec 2004 Posts: 2719 Location: here, there or in transit
|
Posted: Wed Aug 13, 2008 7:57 pm Post subject: |
|
|
The first thing that comes to mind is to create and mount a loopback filesystem on the size-restricted folder. Allow a little extra space in the file for filesystem overhead. For example, something like this: Code: | # dd if=/dev/zero of=/var/lib/sandbox.ext3 bs=1048576 count=106
# losetup /dev/loop0 /var/lib/sandbox.ext3
# mke2fs -j /dev/loop0
# mkdir /mnt/sandbox
# mount /dev/loop0 /mnt/sandbox | This creates a a 100MB filesystem in the file /var/lib/sandbox and mounts it on /mnt/sandbox.
This requires loopback support enabled in your kernel. Future mounts are simpler: mount -o loop /var/lib/sandbox.ext3 /mnt/sandbox. To have it mounted at every boot, edit /etc/fstab as required (be sure to include loop in the options column) and ensure the loop device module is loaded at startup (if you compiled it as a module).
Also: Welcome to the forums and please read and heed our Guidelines--in particular, item #12 regarding cross-posts. I do not speak Portuguese but nonetheless recognized that you asked the same question earlier today. _________________ Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others. |
|
Back to top |
|
|
gustavolinux n00b
Joined: 13 Aug 2008 Posts: 28
|
Posted: Wed Aug 13, 2008 9:10 pm Post subject: thanks and sorry |
|
|
thanks timeBandit, I will have to study your answer, because I'm not that sharp with linux...
sorry about the cross posts... I think I did it again before reading your answer
the post "setgid e controle de quota de um diretório"
https://forums.gentoo.org/viewtopic-p-5182441.html#5182441
is related.. (only posted in portuguese)
thanks again |
|
Back to top |
|
|
gustavolinux n00b
Joined: 13 Aug 2008 Posts: 28
|
Posted: Tue Aug 19, 2008 3:20 pm Post subject: solved |
|
|
just to give a feedback: a loop device was a really good idea... to every folder that I want to limit its size I create an image of a file system with the right size... []'s |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|