Help with sfdisk

Gary W. Swearingen garys at opusnet.com
Fri Apr 14 18:30:38 UTC 2006


Daniel Carrera <daniel.carrera at zmsl.com> writes:

> # Perl
> $cylinders = int($blocks*$bytes_per_block/$bytes_per_cylinder);
>
> In my limited tests this seems to work (ie. I get the number of cylinders I'd expect).

Yeah, but what does sfdisk and/or the kernel expect?  Beware disaster.

I suspect that sfdisk got this part right (for it and the kernel):

   Disk /dev/hda: 79656 cylinders, 16 heads, 63 sectors/track

>> BTW, I don't recall every trying to write a partial hard disk block
>> (< 512b) with "dd" as you seem to have tried.  Are you sure that works
>> well?
>
> No. In fact, my tests lead me to believe that it doesn't work at all.

But wasn't that likely because of grub or part.table problems?  Did
you try reading a whole disk sector, changing part of the disk sector,

I got curious enough to try.  I read random # to MBR, wrote first 128
bytes with more #, and diff'd expectiations.  It worked.  But trying
to write 4 bytes in the middle did not work:

# echo -n gary | dd bs=4 count=1 skip=10 of=/dev/hda4
0+0 records in
0+0 records out
0 bytes (0 B) copied, 5.4e-05 seconds, 0.0 kB/s

BTW, it seems you can only skip by blocks, not by bytes.  But I didn't
study dd thoroughly; the info file wasn't installed like the manpage
says it should be.  :(




More information about the ubuntu-users mailing list