From Hank on Wed, 10 May 2000
I understand that under Linux you can set the home directories to a certin size. Either I am not looking in the right place or for the right thing, but I can't seem to find any info on this. I run Mandrake v7.0, and I am just trying to learn about Linux as best I can. I love the Linux on a floppy distributions, I can show everyone I know how well Linux runs now.
Thanks for your help, Hank
It depends on what you mean by "set ... to a certain size."
First you home directories under Linux, or any form of UNIX can be any normal directory tree. Normally the home directory for each account is set via a field in the /etc/passwd file (the main repository for all user account information --- ironically the one vital bit of account data that is normally no longer stored in /etc/passwd is the user's password hash; but that's a long story).
Under Linux is is common to have all of the user home directories located under /home. This should be on it's own filesystem (partition) or it should be a symlink to some directory that is not on the root filesystem. Actually the whole issue of how filesystems should be laid out is frought with controversy among sysadmins and techies. There is a relatively recent movement that says: "just make it all one big partition and forget about all this fussing with filesystems."
Anyway, you are free to configure your filesystems pretty much any way you want under Linux. You can have several hard drives: two per IDE channel (/dev/hda and /dev/hdb for the first controller, /dev/hdc and /dev/hdd for the next, and so on), 7 for each traditional SCSI host, and 15 for the "wide" controllers (/dev/sda, /dev/sdb, etc). Each hard drive can have up to four primary partitions (/dev/hda1, /dev/hda2, etc) one of which can be an "extended partition container" (actually there are apparently now TWO types of "extended container" partition types, so you can have one of each). The "extended container" partitions can hold a number of additonal partitons. I've heard that you can have upto 12 partitions on a drive (I don't think I've ever gone beyond 10).
Unfortunately you have to make these decisions early on (when running 'fdisk' during your Linux installation. There is an 'ext2resize' program floating around the 'net. I haven't tried it yet (maybe on my next "sacrificial" system).
So, you can limit the size of the whole home directory tree by simply putting /home on its own filesystem (and sizing it as you need).
To limit how much space individual users can consume (under their home directories or on any other filesystems) you can use the Linux "quotas" support. This involves a few steps. You much ensure that the "quotas" feature is enabled in your kernel (I suspect that Mandrake ships with this setting). Then you want to read the instuctions in the Quota mini-HOWTO at http://www.linuxdoc.org/HOWTO/mini/Quota.html
Once the kernel support is there basically you do the following:
*) Create a couple of (initially empty) files at the
root of each partition (fs) on which you wish to enforce quotas.
*) Edit your /etc/fstab file to add the usrquota and/or grpquota mount options to each these filesystems
*) Run the command 'edquota' (with the -u or -g option
for user or group quotas respectively) and create a
series of text entries to describe your quota policies in the appropriate syntax.
*) Ensure that the "quotaon" command is run by your
system startup scripts (the init or "rc" scripts).
(This is probably also already being managed by your distribution).
Note that the mini-HOWTO is good, but you must follow it carefully. Be particularly carefull about the syntax you use in these quota files.
The whole affair is further complicated by the existence of both hard and soft quotas. Bascially you can set two different limits on each user or group's utilization of the space on each of your filesystems. The "soft quota" marks a point at which the users will start to get warnings while the hard quote marks a point at which attempts to create files or allocate more blocks to existing files will fail.
Read Mr. Tam's mini-HOWTO --- it's pretty old, but it has the details you need. It also shows some techniques for using on users quota configuration as a template --- so you can clone those settings to other users quickly and automatically without having to manually edit your quota files all the time.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18