From 0134cfb37c5754845e52e58785021e0e038f50a5 Mon Sep 17 00:00:00 2001 From: Saverio Miroddi Date: Tue, 27 Apr 2021 19:55:16 +0200 Subject: [PATCH 1/3] Remove trimming service (autotrim is now enabled) --- README.md | 3 +-- install-zfs.sh | 38 -------------------------------------- 2 files changed, 1 insertion(+), 40 deletions(-) diff --git a/README.md b/README.md index 8f2a3c4..434bd1d 100644 --- a/README.md +++ b/README.md @@ -41,11 +41,10 @@ The advantages of this project over the Ubuntu installer are: 1. it supports pools configuration; 1. it allows specifying the RAID type; 1. it allows customization of the disk partitions; -1. it supports additional features (e.g. encryption); +1. it supports additional features (e.g. encryption and trimming); 1. it supports new OpenZFS versions, via PPA `jonathonf/zfs`. 1. it supports many more operating systems; 1. it supports unattended installations, via custom scripts; -1. it installs a convenient trimming job for ZFS pools; 1. it's easy to extend. The disadvantages are: diff --git a/install-zfs.sh b/install-zfs.sh index 29bd464..60f14f3 100755 --- a/install-zfs.sh +++ b/install-zfs.sh @@ -1339,43 +1339,6 @@ function fix_filesystem_mount_ordering { chroot_execute "sed -Ei 's|$c_zfs_mount_dir/?|/|' /etc/zfs/zfs-list.cache/*" } -# We don't care about synchronizing with the `fstrim` service for two reasons: -# -# - we assume that there are no other (significantly) large filesystems; -# - trimming is fast (takes minutes on a 1 TB disk). -# -# The code is a straight copy of the `fstrim` service. -# -function configure_pools_trimming { - chroot_execute "cat > /lib/systemd/system/zfs-trim.service << UNIT -[Unit] -Description=Discard unused ZFS blocks -ConditionVirtualization=!container - -[Service] -Type=oneshot -ExecStart=/sbin/zpool trim $c_bpool_name -ExecStart=/sbin/zpool trim $v_rpool_name -UNIT" - - chroot_execute " cat > /lib/systemd/system/zfs-trim.timer << TIMER -[Unit] -Description=Discard unused ZFS blocks once a week -ConditionVirtualization=!container - -[Timer] -OnCalendar=weekly -AccuracySec=1h -Persistent=true - -[Install] -WantedBy=timers.target -TIMER" - - chroot_execute "systemctl daemon-reload" - chroot_execute "systemctl enable zfs-trim.timer" -} - function configure_remaining_settings { [[ $v_swap_size -gt 0 ]] && chroot_execute "echo /dev/zvol/$v_rpool_name/swap none swap discard 0 0 >> /etc/fstab" || true chroot_execute "echo RESUME=none > /etc/initramfs-tools/conf.d/resume" @@ -1480,7 +1443,6 @@ invoke "configure_and_update_grub" invoke "sync_efi_partitions" invoke "update_initramfs" invoke "fix_filesystem_mount_ordering" -invoke "configure_pools_trimming" invoke "configure_remaining_settings" invoke "prepare_for_system_exit" From d1e167a359971febb31a2fe8b85f83602edccb8f Mon Sep 17 00:00:00 2001 From: Saverio Miroddi Date: Tue, 27 Apr 2021 19:56:56 +0200 Subject: [PATCH 2/3] README: Mention that ZFS 2.x can be installed --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 434bd1d..97d29fb 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ The program currently supports: - Linux Mint 19.x, 20 - ElementaryOS 5.1 -The ZFS version installed is 0.8, which supports native encryption and trimming (among the other improvements over 0.7). The required repositories are automatically added to the destination system. +The ZFS version installed is 0.8 (optionally, 2.x), which supports native encryption and trimming (among the other improvements over 0.7). The required repositories are automatically added to the destination system. EFI boot is required (any modern (2011+) system will do); legacy boot is currently not supported. From d1900f1482a9cdd0703154f2b16a31bbea9b0565 Mon Sep 17 00:00:00 2001 From: Saverio Miroddi Date: Tue, 27 Apr 2021 18:29:10 +0200 Subject: [PATCH 3/3] Fix Shellcheck complaint about not following the hotswap script --- install-zfs.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install-zfs.sh b/install-zfs.sh index 60f14f3..96bfd68 100755 --- a/install-zfs.sh +++ b/install-zfs.sh @@ -167,6 +167,7 @@ function invoke { # function hot_swap_script { if [[ -f $c_hotswap_file ]]; then + # shellcheck disable=1090 # can't follow; the file might not exist anyway. source "$c_hotswap_file" fi }