hubertf's NetBSD Blog
Send interesting links to hubert at feyrer dot de!
 
[20070425] Things you didn't know about dd(1)
... i guess: I tried to find a way on how to create a 10MB disk image with dd(1) but found that the size specifiers for bs= are not really portable, at least as long as you don't want to give full (big) numbers. NetBSD has 'm' as size multiplier, Linux has 'M', and the Single Unix Specification has no opinion on the topic. Doh.

But reading the SUSv3 dd(1) page again and a bit closer, I found that you can use the following for "bs=" (and some others): ``Two or more positive decimal numbers (with or without k or b) separated by x, specifying the product of the indicated values''

I.e. that the following command just does the right thing in a portable, standard conforming way:

dd if=/dev/zero bs=10x1024x1024 count=1 of=empty

[Tags: , , ]


Disclaimer: All opinion expressed here is purely my own. No responsibility is taken for anything.

Access count: 36184219
Copyright (c) Hubert Feyrer