Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
insane block device notation!!
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
_______0
Guru
Guru


Joined: 15 Oct 2012
Posts: 521

PostPosted: Sat May 25, 2013 7:48 pm    Post subject: insane block device notation!! Reply with quote

hi,

I was trying to re-create exact size of a partition but I was faced with a huge problem about size conventions. They are anything but fsck,ed up.

to illustrate the problem.

Device Boot Start End Blocks Id System
/dev/sdXX * 2048 206847 102400

then fdisk ask to add numbers with K,M or G. I substracted 2048 from 206847 to get the value. I added M and resulted in out of range, added K and it was off. Then out of sheer luck I tried +100M just because I saw that number under gparted and resulted in the exact 206847 end range number.

This means that fdisk's 100M is exactly 204799 blocks!! wtf...

How on earth is possible to create accurate partitions with sane numbers???

Gparted, and kde's partition utility got the same darn problem. When adjusting is always some uneven numbers that don't correspond to the powers of 2.

I hate to have uneven partitions.

How to add the perfect numbers that always approximate multiple of 2?

thanks.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54236
Location: 56N 3W

PostPosted: Sat May 25, 2013 8:26 pm    Post subject: Reply with quote

_______0,

The partition you posted starts at block 2048 and ends at block 296847 (both numbers inclusive) so the partition contains a even number of blocks.
In this case, 204800

You have provided an example of the off by one error. A block is 512B so the size is 102400k.
Its the wonders of mixed binary and decimal arithmetic.

If you use a +, the partition is set that far from the start e.g. +100M
If you omit the + them number is used at the absolute end, in whatever units have set in fdisk. Usually blocks but cylinders still work.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
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