LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-01-2007, 02:14 AM   #1
NewBudda
LQ Newbie
 
Registered: Mar 2007
Distribution: Suse
Posts: 21

Rep: Reputation: 15
How to create a large file


Hi all,
I would like to create a file that takes up a lot of disc space on Debian. Say 5 GB or more. Is there a way that I can create such a file from nothing? The reason I am asking is this: I would like to artifically fill my server after reinstallation and then shred that file to overwrite any information that might be left in the difference between a clean install and the previous install with data.
If theres a command to create a from "nothing" please let me know...
 
Old 06-01-2007, 02:28 AM   #2
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 66
dd if=/dev/zero of=/path/to/bigfile count=10000000

Yves.
 
Old 06-01-2007, 06:06 AM   #3
dasy2k1
Member
 
Registered: Oct 2005
Location: 127.0.0.1
Distribution: Manjaro
Posts: 963

Rep: Reputation: 36
try piping /dev/urandom to a file, not sure how you woudl stop it when you got to the right size tho
 
Old 06-01-2007, 06:53 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by dasy2k1
try piping /dev/urandom to a file, not sure how you woudl stop it when you got to the right size tho
dd is your friend

To use a pipe, you would have to do something like "cat /dev/urandom" I don't know if that's legal (and I am not about to try...... )
 
Old 06-01-2007, 07:03 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Sure it is, but you wouldn't pipe it - use it instead of /dev/zero in dd.
Use a decent blocksize as well.
 
Old 06-01-2007, 05:38 PM   #6
NewBudda
LQ Newbie
 
Registered: Mar 2007
Distribution: Suse
Posts: 21

Original Poster
Rep: Reputation: 15
thanks YinYeti, it worked like a charm!
 
Old 06-04-2007, 02:06 AM   #7
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 66
You're welcome

Note that dd is more powerfull than my knowledge reckons Thanks syg00 for reminding me about that. In my example, I used the default block size, which is 512 Bytes. By specifying a saner block size, you could at least simplify the computations that give you the "count" argument.
Besides, /dev/random or similar may indeed interest you if you want random content in your result file.

Yves.

Edit: see here:
http://www.linuxquestions.org/questi...d.php?t=362506

Last edited by theYinYeti; 06-05-2007 at 02:57 AM.
 
  


Reply



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
File too large (script is too large to execute) DeuceNegative Linux - General 1 05-09-2007 12:10 AM
can't create large files on RHEL 4 on AMD64 lltong Red Hat 2 01-06-2006 11:48 AM
"Attempting create too large a file system" suguru Linux - Hardware 2 02-23-2004 01:16 AM
Large tar file taking huge disk space in ext3 file system pcwulf Linux - General 2 10-20-2003 07:45 AM
Weird question... Fastest way to create large arbitrary files? wizade Linux - Software 9 09-06-2003 03:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:23 PM.

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
Open Source Consulting | Domain Registration