Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] fdisk - blocks to bytes
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
0x001A4
Apprentice
Apprentice


Joined: 08 Jan 2006
Posts: 263
Location: Mississauga, Ontario

PostPosted: Wed Jul 16, 2008 3:56 pm    Post subject: [SOLVED] fdisk - blocks to bytes Reply with quote

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.
Code:
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:
Code:
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
Back to top
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Wed Jul 16, 2008 4:02 pm    Post subject: Reply with quote

Maybe fdisk -l
Back to top
View user's profile Send private message
0x001A4
Apprentice
Apprentice


Joined: 08 Jan 2006
Posts: 263
Location: Mississauga, Ontario

PostPosted: Wed Jul 16, 2008 4:21 pm    Post subject: Reply with quote

That is where I'm getting the information I'm talking about, but it doesn't provide the number of bytes per partition.
Back to top
View user's profile Send private message
cyrillic
Watchman
Watchman


Joined: 19 Feb 2003
Posts: 7313
Location: Groton, Massachusetts USA

PostPosted: Wed Jul 16, 2008 4:54 pm    Post subject: Re: fdisk - blocks to bytes Reply with quote

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.
Back to top
View user's profile Send private message
0x001A4
Apprentice
Apprentice


Joined: 08 Jan 2006
Posts: 263
Location: Mississauga, Ontario

PostPosted: Wed Jul 16, 2008 5:01 pm    Post subject: Reply with quote

Awesome. Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum