partition alignment

News and Announcements related to GhostBSD
Post Reply
ASX
Posts: 988
Joined: Wed May 06, 2015 12:46 pm

partition alignment

Post by ASX »

Doing some test both about partitioning and about grub boot loader I just noticed that partitions are not aligned to 4K.

i.e.:

Code: Select all

# gpart show 
=>      34  31457197  ada0  GPT  (15G)
        34       128     1  freebsd-boot  (64K)
       162  29409280     2  freebsd-ufs  (14G)
  29409442   2041856     3  freebsd-swap  (997M)
  31451298      5933        - free -  (2.9M)
freebsd-ufs should start at sector 168 to be 4Kb aligned.

I would advice to always implement 4Kb alignment on all disks, to avoid disk I/O performance problems.

Even in case of a 512 byte per sector hard disk you can suffer I/O overhead when using a virtualized environment, because of a possible misalignment between the underlying 4KB host filesystem and a 4KB filesystem as implemented in a guest virtualized disk.
in fact, in case of misalignment, reading one fs block on a guest system imply reading two blocks on the host filesystem.

4KB alignment alone cannot improve I/O performance, but can prevent I/O degradation.

gpart can be instructed to properly align partitions, using "gpart add -a <alignment>"
Post Reply