Hi! Ever since I started using FreeBSD (from version 13.0), I've been trying to understand the installer's logic so I can manually reproduce its actions. For example, I was able to reproduce the partitioning for the case "Auto ZFS" with "UEFI (GPT)". Here are the commands I used to do this and 'gpart show' output compared to the installer (installer - nvd0, manually - nvd1):
CASE 1: -a 1M
As you can see, I used the -a 1M flag for alignment. The result of nvd1 is completely equivalent to nvd0. For automatic installation on nvd0 the setting "Force 4K Sectors? YES" was used while for nvd1 I used -a 1M. But why then are the results the same?
CASE 2: -a 4k
However, if we look at many modern disk partitioning recommendations (Chapter 21: GEOM, for example), we see that -a 4k is usually recommended, which is the more general case (if I understand correctly). If I use -a 4k the result will be different from installer:
In the latter case, we do not observe alignment with "- free - (1.0M)".
Question 1: which partitioning do you consider more correct in the general case: -a 4k (the recommendations in the GEOM chapter) or -a 1M (the way the installer does it)? Or is there no difference at all?
Question 2: I am attaching the graphical installer settings that I tried to replicate. As you can see, the default is "Force 4K Sectors? YES", but why then does the result correspond to -a 1M? And if I set "Force 4K Sectors? NO" the result will be as follows (like when I manually use -a 4k):
It seems to me that this result should correspond "Force 4K Sectors? YES". Explain to me please.
P.S.: by the way, all my drives on all machines are Samsung pm9a3 (m.2) and I have always used -a 4k. So it will be an epic fail if I have to repartition disks on all servers, because there are no - free - (1.0M) anywhere.
CASE 1: -a 1M
Code:
root@test:~ # gpart destroy -F nvd1
nvd1 destroyed
root@test:~ # gpart create -s gpt /dev/nvd1
nvd1 created
root@test:~ # gpart add -i 1 -s 260M -t efi /dev/nvd1
nvd1p1 added
root@test:~ # gpart add -a 1M -i 2 -s 2G -t freebsd-swap /dev/nvd1
nvd1p2 added
root@test:~ # gpart add -a 1M -i 3 -t freebsd-zfs /dev/nvd1
nvd1p3 added
root@test:~ # gpart show
=> 40 41942960 nvd0 GPT (20G)
40 532480 1 efi (260M)
532520 2008 - free - (1.0M)
534528 4194304 2 freebsd-swap (2.0G)
4728832 37212160 3 freebsd-zfs (18G)
41940992 2008 - free - (1.0M)
=> 40 41942960 nvd1 GPT (20G)
40 532480 1 efi (260M)
532520 2008 - free - (1.0M)
534528 4194304 2 freebsd-swap (2.0G)
4728832 37212160 3 freebsd-zfs (18G)
41940992 2008 - free - (1.0M)
As you can see, I used the -a 1M flag for alignment. The result of nvd1 is completely equivalent to nvd0. For automatic installation on nvd0 the setting "Force 4K Sectors? YES" was used while for nvd1 I used -a 1M. But why then are the results the same?
CASE 2: -a 4k
However, if we look at many modern disk partitioning recommendations (Chapter 21: GEOM, for example), we see that -a 4k is usually recommended, which is the more general case (if I understand correctly). If I use -a 4k the result will be different from installer:
Code:
root@test:~ # gpart create -s gpt /dev/nvd1
nvd1 created
root@test:~ # gpart add -i 1 -s 260M -t efi /dev/nvd1
nvd1p1 added
root@test:~ # gpart add -a 4k -i 2 -s 2G -t freebsd-swap /dev/nvd1
nvd1p2 added
root@test:~ # gpart add -a 4k -i 3 -t freebsd-zfs /dev/nvd1
nvd1p3 added
root@test:~ # gpart show
=> 40 41942960 nvd0 GPT (20G)
40 532480 1 efi (260M)
532520 2008 - free - (1.0M)
534528 4194304 2 freebsd-swap (2.0G)
4728832 37212160 3 freebsd-zfs (18G)
41940992 2008 - free - (1.0M)
=> 40 41942960 nvd1 GPT (20G)
40 532480 1 efi (260M)
532520 4194304 2 freebsd-swap (2.0G)
4726824 37216176 3 freebsd-zfs (18G)
In the latter case, we do not observe alignment with "- free - (1.0M)".
Question 1: which partitioning do you consider more correct in the general case: -a 4k (the recommendations in the GEOM chapter) or -a 1M (the way the installer does it)? Or is there no difference at all?
Question 2: I am attaching the graphical installer settings that I tried to replicate. As you can see, the default is "Force 4K Sectors? YES", but why then does the result correspond to -a 1M? And if I set "Force 4K Sectors? NO" the result will be as follows (like when I manually use -a 4k):
Code:
root@test:~ # gpart show
=> 40 41942960 nvd0 GPT (20G)
40 532480 1 efi (260M)
532520 4194304 2 freebsd-swap (2.0G)
4726824 37216176 3 freebsd-zfs (18G)
=> 40 41942960 nvd1 GPT (20G)
40 532480 1 efi (260M)
532520 4194304 2 freebsd-swap (2.0G)
4726824 37216176 3 freebsd-zfs (18G)
It seems to me that this result should correspond "Force 4K Sectors? YES". Explain to me please.
P.S.: by the way, all my drives on all machines are Samsung pm9a3 (m.2) and I have always used -a 4k. So it will be an epic fail if I have to repartition disks on all servers, because there are no - free - (1.0M) anywhere.