Help with sfdisk

Daniel Carrera daniel.carrera at zmsl.com
Fri Apr 14 17:27:48 UTC 2006


Gary W. Swearingen wrote:
>>I need a way to get the number of cylinders for the script, but it
> looks like the output from sfdisk is not reliable!!!!!!  Any ideas?
> 
> Use "parted"?

I don't think parted can report back on the size of the disk. At least, 
I don't seen how from the man page.

I'm experimenting with another idea: Use sfdisk to find the number of 
blocks, the bytes per block (should be 1024) and the bytes per cylinder. 
Then find the number of cylinders with:

# 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).

> 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.

Cheers,
Daniel.
-- 
      /\/`) http://opendocumentfellowship.org
     /\/_/
    /\/_/   A life? Sounds great!
    \/_/    Do you know where I could download one?
    /




More information about the ubuntu-users mailing list