Ubuntu/Debian: Use relatime by default
This is the default for other filesystems.
parent
051b63c5a1
commit
3d9fa7f2af
|
@ -77,15 +77,15 @@ Always use the long `/dev/disk/by-id/*` aliases with ZFS. Using the `/dev/sd*`
|
|||
**Caution**: **[GRUB doesn't support all pool features](http://savannah.gnu.org/bugs/?func=detailitem&item_id=48885) from ZFS on Linux 0.7 or higher.** If you install ZFS from backports or use Proxmox, add `-o feature@large_dnode=disabled` to the next command. Otherwise, GRUB will not find the ZFS pool.
|
||||
|
||||
# zpool create -o ashift=12 \
|
||||
-O acltype=posixacl -O atime=off -O canmount=off -O compression=lz4 \
|
||||
-O normalization=formD -O xattr=sa \
|
||||
-O acltype=posixacl -O canmount=off -O compression=lz4 \
|
||||
-O normalization=formD -O relatime=on -O xattr=sa \
|
||||
-O mountpoint=/ -R /mnt \
|
||||
rpool /dev/disk/by-id/scsi-SATA_disk1-part1
|
||||
|
||||
* The use of `ashift=12` is recommended here because many drives today have 4KiB (or larger) physical sectors, even though they present 512B logical sectors. Also, a future replacement drive may have 4KiB physical sectors (in which case `ashift=12` is desirable) or 4KiB logical sectors (in which case `ashift=12` is required).
|
||||
* Setting `-O acltype=posixacl` enables POSIX ACLs globally. If you do not want this, remove that option, but later add `-o acltype=posixacl` (note: lowercase "o") to the `zfs create` for `/var/log`, as [journald requires ACLs](https://askubuntu.com/questions/970886/journalctl-says-failed-to-search-journal-acl-operation-not-supported)
|
||||
* Setting `atime=off` completely disables atime updates. If you or one of your applications (e.g. a mail reader following an mbox file for local delivery) cares about atime updates, you almost certainly want `relatime` rather than full `atime`. In that case, replace `atime=off` with `relatime=on`. In steps below, when `noatime` is used in `/etc/fstab`, use `relatime` instead. If you only care about atime updates for particular filesystems, you can limit your `relatime` to only those filesystems; since properties are inherited, set `atime=on` to override the inherited `atime=off` wherever you set `relatime=on`. See [RedHat's documentation](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/power_management_guide/relatime) for further information.
|
||||
* 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 support non-UTF-8 filenames, do not use this option. For a discussion of why requiring UTF-8 filenames may be a bad idea, see [The problems with enforced UTF-8 only filenames](http://utcc.utoronto.ca/~cks/space/blog/linux/ForcedUTF8Filenames).
|
||||
* Setting `relatime=on` is a middle ground between classic POSIX `atime` behavior (with its significant performance impact) and `atime=off` (which provides the best performance by completely disabling atime updates). Since Linux 2.6.30, `relatime` has been the default for other filesystems. See [RedHat's documentation](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/power_management_guide/relatime) 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.](http://open-zfs.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 `-part1` 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).
|
||||
|
||||
|
@ -237,7 +237,7 @@ Install GRUB to the disk(s), not the partition(s).
|
|||
# mkdir /boot/efi
|
||||
# echo PARTUUID=$(blkid -s PARTUUID -o value \
|
||||
/dev/disk/by-id/scsi-SATA_disk1-part3) \
|
||||
/boot/efi vfat noatime,nofail,x-systemd.device-timeout=1 0 1 >> /etc/fstab
|
||||
/boot/efi vfat nofail,x-systemd.device-timeout=1 0 1 >> /etc/fstab
|
||||
# mount /boot/efi
|
||||
# apt install --yes grub-efi-amd64
|
||||
|
||||
|
@ -252,14 +252,14 @@ Install GRUB to the disk(s), not the partition(s).
|
|||
# zfs set mountpoint=legacy rpool/var/log
|
||||
# zfs set mountpoint=legacy rpool/var/tmp
|
||||
# cat >> /etc/fstab << EOF
|
||||
rpool/var/log /var/log zfs noatime,nodev 0 0
|
||||
rpool/var/tmp /var/tmp zfs noatime,nodev 0 0
|
||||
rpool/var/log /var/log zfs nodev,relatime 0 0
|
||||
rpool/var/tmp /var/tmp zfs nodev,relatime 0 0
|
||||
EOF
|
||||
|
||||
If you created a /tmp dataset, do the same for it:
|
||||
# zfs set mountpoint=legacy rpool/tmp
|
||||
# cat >> /etc/fstab << EOF
|
||||
rpool/tmp /tmp zfs noatime,nodev 0 0
|
||||
rpool/tmp /tmp zfs nodev,relatime 0 0
|
||||
EOF
|
||||
|
||||
4.9 Optional: Mount a tmpfs to /tmp
|
||||
|
|
|
@ -91,8 +91,8 @@ Choose one of the following options:
|
|||
2.3a Unencrypted:
|
||||
|
||||
# zpool create -o ashift=12 \
|
||||
-O acltype=posixacl -O atime=off -O canmount=off -O compression=lz4 \
|
||||
-O normalization=formD -O xattr=sa \
|
||||
-O acltype=posixacl -O canmount=off -O compression=lz4 \
|
||||
-O normalization=formD -O relatime=on -O xattr=sa \
|
||||
-O mountpoint=/ -R /mnt \
|
||||
rpool /dev/disk/by-id/scsi-SATA_disk1-part1
|
||||
|
||||
|
@ -102,15 +102,15 @@ Choose one of the following options:
|
|||
/dev/disk/by-id/scsi-SATA_disk1-part1
|
||||
# cryptsetup luksOpen /dev/disk/by-id/scsi-SATA_disk1-part1 luks1
|
||||
# zpool create -o ashift=12 \
|
||||
-O acltype=posixacl -O atime=off -O canmount=off -O compression=lz4 \
|
||||
-O normalization=formD -O xattr=sa \
|
||||
-O acltype=posixacl -O canmount=off -O compression=lz4 \
|
||||
-O normalization=formD -O relatime=on -O xattr=sa \
|
||||
-O mountpoint=/ -R /mnt \
|
||||
rpool /dev/mapper/luks1
|
||||
|
||||
* The use of `ashift=12` is recommended here because many drives today have 4KiB (or larger) physical sectors, even though they present 512B logical sectors. Also, a future replacement drive may have 4KiB physical sectors (in which case `ashift=12` is desirable) or 4KiB logical sectors (in which case `ashift=12` is required).
|
||||
* Setting `-O acltype=posixacl` enables POSIX ACLs globally. If you do not want this, remove that option, but later add `-o acltype=posixacl` (note: lowercase "o") to the `zfs create` for `/var/log`, as [journald requires ACLs](https://askubuntu.com/questions/970886/journalctl-says-failed-to-search-journal-acl-operation-not-supported)
|
||||
* Setting `atime=off` completely disables atime updates. If you or one of your applications (e.g. a mail reader following an mbox file for local delivery) cares about atime updates, you almost certainly want `relatime` rather than full `atime`. In that case, replace `atime=off` with `relatime=on`. In steps below, when `noatime` is used in `/etc/fstab`, use `relatime` instead. If you only care about atime updates for particular filesystems, you can limit your `relatime` to only those filesystems; since properties are inherited, set `atime=on` to override the inherited `atime=off` wherever you set `relatime=on`. See [RedHat's documentation](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/power_management_guide/relatime) for further information.
|
||||
* 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 support non-UTF-8 filenames, do not use this option. For a discussion of why requiring UTF-8 filenames may be a bad idea, see [The problems with enforced UTF-8 only filenames](http://utcc.utoronto.ca/~cks/space/blog/linux/ForcedUTF8Filenames).
|
||||
* Setting `relatime=on` is a middle ground between classic POSIX `atime` behavior (with its significant performance impact) and `atime=off` (which provides the best performance by completely disabling atime updates). Since Linux 2.6.30, `relatime` has been the default for other filesystems. See [RedHat's documentation](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/power_management_guide/relatime) 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.](http://open-zfs.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 `-part1` 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).
|
||||
* For LUKS, the key size chosen is 256 bits. However, XTS mode requires two keys, so the LUKS key is split in half. Thus, `-s 256` means AES-128, which is the LUKS and Ubuntu default.
|
||||
|
@ -263,7 +263,7 @@ Even if you prefer a non-English system language, always ensure that `en_US.UTF-
|
|||
|
||||
# echo UUID=$(blkid -s UUID -o value \
|
||||
/dev/disk/by-id/scsi-SATA_disk1-part4) \
|
||||
/boot ext2 noatime 0 2 >> /etc/fstab
|
||||
/boot ext2 relatime 0 2 >> /etc/fstab
|
||||
|
||||
# apt install --yes cryptsetup
|
||||
|
||||
|
@ -290,7 +290,7 @@ Install GRUB to the disk(s), not the partition(s).
|
|||
# mkdir /boot/efi
|
||||
# echo PARTUUID=$(blkid -s PARTUUID -o value \
|
||||
/dev/disk/by-id/scsi-SATA_disk1-part3) \
|
||||
/boot/efi vfat noatime,nofail,x-systemd.device-timeout=1 0 1 >> /etc/fstab
|
||||
/boot/efi vfat nofail,x-systemd.device-timeout=1 0 1 >> /etc/fstab
|
||||
# mount /boot/efi
|
||||
# apt install --yes grub-efi-amd64
|
||||
|
||||
|
@ -310,14 +310,14 @@ Install GRUB to the disk(s), not the partition(s).
|
|||
# zfs set mountpoint=legacy rpool/var/log
|
||||
# zfs set mountpoint=legacy rpool/var/tmp
|
||||
# cat >> /etc/fstab << EOF
|
||||
rpool/var/log /var/log zfs noatime,nodev 0 0
|
||||
rpool/var/tmp /var/tmp zfs noatime,nodev 0 0
|
||||
rpool/var/log /var/log zfs nodev,relatime 0 0
|
||||
rpool/var/tmp /var/tmp zfs nodev,relatime 0 0
|
||||
EOF
|
||||
|
||||
If you created a /tmp dataset, do the same for it:
|
||||
# zfs set mountpoint=legacy rpool/tmp
|
||||
# cat >> /etc/fstab << EOF
|
||||
rpool/tmp /tmp zfs noatime,nodev 0 0
|
||||
rpool/tmp /tmp zfs nodev,relatime 0 0
|
||||
EOF
|
||||
|
||||
4.12 Optional: Mount a tmpfs to /tmp
|
||||
|
|
Loading…
Reference in New Issue