LinuxQuestions.org
Review your favorite Linux distribution.
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 05-19-2015, 08:10 PM   #1
linuxmantra
Member
 
Registered: Dec 2013
Posts: 110

Rep: Reputation: Disabled
Create a Large file in Linux


I want to create a large file size lets says 600G. I used command
# fallocate -l 600G file01
Although I got the file of my size but the things is, there is no data. I want to create a file with size 600G and random data in it.

Any suggestion?
 
Old 05-19-2015, 09:02 PM   #2
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Back to Debian, and only Debian.
Posts: 1,141
Blog Entries: 7

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
This is going to take a while, but something like this should work for you:

Code:
dd if=/dev/random of=filename bs=1M count=6000
You could also use bs=1G count=6 but you may get an error about not enough memory on such an operation.
 
1 members found this post helpful.
Old 05-19-2015, 09:07 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,049

Rep: Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915
Quote:
Originally Posted by goumba View Post
This is going to take a while
This may qualify as the understatement of the day so far ....
 
1 members found this post helpful.
Old 05-19-2015, 09:09 PM   #4
linuxmantra
Member
 
Registered: Dec 2013
Posts: 110

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by goumba View Post
This is going to take a while, but something like this should work for you:

Code:
dd if=/dev/random of=filename bs=1M count=6000
You could also use bs=1G count=6 but you may get an error about not enough memory on such an operation.
Thanks, Yes, I was testing 'dd' command.But, the thing is it is slow. My command was:
# dd dd if=/dev/urandom of=file01 bs=1024 count=2097152

Little confusion, which one to use /dev/random or /dev/urandom so that I don't have to wait long to populate my file.
 
Old 05-19-2015, 11:44 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,049

Rep: Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915
As the manpag says, urandom will be quicker, but not as random. May not matter.
There is also frandom, but probably isn't available in your distro, so you'd have to compile and insmod it.

For junk (rather than truly random data) to fill a file like that, I generate a small random file (10 Meg say), and merely copy it multiple times to the destination file. Much quicker, but not close to random.
 
  


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
How to create large size file with some random characters and numbers? lalitaddiwar Linux - Newbie 11 05-18-2015 05:17 PM
[HELP] How to create large number of raw devices from file stevetlam Linux - Newbie 4 05-24-2013 09:12 AM
[quick] trying to split a large file but linux says it's to large steve51184 Linux - General 16 05-06-2008 08:40 AM
How to create a large file NewBudda Linux - Software 6 06-04-2007 03:06 AM


All times are GMT -5. The time now is 07:13 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