[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Partition alignment



Le 04/02/2017 à 14:49, Thomas Hungenberg a écrit :

I have a 4TB HDD with 4k sectors:

Disk /dev/sdb: 976754642 sectors, 3.6 TiB
Logical sector size: 4096 bytes

I would like to set up a single partition using GPT.

gdisk sets up the partition to start at sector 8 by default:

Number  Start (sector)    End (sector)  Size       Code  Name
   1               8       976754636   3.6 TiB     8300  Linux filesystem

I have no experience with 4Kn disks yet but this surprises me because the default alignment is 2048 sectors or 1 MiB (the two numbers match only with 512-bytes sectors, so I don't know which one applies with 4KiB sectors).

According to gdisk's manpage, 8 sectors is the minimum alignment that gdisk will automatically select if it detects a lower alignment value from existing partitions on a disk larger than 300 GB.

How did you proceed exactly ? Did you create a new partition table with gdisk (not only a new partition on an existing partition table) ? If you kept the existing partition table, was it empty or did it contain some partitions that you deleted prior to creating the new partition ?

According to this howto
<http://rainbow.chard.org/2013/01/30/how-to-align-partitions-for-best-performance-using-parted/>

the first partition should start at sector 65535 with my HDD's parameters:

# cat /sys/block/sdb/queue/optimal_io_size
268431360

Is it a real single hard disk drive or some logical aggregated volume created with hardware RAID, SAN, iSCSI or so ?

If it is a real single disk, then the "optimal" I/O size (265 MiB !) looks ridiculously big to me.

So I wonder which start sector I should choose for optimal alignment?

A 4Kn disk does not need any alignment. Only 512e Advanced Format disks (with 4-KiB physical sectors and 512-byte logical sectors) need to be aligned on physical sectors, and SSD need to be aligned on write/erase blocks (1 MiB should be fine). Anyway you can choose the standard 1-MiB alignment. But if it is a logical aggregated volume, this is a different issue. For example with RAID 5 you should align with RAID stripes.


Reply to: