Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

2048 sectors between logical partitions

232 views
Skip to first unread message

bad sector

unread,
Nov 25, 2011, 12:22:32 PM11/25/11
to

Can anyone tell me why fdisk leaves 2048 sector gaps between logical
partitions? Is it because some space needs to be reserved for the
partition table and in order to maintain alignability that space then
has to be 2048 or multiples thereof?


/dev/sda8 430951532 472894571 20971520 83 Linux
/dev/sda9 472896620 514839659 20971520 83 Linux



Richard Kettlewell

unread,
Nov 25, 2011, 12:44:28 PM11/25/11
to
Current fdisk aligns all partitions to 1Mbyte boundaries (which happens
to be 2048 sectors on a device which presents 512-byte sectors).

The reason to set any alignment at all is efficiency; if (for instance)
a filesystem uses 4096-byte blocks and so does the underlying storage
device, you want the blocks from the two layers to match up properly,
otherwise every read costs twice as much (and writes are even worse).

The choice of 1MB in particular follows Windows Vista.

--
http://www.greenend.org.uk/rjk/

bad sector

unread,
Nov 25, 2011, 1:43:02 PM11/25/11
to
from the same disk:

/dev/sda1 2048 41945087 20971520 83 Linux
/dev/sda2 * 41945088 108464693 33259803 7 HPFS/NTFS/exFAT
/dev/sda3 108464694 174984299 33259803 83 Linux
/dev/sda4 174984300 976773167 400894434 5 Extended

Primary partitions begin on the very next sector, they don't need to be
aligned?

How did the old fdisk handle things? I'm asking because unused sectors
are always an ideal hiding place where the probability of getting wiped
is less.








Eef Hartman

unread,
Nov 26, 2011, 6:30:11 AM11/26/11
to
bad sector <none@_invalid_.net> wrote:
> How did the old fdisk handle things?

Old fdisk aligned things on (mostly 63 block) tracks:
the first primary partition starts at offset 63 (if your disk presents
itself as having 63-sector tracks), the partitions in an "extended"
partition (that is: 5 and all higher ones) are offset by the same
63 sectors from each other as EACH has an "extended partition table"
in front of it (which needs only 64 bytes, so there was 62 plus more
then 1/2 sectors of "free space" between all of them).
--
******************************************************************
** Eef Hartman, Delft University of Technology, dept. SSC/ICT **
** e-mail: E.J.M....@tudelft.nl - phone: +31-15-27 82525 **
******************************************************************

bad sector

unread,
Dec 1, 2011, 1:04:26 AM12/1/11
to
On 11/26/2011 06:30 AM, Eef Hartman wrote:
> bad sector<none@_invalid_.net> wrote:
>> How did the old fdisk handle things?
>
> Old fdisk aligned things on (mostly 63 block) tracks:
> the first primary partition starts at offset 63 (if your disk presents
> itself as having 63-sector tracks), the partitions in an "extended"
> partition (that is: 5 and all higher ones) are offset by the same
> 63 sectors from each other as EACH has an "extended partition table"
> in front of it (which needs only 64 bytes, so there was 62 plus more
> then 1/2 sectors of "free space" between all of them).

Thanks for the info. Just out of curiosity and talking about a disk
partitioned with the new fdisk, how should one use 'dd if=/dev/zero' to
wipe all sectors that are neither part of a partition nor used for a
logical partition table (including any boot code which is easily
recreated after a wipe)? This would involve some offset math I've never
tried ;-)


0 new messages