# [SOLVED] fdisk - blocks to bytes

## 0x001A4

Can anyone tell me how to calculate the number of bytes per partition based on the number of blocks fdisk tells me I have?

This is what I have figured and I'm not sure if it's correct:

I have 3 250GB harddrives. The first one I'll use in my example. It has 4 partitions, including one for swap.

```
Partition - Blocks

/dev/sda1 - 71681998

/dev/sda2 - 71682030

/dev/sda3 - 10241437

/dev/sda4 - 90590535
```

What I have figured is if I divide the number of blocks by 1024, and then divide the result by 1024 again, I get a number that looks right.

So I have this:

```
Partition - Size (GB)

/dev/sda1 - 68.36

/dev/sda2 - 68.36

/dev/sda3 - 9.77

/dev/sda4 - 86.39

Total     - 232.88
```

Now this looks right to me except for the 10GB of swap space. I cant imagine giving that much space to swap but who knows. Can anyone confirm or know of a better way to calculate disk space based on any of the information fdisk gives?Last edited by 0x001A4 on Wed Jul 16, 2008 5:01 pm; edited 1 time in total

----------

## d2_racing

Maybe fdisk -l

----------

## 0x001A4

That is where I'm getting the information I'm talking about, but it doesn't provide the number of bytes per partition.

----------

## cyrillic

 *0x001A4 wrote:*   

> What I have figured is if I divide the number of blocks by 1024, and then divide the result by 1024 again, I get a number that looks right. 

 

fdisk displays 1024 byte blocks, so your calculation is correct.

----------

## 0x001A4

Awesome. Thanks!

----------

