LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Make dummy files to take space away from users (https://www.linuxquestions.org/questions/linux-newbie-8/make-dummy-files-to-take-space-away-from-users-4175455552/)

anon091 03-25-2013 03:46 PM

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?

spiky0011 03-25-2013 04:11 PM

Hi

This might help
http://www.yolinux.com/TUTORIALS/Lin...ialQuotas.html

anon091 03-25-2013 04:16 PM

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.

TobiSGD 03-25-2013 04:25 PM

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
This command will copy 100 chunks of 1M blocksize from /dev/zero (which has no other purpose as emitting zeroes) to a file called filename.

anon091 03-25-2013 04:30 PM

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.

TobiSGD 03-25-2013 04:38 PM

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.

anon091 03-26-2013 10:41 AM

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.

chrism01 03-27-2013 11:19 PM

Actually, no need to restart system, just remount the partition http://www.linuxtopia.org/online_boo...tas-remounting
Code:

mount -o remount <file-system>

anon091 03-27-2013 11:31 PM

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

chrism01 03-28-2013 01:46 AM

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.