I have a very popular Samsung 980 Pro NVME SSD drive. This drive is the only system drive so far. Booting is done in UEFI mode. The file system is ZFS.
Before partitioning the disk, I had the following preconditions:
1.) The size of the EFI partition should be 260M because the installer does this in Auto ZFS mode:
2.) The sector size should be 512 because that's what the smartctl command shows:
Therefore, when creating partitions, gpart must be without any -a options. And also the ZFS pool must be created with default vfs.zfs.min_auto_ashift=9 since there was no reason for the value 12.
So partitioning the disk into partitions was done as follows:
As a result, I got the following partitioning of the disk:
I like this output as it is simple and justified above. But...
3.) There is a recommendation in the "Absolute FreeBSD" book to use gpart -a 1m "to change that partition to support UEFI if necessary" and "always align partitions on even megabyte boundaries". Do I understand correctly that this applies if I don't have an EFI partition yet, but want to leave the option to add it later? From what I understand, the parted -a optimal command that I remember from the Gentoo Handbook also used the default size of 1M.
4.) The installer in "Auto ZFS" mode sets the sector size to 4K by default. Which suggests that if such an alignment is not optimal, it will be good, suitable in most cases. Finally, in almost every how-to I've come across a recommendation to use gpart add -a 4K, as well as vfs.zfs.min_auto_ashift=12 when creating a zpool as if everyone has a 4K sector size disk.
Do I understand correctly that:
а) Now my filesystem is misaligned with the disk, because 532520 / 512 = 1040.078125? The second (ZFS) partition should start with 534528 (as the installer did) and it could this be achieved with -a 1m?
b) Does it make sense to redo partitioning from scratch with the gpart add -a 1m (or -a 4K) option for each partition?
c) What do you think are the correct values for gpart add -a ... and vfs.zfs.min_auto_ashift=... ?
Before partitioning the disk, I had the following preconditions:
1.) The size of the EFI partition should be 260M because the installer does this in Auto ZFS mode:
Code:
# gpart show
=> 40 1953525088 nvd2 GPT (932G)
40 532480 1 efi (260M)
532520 1024 2 freebsd-boot (512K)
533544 984 - free - (492K)
534528 4194304 3 freebsd-swap (2.0G)
4728832 1948794880 4 freebsd-zfs (929G)
1953523712 1416 - free - (708K)
=> 40 1953525088 diskid/DISK-S5GXNX0T975357Z GPT (932G)
40 532480 1 efi (260M)
532520 1024 2 freebsd-boot (512K)
533544 984 - free - (492K)
534528 4194304 3 freebsd-swap (2.0G)
4728832 1948794880 4 freebsd-zfs (929G)
1953523712 1416 - free - (708K)
2.) The sector size should be 512 because that's what the smartctl command shows:
Code:
smartctl -a /dev/nvme2
[...]
Namespace 1 Formatted LBA Size: 512
[...]
Supported LBA Sizes (NSID 0x1)
Id Fmt Data Metadt Rel_Perf
0 + 512 0 0
[...]
Therefore, when creating partitions, gpart must be without any -a options. And also the ZFS pool must be created with default vfs.zfs.min_auto_ashift=9 since there was no reason for the value 12.
So partitioning the disk into partitions was done as follows:
Code:
# create gpt partitions
gpart create -s gpt /dev/diskid/DISK-S5GXNX0T1111111
gpart add -i 1 -l S5GXNX0T1111111-efi -s 260M -t efi /dev/diskid/DISK-S5GXNX0T1111111
gpart add -i 2 -l S5GXNX0T1111111-sys -t freebsd-zfs /dev/diskid/DISK-S5GXNX0T1111111
# configure efi
newfs_msdos /dev/diskid/DISK-S5GXNX0T1111111p1
mount -t msdosfs /dev/diskid/DISK-DISK-S5GXNX0T1111111p1 /mnt
mkdir -pv /mnt/efi/boot
cp /boot/loader.efi /mnt/efi/boot/bootx64.efi
umount /mnt
# configure zfs
zpool create -m none scc /dev/diskid/DISK-DISK-S5GXNX0T1111111p2
[...]
As a result, I got the following partitioning of the disk:
Code:
# gpart show
=> 40 1953525088 diskid/DISK-S5GXNX0T975357Z GPT (932G)
40 532480 1 efi (260M)
532520 1952992608 2 freebsd-zfs (931G)
I like this output as it is simple and justified above. But...
3.) There is a recommendation in the "Absolute FreeBSD" book to use gpart -a 1m "to change that partition to support UEFI if necessary" and "always align partitions on even megabyte boundaries". Do I understand correctly that this applies if I don't have an EFI partition yet, but want to leave the option to add it later? From what I understand, the parted -a optimal command that I remember from the Gentoo Handbook also used the default size of 1M.
4.) The installer in "Auto ZFS" mode sets the sector size to 4K by default. Which suggests that if such an alignment is not optimal, it will be good, suitable in most cases. Finally, in almost every how-to I've come across a recommendation to use gpart add -a 4K, as well as vfs.zfs.min_auto_ashift=12 when creating a zpool as if everyone has a 4K sector size disk.
Do I understand correctly that:
а) Now my filesystem is misaligned with the disk, because 532520 / 512 = 1040.078125? The second (ZFS) partition should start with 534528 (as the installer did) and it could this be achieved with -a 1m?
b) Does it make sense to redo partitioning from scratch with the gpart add -a 1m (or -a 4K) option for each partition?
c) What do you think are the correct values for gpart add -a ... and vfs.zfs.min_auto_ashift=... ?