Quota Workaround?

Having never had any experience with disk quotas (aside from being limited by'em), I didn't think much about how my disks needed to be structured when I set everything up. Since I use a Linode 64, I decided to allocate as much space as possible for root, and use the rest for the swap.

Well now I discover that in order to setup quotas, the program needs the ability to unmount the user partition to do its thing. I think that's a bit extreme for what I need, and I certainly don't wish to have to reformat my disks to set this up, considering I finally got all my software working correctly.

So I was wondering if this might could be used as a workaround: use loopback filesystems. For example,

dd if=/dev/zero of=/home/USER.img bs=1024 count=102400

mkfs.ext3 /home/USER.img

mount -o loop /home/USER.img /home/USER

Of course I'd probably allocate a little more space than what's promised to the user since part of that is eaten up from the formatting, and possibly store the image files elsewhere, but theoretically, I can't see a problem with this. Is there something I'm missing? It seems to be a perfect way to limit how much space a user is allowed to work in without going to all the trouble of setting up quotas.

7 Replies

You could just resize your root partition, and setup a new partition for /home all using the LPM. Then copy over /home to the new partition, edit fstab, reboot, and your good to go.

Well now isn't that pretty awesome. I didn't realize I could resize'em like that once they were made. Perhaps I'll learn to look in all those options screens next time.

It's all resized now and running like a charm with the new /home. Now to figure out quotas.

And thanks!

Just a word of warning, since people tend to use quotas when they are going to give people local access… Be careful who you give shells to, compromising a machine locally is much easier than remotely.

$.02

-tiz

Yeah I don't think I would trust anyone with direct access to my machine. I just wanted quotas to move a couple of smaller sites I host for people all onto one machine (as long as it doesn't get bogged down) so that I wouldn't have to keep paying for standard web hosting elsewhere.

For enabling quotas, you don't need to cretae or hcnage any partitions.

All you have to do is change the approproate settings at /etc/fstab, install appropriate binaries (apt-get install quota) and reboot - most distros during reboot check for quota-enabled partitions and enable them.

@saman007uk:

For enabling quotas, you don't need to cretae or hcnage any partitions.

All you have to do is change the approproate settings at /etc/fstab, install appropriate binaries (apt-get install quota) and reboot - most distros during reboot check for quota-enabled partitions and enable them.

Would this command work after doing the other stuff?

# mount -o rw,remount,usrquota /home

(adjust filesystem name as needed; also add grpquota if needed.)

Might save a reboot if it does the trick.

Yes, for non-root directories that shoudl work (but as always, you will need to enable quotas using the quotaon command).

However, for root file-systems I've found that that does not work unless you reboot.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct