On Unix and some versions of Linux fdisk either does not report the size of the disk, or makes an incorrect calculation. This is because of the way that fdisks calculates sizes:

- 1000 bytes = 1 Kilobyte
- 1000 Kilobytes = 1 Megabye
- 1000 Megabytes = 1 Gigabyte

Normally calculations would be made using 1024, not 1000. Here is an image of the fdisk output from an older release of Ubuntu:

### Formula to calculate disk size based on Heads, Sectors and Cylinders

`Number of heads * Number of sectors * 512 * Number of cylinders`

From the example above:

255 * 63 * 512 * 8354 = 68,713,989,120 bytes

68,713,989,120/1024 = 67,103,505 kb

67,103,505/1024 = 65,530.76 mb

63.994 gb

### Calculator to work out the correct disk sizes from fdisk output

Input the number of cylinders, heads and sectors of your disk into this form and it will calculate how many Megabytes/Gigabytes the drive is.

Some old Unix systems do not report the disk size at all with fdisk, but you can normally get the numbers of heads, sectors and cylinders quite easily.

If you found this post useful, I’d really appreciate it if you left a rating. 🙂

## Leave a Reply