LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 11-04-2005, 01:46 PM   #1
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Rep: Reputation: 48
Creating large size file for testing


I am writing a shell script which does some disk checking space and copies file here and there. Is there any way by which I can create file of size around 100MB-500MB using some command. I just need a file contents does not matter. Can I do that with the dd command? If yes, then what is the command that I need to give.?

Thanks
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 11-04-2005, 01:54 PM   #2
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,617

Rep: Reputation: 136Reputation: 136
100 MB :
Code:
dd if=/dev/zero of=file.out bs=1MB count=100
500 MB :
Code:
dd if=/dev/zero of=file.out bs=1MB count=500
 
2 members found this post helpful.
Old 11-04-2005, 02:21 PM   #3
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Original Poster
Rep: Reputation: 48
ahh. Thanks. Great. Also does the bs always has to be 1MB? What if I give bs=2MB and count=250 to create a 500MB space. This quesiton might be stupid but I am curious to know. Aslo I read the man page but I was not able to figure out anything from there.

Also I when I gave the following command:
dd if=/dev/zero of=file.out bs=1MB count=450
to create a file of size 450MB, it did created the file but the system got really slow after that. My windows were dragging when I try to move them around or switch from one window to another.?

Any ideas why this is happening?

Thank you once again.

Last edited by kushalkoolwal; 11-04-2005 at 02:32 PM.
 
Old 11-04-2005, 03:12 PM   #4
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,617

Rep: Reputation: 136Reputation: 136
The bs is the block size read into memory before be written, so increase it
uses more memory, but not that much if you use 2MB

Now as to why it slowed down your system, I can't tell... Maybe it was caused by
some other processes
 
Old 09-30-2008, 07:40 AM   #5
vinayak_sarate
LQ Newbie
 
Registered: Mar 2007
Posts: 1

Rep: Reputation: 0
Simple code will create a large sized file :

while [ 1 ]; do dd if=/dev/zero of=largefile bs=65535 count=1024;echo "HI"; sleep 2; done
 
Old 03-31-2010, 08:56 AM   #6
cniki
LQ Newbie
 
Registered: Mar 2010
Posts: 1

Rep: Reputation: 0
Talking

Quote:
Originally Posted by vinayak_sarate View Post
Simple code will create a large sized file :

while [ 1 ]; do dd if=/dev/zero of=largefile bs=65535 count=1024;echo "HI"; sleep 2; done
Maybe someone will believe you !
 
  


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
Very large pdf file size gmgartner Linux - Software 5 04-28-2005 12:23 PM
Large file size support for linux merlin23 Linux - Newbie 11 01-11-2005 09:01 AM
when creating a *.iso file, how to make the file size smaller? minm Linux - Newbie 8 12-26-2004 10:58 PM
Large disk size Shaddell Linux - General 1 01-07-2003 10:16 PM
Large drive- too much space lost by large block size? tome Linux - General 5 12-14-2001 02:32 PM


All times are GMT -5. The time now is 08:54 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration