Tutorials, Guides, Tips, and Tricks from Everyday Experiences

I had a disk that was partitioned in such a way that a large chunk at the end of the disk was unallocated space and the partition before it was where I wanted to tell ‘dd’ to stop copying. This is normally easy when I have the number of bytes I want to copy, but all I had were the the number of heads, sectors, and cylinder start/end values given by the output of “fdisk -l”. I knew that I wanted to end at cylinder 508 since that was where the particular partition ended, but I still didn’t know which byte it ended at. I found an easy way to tell ‘dd’ what I wanted by using the ‘bs=xxb’ option like this:

dd if=/dev/sdb of=sd_image.dd bs=124x508x62b count=1

Where 124=heads, 508=cylinders, and 62b=sectors at 512bytes each. This is really simple math, but it’s simpler just to tell ‘dd’ to calculate it instead (124*508*62*512 = 1999618048bytes).

And that’s what I learned today!

Related

Feel free to
donate if this post prevented any headaches! Another way to show your appreciation is to take a gander at these relative ads that you may be interested in: