Partition does not end on cylinder boundary

JD jd1008 at gmail.com
Sun Jun 5 17:28:49 UTC 2011


On 06/05/11 09:07, Alan Cox wrote:
>> to the file's or dir's inode as possible. So, even if the a disk cylinder
>> is now a virtual thing, it still helps in organizing the disk
> The notion of a cylinder group comes from BSD, and in 4.2 BSD FFS they
> were indeed physically laid out to match the media. Linux has never done
> that because by the time Linux existed it made no sense.
> The only notion a Linux file system abstraction uses is a block number,
> where 0 is one end of the media and [large number] the other. It doesn't
> care whether that is flash, rotating media, or indeed cards pinned to
> donuts.
>
> There are some file systems which don't deal with abstract blocking in
> quite the same way - those are the raw flash file systems that use MTD
> (eg JFFS2). They have to have a deeper knowledge of the underlying media
> because of the complex rules about age wearing and erase block sizes on
> flash media.
>
> Alan
>
Yes. We know that, But the ext2/3/4
all create data structures on the basis
of cylinder groups. Perhaps they should
call them zones, instead of cylinder groups,
because cylinder is quiet misleading. However,
the idea of organizing the disks (now especially the
multi-terabytes disks) into equally sized
zones to access and manage the blocks therein makes a lot o sense.


Unfortunately, fdisk and gparted will still waste some small amount
of disk space at end of disk because of the notion that a partition must
be a mutiple of what the disk geometry reports as a cylinder.
To wit:
# fdisk -l /dev/sda

Disk /dev/sda: 100.0 GB, 100030242816 bytes
255 heads, 63 sectors/track, 12161 cylinders, total 195371568 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x35073506

    Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63    81915434    40957686    7  HPFS/NTFS
/dev/sda2   *    81915435   186964469    52524517+  83  Linux
/dev/sda3       186964470   195366464     4200997+  82  Linux swap / Solaris

Notice that total sectors are 195371568 yet the last sector of the swap
partition (which I let fdisk to span it to remainder of disk -
i.e. I did not specify the size nore the last sector), truncated
5104 sectors because they are less than what would make up a
geometry's cylinder.

Even though there is no relationship between the disk geometry and
the filesystem,  filesystem
implementations nevertheless borrowed the idea and it has stuck
even though the FS's notion of a "cylinder" or "block group"
may not be same as disk geometry's notion of cylinder. This idea
is still with us in ext2/3/4.

Cheers,

JD


More information about the users mailing list