From 16d2fe20df2e286f9ed200d3a48874469e6f4fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Fri, 20 May 2022 11:41:44 -0400 Subject: [PATCH] reorder and regroup zpool create commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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é Signed-off-by: Richard Laager --- .../Debian/Debian Bullseye Root on ZFS.rst | 82 +++++++++++-------- 1 file changed, 47 insertions(+), 35 deletions(-) diff --git a/docs/Getting Started/Debian/Debian Bullseye Root on ZFS.rst b/docs/Getting Started/Debian/Debian Bullseye Root on ZFS.rst index 3aca727..0557136 100644 --- a/docs/Getting Started/Debian/Debian Bullseye Root on ZFS.rst +++ b/docs/Getting Started/Debian/Debian Bullseye Root on ZFS.rst @@ -227,7 +227,8 @@ Step 2: Disk Formatting zpool create \ -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@bookmarks=enabled \ -o feature@embedded_data=enabled \ @@ -241,9 +242,12 @@ Step 2: Disk Formatting -o feature@lz4_compress=enabled \ -o feature@spacemap_histogram=enabled \ -o feature@zpool_checkpoint=enabled \ - -O acltype=posixacl -O canmount=off -O compression=lz4 \ - -O devices=off -O normalization=formD -O relatime=on -O xattr=sa \ - -O mountpoint=/boot -R /mnt \ + -O acltype=posixacl -O xattr=sa \ + -O compression=lz4 \ + -O devices=off \ + -O normalization=formD \ + -O relatime=on \ + -O canmount=off -O mountpoint=/boot -R /mnt \ bpool ${DISK}-part3 You should not need to customize any of the options for the boot pool. @@ -302,21 +306,26 @@ Step 2: Disk Formatting - Unencrypted:: zpool create \ - -o ashift=12 -o autotrim=on \ - -O acltype=posixacl -O canmount=off -O compression=lz4 \ - -O dnodesize=auto -O normalization=formD -O relatime=on \ - -O xattr=sa -O mountpoint=/ -R /mnt \ + -o ashift=12 \ + -o autotrim=on \ + -O acltype=posixacl -O xattr=sa -O dnodesize=auto \ + -O compression=lz4 \ + -O normalization=formD \ + -O relatime=on \ + -O canmount=off -O mountpoint=/ -R /mnt \ rpool ${DISK}-part4 - ZFS native encryption:: zpool create \ - -o ashift=12 -o autotrim=on \ - -O encryption=on \ - -O keylocation=prompt -O keyformat=passphrase \ - -O acltype=posixacl -O canmount=off -O compression=lz4 \ - -O dnodesize=auto -O normalization=formD -O relatime=on \ - -O xattr=sa -O mountpoint=/ -R /mnt \ + -o ashift=12 \ + -o autotrim=on \ + -O encryption=on -O keylocation=prompt -O keyformat=passphrase \ + -O acltype=posixacl -O xattr=sa -O dnodesize=auto \ + -O compression=lz4 \ + -O normalization=formD \ + -O relatime=on \ + -O canmount=off -O mountpoint=/ -R /mnt \ rpool ${DISK}-part4 - LUKS:: @@ -325,11 +334,14 @@ Step 2: Disk Formatting cryptsetup luksFormat -c aes-xts-plain64 -s 512 -h sha256 ${DISK}-part4 cryptsetup luksOpen ${DISK}-part4 luks1 - zpool create -o autotrim=on \ + zpool create \ -o ashift=12 \ - -O acltype=posixacl -O canmount=off -O compression=lz4 \ - -O dnodesize=auto -O normalization=formD -O relatime=on \ - -O xattr=sa -O mountpoint=/ -R /mnt \ + -o autotrim=on \ + -O acltype=posixacl -O xattr=sa -O dnodesize=auto \ + -O compression=lz4 \ + -O normalization=formD \ + -O relatime=on \ + -O canmount=off -O mountpoint=/ -R /mnt \ rpool /dev/mapper/luks1 **Notes:** @@ -344,6 +356,23 @@ Step 2: Disk Formatting ``-o acltype=posixacl`` (note: lowercase “o”) to the ``zfs create`` for ``/var/log``, as `journald requires ACLs `__ + - Setting ``xattr=sa`` `vastly improves the performance of extended + attributes + `__. + 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. + `__ + `They can be used by Samba to store Windows ACLs and DOS attributes; + they are required for a Samba Active Directory domain controller. + `__ + Note that ``xattr=sa`` is `Linux-specific + `__. 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 to UTF-8 filename normalization. It also implies ``utf8only=on``, 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 `RedHat’s documentation `__ for further information. - - Setting ``xattr=sa`` `vastly improves the performance of extended - attributes - `__. - 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. - `__ - `They can be used by Samba to store Windows ACLs and DOS attributes; - they are required for a Samba Active Directory domain controller. - `__ - Note that ``xattr=sa`` is `Linux-specific - `__. 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 forget that, you are specifying the whole disk, which ZFS will then re-partition, and you will lose the bootloader partition(s).