LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-25-2013, 04:46 PM   #1
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Rep: Reputation: 46
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?
 
Old 03-25-2013, 05:11 PM   #2
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Centos6.3/Debian
Posts: 2,127
Blog Entries: 1

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
Hi

This might help
http://www.yolinux.com/TUTORIALS/Lin...ialQuotas.html
 
1 members found this post helpful.
Old 03-25-2013, 05:16 PM   #3
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Original Poster
Rep: Reputation: 46
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.
 
Old 03-25-2013, 05:25 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,130
Blog Entries: 2

Rep: Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825
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.
 
1 members found this post helpful.
Old 03-25-2013, 05:30 PM   #5
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Original Poster
Rep: Reputation: 46
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.
 
Old 03-25-2013, 05:38 PM   #6
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,130
Blog Entries: 2

Rep: Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825
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.
 
1 members found this post helpful.
Old 03-26-2013, 11:41 AM   #7
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Original Poster
Rep: Reputation: 46
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.
 
Old 03-28-2013, 12:19 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Actually, no need to restart system, just remount the partition http://www.linuxtopia.org/online_boo...tas-remounting
Code:
mount -o remount <file-system>
 
1 members found this post helpful.
Old 03-28-2013, 12:31 AM   #9
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Original Poster
Rep: Reputation: 46
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
 
Old 03-28-2013, 02:46 AM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
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).
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
"Apache (internal dummy connection)" or [error] could not make child process bbrian017 Linux - Server 2 05-04-2012 01:34 PM
scripting: how to cp a list of files which starts with - or space without - or space? simransab Linux - Newbie 8 10-15-2009 05:12 AM
Find the space for files owned by specific users sahil.jammu Linux - Newbie 15 03-04-2009 02:15 PM
how to make a dummy driver in kernel 2.6 siddhi817 Linux - Newbie 1 05-12-2008 01:39 AM
How to administrate one root from another and make it a dummy one placemevinod Linux - Networking 3 01-28-2007 01:27 AM


All times are GMT -5. The time now is 10:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration