Limit size of a subdirectory
Sorry if this sound a bit basic, but is it possible to limit the size of a subdirectory rather than a filesystem?
I've figured out that I can limit individual users by using quota to restrict usage per mounted filesystem, but I need two shared areas for a whole bunch of users who will be accessing these areas via guest logins under Samba. As such they'll all appear to be the same user. Current structure is: data | ---> general | ---> special I need to make it so that there is a limit of 70GB under the special directory whilst allowing the general directory to use as much space as is left over. Any ideas? Cheers, Carl. |
Usually Samba will use the system quotas but you're probably looking for this that can be used within Samba when no system API can be used:
From the man page: Code:
set quota command (G) |
In short, no, because there is no such thing as the "size" of a directory (except the size of the actual directory blocks, which is of little concern). The directory structure is merely an indexation system, not a set of containers.
|
Thanks for that both of you.
I suppose I should have phrased this a little better rather than referring to the "size of a directory", I should have said "size of the total file contents indexed within that directory". I didn't think there was any support for this, but it's been a while since I used Samba and it may have been something added recently (not that I could find it @ samba.org). Carl. |
I gathered what you meant, but the "total size of the file contents" doesn't really have a definitive meaning. Think about hardlinked files for example, if a file is hardlinked in two directories, which directory should count the size? The first one alphabetically? The directory with the lower inode number? Both (but then the parent directory whould have the wrong size...)?
|
You could try this;
make the 'special' dir owned by another user and limit him using Linux or Samba quotas. Give the other REAL users group rw access to that dir. |
Or you could create a container file that is the size that you want to limit file usage, mount it via a loop device, format it, and mount it on that directory.
Do these steps one time. Code:
dd if=/dev/zero of=/container.file bs=4K count=4K Code:
/container.file /data/special ext3 defaults,loop 1 1 |
All times are GMT -5. The time now is 09:03 AM. |