You are not logged in.

#1 2016-05-16 22:05:50

waeh
Member
Registered: 2016-05-16
Posts: 18

How to partition and align nvme drive to 4kib?

Can't find any information on how to align the disk to 4kib on your wiki about partitioning:
https://wiki.archlinux.org/index.php/Partitioning

Under partition alignment and SSD: "NVMe drives should be aligned to 4KiB. "

Sorry for being a noob but even though I work with computers daily i've a hard time understanding all the aspects of blocks and sectors, virtual and physical sector size, alignment. If you have resource on your hands, much obliged.

Offline

#2 2016-05-16 23:08:44

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: How to partition and align nvme drive to 4kib?

Just use gdisk to partition; the alignment is automatic.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2016-05-17 00:34:33

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: How to partition and align nvme drive to 4kib?

To expand on what graysky said, if you use an up to date arch iso all the tools should do the right thing and leave everything aligned.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#4 2016-05-17 10:46:28

waeh
Member
Registered: 2016-05-16
Posts: 18

Re: How to partition and align nvme drive to 4kib?

I think i've mixed up different aspects of partitioning. What i'm after is why and if you want the sector size changed to advanced format? https://wiki.archlinux.org/index.php/Advanced_Format

I've read somewhere (can't find the resource now) that some has improved perfomance with changing the sector size to 4096 bytes. But when I do a fdisk -l on the machine with the nvme disk the physical sector size is 512 bytes, so I guess that the drive can't utilize a 4096 bytes sector size?

And also I guess that it depends on what enviroment you use your disk in. Here's a article with changing data center nvme's to 4096 bytes size for a oracle db http://www.cadalyst.com/%5Blevel-1-with … 3700-23534

So withour a proper resource from samsung discussing the best sector size of choice I wonder what you recommend?

And even without support for 4k adv. format is it even possible to adjust the sector size?

Offline

#5 2016-05-17 10:59:10

frostschutz
Member
Registered: 2013-11-15
Posts: 1,409

Re: How to partition and align nvme drive to 4kib?

Things align to MiB by default which should be fine for any device. Most filesystems (exception like FAT) already use 4k as smallest unit anyhow.

And even without support for 4k adv. format is it even possible to adjust the sector size?

These drives report 512 sector size for compatibility reasons... unless you manage to hack the firmware somehow you can't change it. (Some USB enclosures emulate 4K sector size on their own accord but it causes more problems than it solves)

Last edited by frostschutz (2016-05-17 10:59:53)

Offline

#6 2016-05-17 13:11:23

waeh
Member
Registered: 2016-05-16
Posts: 18

Re: How to partition and align nvme drive to 4kib?

Okey so everything is fine! fantastic, that explains the difficulties with finding information about the topic. Thanks alot!

Offline

#7 2016-05-17 13:23:10

frostschutz
Member
Registered: 2013-11-15
Posts: 1,409

Re: How to partition and align nvme drive to 4kib?

waeh wrote:

Okey so everything is fine!

If in doubt you can check it... for example

for f in /sys/block/*/*/start
do
    start=$(cat $f)
    echo $f : $start : $(($start % 8)) : $(($start % 2048))
done

This prints start sector for each partition as well as it's 4K alignment (% 8) and MiB alignment (% 2048).  Ideally both of these should be 0.

/sys/block/sdd/sdd1/start : 2048 : 0 : 0
/sys/block/sdd/sdd2/start : 488380416 : 0 : 0
/sys/block/sdd/sdd3/start : 976758784 : 0 : 0
/sys/block/sdd/sdd4/start : 1465137152 : 0 : 0
/sys/block/sdd/sdd5/start : 1953515520 : 0 : 0
/sys/block/sdd/sdd6/start : 2441893888 : 0 : 0
/sys/block/sdd/sdd7/start : 2930272256 : 0 : 0
/sys/block/sdd/sdd8/start : 3418650624 : 0 : 0

You can safely ignore alignment issues for a few partitions... in msdos partition table, for the extended partition (only primary and logical partitions matter). In GPT for a bios_grub partition (sometimes it's squeezed in before the 1st MiB).

Offline

Board footer

Powered by FluxBB