Project

General

Profile

Bug #2830

gpt(8) doesn't align partitions to 1MB blocks

Added by ftigeot over 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
06/30/2015
Due date:
% Done:

100%

Estimated time:

Description

The GPT partition scheme management utility, gpt(8) doesn't manage partition alignment at all.

# gpt create /dev/da1
# gpt boot /dev/da1
# gpt show /dev/da1
start size index contents
0 1 - PMBR
1 1 - Pri GPT header
2 32 - Pri GPT table
34 2097152 0 GPT part - DragonFly Label32

We can see the just created boot partition starts on the legacy sector 34 offset, 17KB from the start of the device.

This isn't divisible by the physical sector size of modern disk devices (4KB).
It isn't optimal with SSD either: they typically use 8KB or bigger erase blocks.

gpt(8) should behave in the same as disklabel64 and align partitions to 1MB boundaries.


Files


Related issues

Related to Bug #2674: GPT SupportNew05/28/2014

Actions

History

#1

Updated by ftigeot over 4 years ago

#2

Updated by sepherosa over 4 years ago

I'd say align on 8MB at least; modern flash chips have >=4MB erase
span. Even 8MB probably will not be good after several years for SSD.

On Wed, Jul 1, 2015 at 4:41 AM, <> wrote:
> Issue #2830 has been updated by ftigeot.
>
> Related to Bug #2674: GPT Support added
>
> ----------------------------------------
> Bug #2830: gpt(8) doesn't align partitions to 1MB blocks
> http://bugs.dragonflybsd.org/issues/2830#change-12687
>
> * Author: ftigeot
> * Status: New
> * Priority: Normal
> * Assignee:
> * Category:
> * Target version:
> ----------------------------------------
> The GPT partition scheme management utility, gpt(8) doesn't manage partition alignment at all.
>
> # gpt create /dev/da1
> # gpt boot /dev/da1
> # gpt show /dev/da1
> start size index contents
> 0 1 - PMBR
> 1 1 - Pri GPT header
> 2 32 - Pri GPT table
> 34 2097152 0 GPT part - DragonFly Label32
>
> We can see the just created boot partition starts on the legacy sector 34 offset, 17KB from the start of the device.
>
> This isn't divisible by the physical sector size of modern disk devices (4KB).
> It isn't optimal with SSD either: they typically use 8KB or bigger erase blocks.
>
> gpt(8) should behave in the same as disklabel64 and align partitions to 1MB boundaries.
>
>
>
> --
> You have received this notification because you have either subscribed to it, or are involved in it.
> To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account

--
Tomorrow Will Never Die

#3

Updated by pascii about 4 years ago

Hi!. Here's a fix. It will align new slices to 2k sectors. If you don't specify a starting sector in gpt add, it will align the slice. If you do specify it, nothing different will happen. It also works for gpt boot, which does not demand a specific starting sector.

#4

Updated by ftigeot about 4 years ago

Thanks for the patch, it appears to work perfectly so far.

Do you have a name you'd like to use for the commit besides "Charlie Root" ?

#5

Updated by ftigeot almost 4 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Commit pushed, thanks!

Also available in: Atom PDF