I am using the dd command for the first time, so I am wary, I've reading articles in wikipedia but have some unclear part, so I am asking here, is bs option matter? If I set the wrong number, would things go wrong? Like some bite in the drive be omitted or fail to copy? What's the best value for it?
1 Answers
While it is true that dd
is dangerous, there is also some paranoia about it. It is dangerous because if used wrongly, you can easily overwrite the data on your disk, not because it explodes if you bump it against the wall. You shouldn't be terrified of it, just read through man dd
to get an idea of how it works.
Anyway, the bs
option simply controls how many bytes dd should read at a time. The "right" value will depend on what you are trying to do but a "wrong" value will simply make the operation slower. This is not where the danger lies. As explained in info dd
:
bs=BYTES'
Set both input and output block sizes to BYTES. This makes `dd'
read and write BYTES per block, overriding any `ibs' and `obs'
settings. In addition, if no data-transforming `conv' option is
specified, input is copied to the output as soon as it's read,
even if it is smaller than the block size.
The common danger with dd
is that it is simple to mistake the input file for the output file and end up wiping your drive. That is what you should look out for.
That said, for a new Linux user, it really makes much more sense to use a differfent tool to clone a hard drive. Instead of using a normal Linux distribution CD, use one that is specifically created for this task. For example http://clonezilla.org/. Just download the clonezilla ISO, burn it onto a CD and boot from it. It will present you with an interactive menu allowing you to easily make an image of your hard drive:

- 100,812
-
I thought if you don't set bs to be an integer dividend of the drive size, it could leave some remaining bits at the end unwritten. – ki9 Oct 03 '19 at 17:43
-
@Keith that may be true (I don't know) but I'm not sure why you mention it. I don't think I use any specific values in this answer. – terdon Oct 03 '19 at 18:22
-
'cause you said
a "wrong" value will simply make the operation slower
. But if you want to write 10 bits and use bs=4, I think there'll be 2 extra bits unwritten. I read it somewhere. – ki9 Oct 10 '19 at 20:29 -
@Keith ah, yes, that makes sense. You can't write a number of bytes that isn't a multiple of your byte size, presumably. – terdon Oct 10 '19 at 23:00
dd
in the first place? There are other programs that can do what it does and judging by your question you're not particularly experienced with Linux. Why use dd? – terdon Mar 17 '14 at 13:40