Remove trimming service (autotrim is now enabled)

This commit is contained in:
Saverio Miroddi 2021-04-27 19:55:16 +02:00
parent 72f1f38970
commit 0134cfb37c
2 changed files with 1 additions and 40 deletions

View File

@ -41,11 +41,10 @@ The advantages of this project over the Ubuntu installer are:
1. it supports pools configuration; 1. it supports pools configuration;
1. it allows specifying the RAID type; 1. it allows specifying the RAID type;
1. it allows customization of the disk partitions; 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 new OpenZFS versions, via PPA `jonathonf/zfs`.
1. it supports many more operating systems; 1. it supports many more operating systems;
1. it supports unattended installations, via custom scripts; 1. it supports unattended installations, via custom scripts;
1. it installs a convenient trimming job for ZFS pools;
1. it's easy to extend. 1. it's easy to extend.
The disadvantages are: The disadvantages are:

View File

@ -1339,43 +1339,6 @@ function fix_filesystem_mount_ordering {
chroot_execute "sed -Ei 's|$c_zfs_mount_dir/?|/|' /etc/zfs/zfs-list.cache/*" 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 { 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 [[ $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" 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 "sync_efi_partitions"
invoke "update_initramfs" invoke "update_initramfs"
invoke "fix_filesystem_mount_ordering" invoke "fix_filesystem_mount_ordering"
invoke "configure_pools_trimming"
invoke "configure_remaining_settings" invoke "configure_remaining_settings"
invoke "prepare_for_system_exit" invoke "prepare_for_system_exit"