Blocks verses Bytes,Mbytes etc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Something I've wondered each time I fire up fdisk for some reason:

Is there an even handed way to convert BLOCKS into Bytes?

A typical fdisk readout:

 Disk /dev/hda: 255 heads, 63 sectors, 2434 cylinders

  Units = cylinders of 16065 * 512 bytes
  
     Device Boot    Start       End    Blocks   Id  System
  /dev/hda1   *         1       513   4120641    7  HPFS/NTFS
  /dev/hda2           514      2434  15430432+   f  Win95 Ext'd (LBA)
  /dev/hda5           514       705   1542208+  83  Linux
  /dev/hda6           706      1215   4096543+  83  Linux
  /dev/hda7          1216      1432   1743021   83  Linux
  /dev/hda8          1433      1503    570276   83  Linux
  /dev/hda9          1504      1535    257008+  83  Linux
  /dev/hda10         1536      1552    136521   82  Linux swap
  /dev/hda11         1553      2203   5229126   83  Linux
  /dev/hda12         2204      2434   1855476    b  Win95 FAT32


I've devised scripting several times to convert cylinders (roughly)
to MB and other assorted schemes to render fdisk output more
understandable.

But its often the case when one needs fdisk that not much else is
available so I wondered if there is a handy way to convert the Blocks
shown above into Bytes, or at least some rough approximation?

Something a math challenged dope could do with paper and pencil while
figuring out how to set up a fresh install.  Or at least with a
cheapy calculator.

My first impulse was to get a df -h reading of the same disk:

 Filesystem            Size  Used Avail Use% Mounted on
 /dev/hda5             1.4G  216M  1.1G  16% /
 /dev/hda11            4.9G  2.6G  2.0G  55% /anex
 /dev/hda7             1.6G  437M  1.1G  28% /home
 none                   61M     0   61M   0% /dev/shm
 /dev/hda9             243M  4.1M  226M   2% /tmp
 /dev/hda6             3.8G  2.3G  1.3G  63% /usr
 /dev/hda8             548M   99M  422M  19% /var

Then use a df -k reading to work out the math by dividing the figures
under Size by the figures under k-Blocks... But something tells me this
is not a good approach.  Also I hoped there may already be some nifty
way to do this.





[Index of Archives]     [Fedora Users]     [Centos Users]     [Kernel Development]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat Phoebe Beta]     [Yosemite Forum]     [Fedora Discussion]     [Gimp]     [Stuff]     [Yosemite News]

  Powered by Linux