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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-04-2005, 01:46 PM
|
#1
|
Senior Member
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249
Rep:
|
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.
|
11-04-2005, 01:54 PM
|
#2
|
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 6,631
|
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.
|
11-04-2005, 02:21 PM
|
#3
|
Senior Member
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249
Original Poster
Rep:
|
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.
|
|
|
11-04-2005, 03:12 PM
|
#4
|
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 6,631
|
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
|
|
|
09-30-2008, 07:40 AM
|
#5
|
LQ Newbie
Registered: Mar 2007
Posts: 1
Rep:
|
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
|
|
|
03-31-2010, 08:56 AM
|
#6
|
LQ Newbie
Registered: Mar 2010
Posts: 1
Rep:
|
Quote:
Originally Posted by vinayak_sarate
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 !
|
|
|
All times are GMT -5. The time now is 02:42 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|