reorder and regroup zpool create commands

This regroups the options passed to zpool create in a more logical
way.

 1. the ACL/xattr/dnodesize settings are all on one line, since they
    are all related (latter being optimizations because we enable the
    former)

 2. ashift, autotrim, compression, normalization, relatime are all
    independent options that merit their own line for better
    visibility, they are also optional and therefore it makes sense to
    have them separate

 3. canmount, mountpoint and -R are all related as well

This is only a "whitespace" fix: there should be no functional change
to this patch.

I also noted that dnodesize=auto is *not* passed to the bpool cache
creation, even though it's passed to the rpool creation. I suspect
that might be an omission. This also goes to show that ordering those
options consistently makes it easier to spot those errors.

This is a followup to #307.

Signed-off-by: Antoine Beaupré <anarcat@debian.org>
Signed-off-by: Richard Laager <rlaager@wiktel.com>
This commit is contained in:
Antoine Beaupré
2022-05-20 11:41:44 -04:00
committed by Richard Laager
parent 9e7a1e8c54
commit 16d2fe20df

View File

@@ -227,7 +227,8 @@ Step 2: Disk Formatting
zpool create \ zpool create \
-o cachefile=/etc/zfs/zpool.cache \ -o cachefile=/etc/zfs/zpool.cache \
-o ashift=12 -o autotrim=on -d \ -o ashift=12 \
-o autotrim=on -d \
-o feature@async_destroy=enabled \ -o feature@async_destroy=enabled \
-o feature@bookmarks=enabled \ -o feature@bookmarks=enabled \
-o feature@embedded_data=enabled \ -o feature@embedded_data=enabled \
@@ -241,9 +242,12 @@ Step 2: Disk Formatting
-o feature@lz4_compress=enabled \ -o feature@lz4_compress=enabled \
-o feature@spacemap_histogram=enabled \ -o feature@spacemap_histogram=enabled \
-o feature@zpool_checkpoint=enabled \ -o feature@zpool_checkpoint=enabled \
-O acltype=posixacl -O canmount=off -O compression=lz4 \ -O acltype=posixacl -O xattr=sa \
-O devices=off -O normalization=formD -O relatime=on -O xattr=sa \ -O compression=lz4 \
-O mountpoint=/boot -R /mnt \ -O devices=off \
-O normalization=formD \
-O relatime=on \
-O canmount=off -O mountpoint=/boot -R /mnt \
bpool ${DISK}-part3 bpool ${DISK}-part3
You should not need to customize any of the options for the boot pool. You should not need to customize any of the options for the boot pool.
@@ -302,21 +306,26 @@ Step 2: Disk Formatting
- Unencrypted:: - Unencrypted::
zpool create \ zpool create \
-o ashift=12 -o autotrim=on \ -o ashift=12 \
-O acltype=posixacl -O canmount=off -O compression=lz4 \ -o autotrim=on \
-O dnodesize=auto -O normalization=formD -O relatime=on \ -O acltype=posixacl -O xattr=sa -O dnodesize=auto \
-O xattr=sa -O mountpoint=/ -R /mnt \ -O compression=lz4 \
-O normalization=formD \
-O relatime=on \
-O canmount=off -O mountpoint=/ -R /mnt \
rpool ${DISK}-part4 rpool ${DISK}-part4
- ZFS native encryption:: - ZFS native encryption::
zpool create \ zpool create \
-o ashift=12 -o autotrim=on \ -o ashift=12 \
-O encryption=on \ -o autotrim=on \
-O keylocation=prompt -O keyformat=passphrase \ -O encryption=on -O keylocation=prompt -O keyformat=passphrase \
-O acltype=posixacl -O canmount=off -O compression=lz4 \ -O acltype=posixacl -O xattr=sa -O dnodesize=auto \
-O dnodesize=auto -O normalization=formD -O relatime=on \ -O compression=lz4 \
-O xattr=sa -O mountpoint=/ -R /mnt \ -O normalization=formD \
-O relatime=on \
-O canmount=off -O mountpoint=/ -R /mnt \
rpool ${DISK}-part4 rpool ${DISK}-part4
- LUKS:: - LUKS::
@@ -325,11 +334,14 @@ Step 2: Disk Formatting
cryptsetup luksFormat -c aes-xts-plain64 -s 512 -h sha256 ${DISK}-part4 cryptsetup luksFormat -c aes-xts-plain64 -s 512 -h sha256 ${DISK}-part4
cryptsetup luksOpen ${DISK}-part4 luks1 cryptsetup luksOpen ${DISK}-part4 luks1
zpool create -o autotrim=on \ zpool create \
-o ashift=12 \ -o ashift=12 \
-O acltype=posixacl -O canmount=off -O compression=lz4 \ -o autotrim=on \
-O dnodesize=auto -O normalization=formD -O relatime=on \ -O acltype=posixacl -O xattr=sa -O dnodesize=auto \
-O xattr=sa -O mountpoint=/ -R /mnt \ -O compression=lz4 \
-O normalization=formD \
-O relatime=on \
-O canmount=off -O mountpoint=/ -R /mnt \
rpool /dev/mapper/luks1 rpool /dev/mapper/luks1
**Notes:** **Notes:**
@@ -344,6 +356,23 @@ Step 2: Disk Formatting
``-o acltype=posixacl`` (note: lowercase “o”) to the ``zfs create`` ``-o acltype=posixacl`` (note: lowercase “o”) to the ``zfs create``
for ``/var/log``, as `journald requires ACLs for ``/var/log``, as `journald requires ACLs
<https://askubuntu.com/questions/970886/journalctl-says-failed-to-search-journal-acl-operation-not-supported>`__ <https://askubuntu.com/questions/970886/journalctl-says-failed-to-search-journal-acl-operation-not-supported>`__
- Setting ``xattr=sa`` `vastly improves the performance of extended
attributes
<https://github.com/zfsonlinux/zfs/commit/82a37189aac955c81a59a5ecc3400475adb56355>`__.
Inside ZFS, extended attributes are used to implement POSIX ACLs.
Extended attributes can also be used by user-space applications.
`They are used by some desktop GUI applications.
<https://en.wikipedia.org/wiki/Extended_file_attributes#Linux>`__
`They can be used by Samba to store Windows ACLs and DOS attributes;
they are required for a Samba Active Directory domain controller.
<https://wiki.samba.org/index.php/Setting_up_a_Share_Using_Windows_ACLs>`__
Note that ``xattr=sa`` is `Linux-specific
<https://openzfs.org/wiki/Platform_code_differences>`__. If you move your
``xattr=sa`` pool to another OpenZFS implementation besides ZFS-on-Linux,
extended attributes will not be readable (though your data will be). If
portability of extended attributes is important to you, omit the
``-O xattr=sa`` above. Even if you do not want ``xattr=sa`` for the whole
pool, it is probably fine to use it for ``/var/log``.
- Setting ``normalization=formD`` eliminates some corner cases relating - Setting ``normalization=formD`` eliminates some corner cases relating
to UTF-8 filename normalization. It also implies ``utf8only=on``, to UTF-8 filename normalization. It also implies ``utf8only=on``,
which means that only UTF-8 filenames are allowed. If you care to which means that only UTF-8 filenames are allowed. If you care to
@@ -365,23 +394,6 @@ Step 2: Disk Formatting
the default for other filesystems. See `RedHats documentation the default for other filesystems. See `RedHats documentation
<https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/power_management_guide/relatime>`__ <https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/power_management_guide/relatime>`__
for further information. for further information.
- Setting ``xattr=sa`` `vastly improves the performance of extended
attributes
<https://github.com/zfsonlinux/zfs/commit/82a37189aac955c81a59a5ecc3400475adb56355>`__.
Inside ZFS, extended attributes are used to implement POSIX ACLs.
Extended attributes can also be used by user-space applications.
`They are used by some desktop GUI applications.
<https://en.wikipedia.org/wiki/Extended_file_attributes#Linux>`__
`They can be used by Samba to store Windows ACLs and DOS attributes;
they are required for a Samba Active Directory domain controller.
<https://wiki.samba.org/index.php/Setting_up_a_Share_Using_Windows_ACLs>`__
Note that ``xattr=sa`` is `Linux-specific
<https://openzfs.org/wiki/Platform_code_differences>`__. If you move your
``xattr=sa`` pool to another OpenZFS implementation besides ZFS-on-Linux,
extended attributes will not be readable (though your data will be). If
portability of extended attributes is important to you, omit the
``-O xattr=sa`` above. Even if you do not want ``xattr=sa`` for the whole
pool, it is probably fine to use it for ``/var/log``.
- Make sure to include the ``-part4`` portion of the drive path. If you - Make sure to include the ``-part4`` portion of the drive path. If you
forget that, you are specifying the whole disk, which ZFS will then forget that, you are specifying the whole disk, which ZFS will then
re-partition, and you will lose the bootloader partition(s). re-partition, and you will lose the bootloader partition(s).