Make dummy files to take space away from users
This may sound silly, but I have a volume that only has one samba share on it. I want to use up some of the free space on there as to limit how much data the users can actually put on the server. Is there a slick way in Linux to take up space, or should I just use my machine to make a bunch of very large files and copy them to a folder not in the samba share?
|
|
Thanks spiky. I guess my suggestion of just making a bunch of big files was probably the least elegant way now that I think about it haha. I'm not even sure how to make Linux make a file that is exactly a certain size to be honest.
|
Of course filesystem quotas are the way to go here, but just for completeness, if you want to create a file with a specific size, for example 100MB, you can do that with dd, for example with
Code:
dd if=/dev/zero of=filename bs=1M count=100 |
Thanks TobiSGD. Looks like quotas require a restart and are definitely the way to go here, but I think temporarily I may be stuck manually doing that command you just gave me over and over again until I get to where I need to be. Then I can clean it up later when I get some downtime for my server.
|
You don't have to do it over and over again, just change the count-parameter to your needs, in the form the command is currently it gives you the filesize in MB, so just change it to 1000 if you want 1000MB to be occupied, or any other value you need. Keep in mind that you shouldn't use this method when the shared directory is in the /-partition, otherwise you will run into serious issues.
|
OK, thanks. I guess that leads to my next question, which I'll put in a new post as it's kinda off topic to this one. But is one way better on an ext4 filesystem, for example: one 10GB file vs. 100 100MB files, to occupy the same space. Not sure what's better for the filesystem or if it really matters, or if one way takes longer if the volume has to be fsck'd. I'll pose that question in a new thread on here, since technically this one is solved. Thanks for your help.
|
Actually, no need to restart system, just remount the partition http://www.linuxtopia.org/online_boo...tas-remounting
Code:
mount -o remount <file-system> |
Oh ok, guess i will have to read up on it more than so i can do it. When i do the remount will i have to restart samba after also, or will it auto recognize its back
|
I think you'll get away with not restarting, remount is an atomic operation ... On the other hand no harm in doing so :) (in which case advise users to get off briefly).
|
All times are GMT -5. The time now is 07:45 PM. |