LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-11-2003, 05:22 AM   #1
tszhim
Member
 
Registered: Feb 2003
Posts: 54

Rep: Reputation: 15
dd


How to use dd command to create a file test.img of size 50MB, containing all the zeros, which can be done by copying the device file /dev/zeros?
 
Old 12-11-2003, 05:41 AM   #2
BSlack
Member
 
Registered: Nov 2003
Location: Italy: 44° 42' N - 12° 11' E
Distribution: Slackware, what else?!!
Posts: 63

Rep: Reputation: 15
Try
dd if=/dev/zero ibs=1k obs=1k count=51200 of=test.img
 
Old 12-11-2003, 07:48 AM   #3
tszhim
Member
 
Registered: Feb 2003
Posts: 54

Original Poster
Rep: Reputation: 15
can u explain about it?
 
Old 12-11-2003, 08:14 AM   #4
BSlack
Member
 
Registered: Nov 2003
Location: Italy: 44° 42' N - 12° 11' E
Distribution: Slackware, what else?!!
Posts: 63

Rep: Reputation: 15
Well.... I never use dd before (or maybe yes but I don't remember), I read the man page only. This works on my system, the options are:
if -> the input file
of -> the output file
ibs -> the input block size in bytes (1k = 1024 bytes = 1 kilobytes)
obs -> the output block size in bytes
count -> the number of blocks you want to copy from if to of (51200 blocks * 1024 byte/blocks = 52428800 bytes = 50MB)

you can use also:
dd if=/dev/zero of=test.img ibs=1M obs=1M count=50
i'm working on solaris at the moment, it haven't the M multiplicative suffix. I think this is a GNU extension.
 
  


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 On
HTML code is Off



LinuxQuestions.org > Forums > Linux Forums > Linux - General

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