bsdinstall guided partitioning should 4k-align swap and ufs partitions

Maxim Khitrov max at mxcrypt.com
Mon Dec 5 17:10:47 UTC 2011


On Mon, Dec 5, 2011 at 11:47 AM, Poul-Henning Kamp <phk at phk.freebsd.dk> wrote:
> In message <201112051743.13483.Mark.Martinec+freebsd at ijs.si>, Mark Martinec wri
> tes:
>>Using a guided partitioning install of 9.0-RC2 on a 64GB (virtual) disk
>>(from a 9.0-RC2 ISO image) results in the following GPT partitioning:
>>
>># gpart show /dev/ada0
>>=>       34  134217661  ada0  GPT  (64G)
>>         34        128     1  freebsd-boot  (64k)
>>        162  125828992     2  freebsd-ufs  (60G)
>>  125829154    6709248     3  freebsd-swap  (3.2G)
>>  132538402    1679293        - free -  (820M)
>>
>>This is most unfortunate for installations using 4kB sectored disks
>>or SSD disks, [...]
>
> This is not a new problem, you face the same issue with RAID5 devices.
>
>
> GEOM defines two provider properties for handling all these cases
> correctly: stripesize + stripeoffset.
>
> If the disk-driver has a 4k drive, or suspects it has a 4k drive (
> these properties are advisory only), it should announce that with
> the stripe* properties on its GEOM provider.
>
> GEOM classes are responsible for passing these properties up with
> whatever adjustments are necessary (for instance modifying the
> stripeoffset for partitions).
>
> The partitioning tools, (All of them!) should examine these two
> properties and prod the user towards not doing something silly.

Interesting... But I think 4k alignment by default would be a good
thing even for 512 drives. First, because some 4k drives fake 512 byte
sectors, and I'm not sure that the partitioning tools would be able to
correctly detect this in all cases. Second, someone may want to copy
the partition table and dump/restore data to another drive, which
could be using 4k sectors. Same problem could arise if you're using
some disk imaging software.

Since the industry is heading in that direction, I think the safer
thing to do is to set the minimum alignment to 4k and increase that
when the underlying hardware (e.g. RAID) requests it. Personally, I
partition my servers manually by creating a 512 kB boot partition
aligned to 512 kB, and align all remaining partitions to 1 MB.

- Max


More information about the freebsd-current mailing list