From 671bf7595c44633db60ce3e139fcc4ccda891325 Mon Sep 17 00:00:00 2001 From: Thomas <9749173+uhthomas@users.noreply.github.com> Date: Thu, 20 Jan 2022 15:32:07 +0000 Subject: Enable periodic TRIM (#882) --- archinstall/lib/installer.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'archinstall') diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 260094c8..4ba304f6 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -390,6 +390,11 @@ class Installer: self.log('Enabling espeakup.service for speech synthesis (accessibility).', level=logging.INFO) self.enable_service('espeakup') + def enable_periodic_trim(self) -> None: + self.log("Enabling periodic TRIM") + # fstrim is owned by util-linux, a dependency of both base and systemd. + self.enable_service("fstrim.timer") + def enable_service(self, *services :str) -> None: for service in services: self.log(f'Enabling service {service}', level=logging.INFO) @@ -571,6 +576,13 @@ class Installer: self.pacstrap(self.base_packages) self.helper_flags['base-strapped'] = True + # Periodic TRIM may improve the performance and longevity of SSDs whilst + # having no adverse effect on other devices. Most distributions enable + # periodic TRIM by default. + # + # https://github.com/archlinux/archinstall/issues/880 + self.enable_periodic_trim() + # TODO: Support locale and timezone # os.remove(f'{self.target}/etc/localtime') # sys_command(f'/usr/bin/arch-chroot {self.target} ln -s /usr/share/zoneinfo/{localtime} /etc/localtime') -- cgit v1.2.3-54-g00ecf