Re: [Dorset] fstrim weirdness
On 10/02/2022 13:05, Graeme Gemmill wrote: On 10/02/2022 12:00, dorset-requ...@mailman.lug.org.uk wrote: Send dorset mailing list submissions to dorset@mailman.lug.org.uk To subscribe or unsubscribe via the World Wide Web, visit https://mailman.lug.org.uk/mailman/listinfo/dorset or, via email, send a message with subject or body 'help' to dorset-requ...@mailman.lug.org.uk You can reach the person managing the list at dorset-ow...@mailman.lug.org.uk When replying, please edit your Subject line so it is more specific than "Re: Contents of dorset digest..." Today's Topics: 1. fstrim weirdness (Hamish McIntyre-Bhatty) 2. Re: fstrim weirdness (Neil Stone) 3. Re: fstrim weirdness (Victor Churchill) 4. Re: fstrim weirdness (Neil Stone) 5. Re: fstrim weirdness (Hamish McIntyre-Bhatty) 6. Curious anecdote about using ecryptfs (Hamish McIntyre-Bhatty) 7. Re: fstrim weirdness (Tim Waugh) 8. Re: fstrim weirdness (Hamish McIntyre-Bhatty) 9. Re: fstrim weirdness (Tim Waugh) -- Message: 1 Date: Wed, 9 Feb 2022 17:55:56 + From: Hamish McIntyre-Bhatty To: dorset@mailman.lug.org.uk Subject: [Dorset] fstrim weirdness Message-ID: <47abd098-4851-47a6-ca9e-adef6e5e5...@hamishmb.com> Content-Type: text/plain; charset=UTF-8; format=flowed Hi there, I believe a while back I was talking about TRIM here, more specifically about it not running automatically on my systems, and I think someone recommended I enable fstrim.service with systemd. I finally got around to that, only to find that it was already enabled, and apparently not doing anything. As I don't leave my systems on 24/7, is it safe to assume that the timer isn't firing when the system is booted up later, after the configured time for TRIM has passed? If so, does anyone know how to configure a task like this to run when scheduled, or alternatively when the system is next booted up in the case that the event was missed? I know CRON can't do this, and I assumed the point of using systemd timers was that they could do this, but alas perhaps not. I assume there must be a standard way to do this, because it seems like a rather big omission, considering that other commercial operating systems Who Must Not Be Named (TM) seem to have had this feature for a while. Any ideas? Hamish Hamish, a couple of points: 1. man 5 crontab introduces some special "times" for action, including @reboot, "run once after reboot" 2. On my mageia system, anacron is triggered hourly to sweep up any missed triggers. It usually exits with no jobs run. Best wishes, Graeme Hi Graeme, anacron seems to be set up the same way on my Linux Mint 20.3 system - useful to know. Essentially I thought the distro maintainers had forgotten about TRIM needed to be run even if the system isn't on all the time (eg like for most users) but I was mistaken, and didn't realise I could just check with journalctl (as I use systemd). I thought something was up with TRIM due to my slow transfer speeds, but I was wrong and it was about my disk encryption as I posted about yesterday. Cheers, Hamish -- Next meeting: Online, Jitsi, Tuesday, 2022-03-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] fstrim weirdness
On 10/02/2022 12:00, dorset-requ...@mailman.lug.org.uk wrote: Send dorset mailing list submissions to dorset@mailman.lug.org.uk To subscribe or unsubscribe via the World Wide Web, visit https://mailman.lug.org.uk/mailman/listinfo/dorset or, via email, send a message with subject or body 'help' to dorset-requ...@mailman.lug.org.uk You can reach the person managing the list at dorset-ow...@mailman.lug.org.uk When replying, please edit your Subject line so it is more specific than "Re: Contents of dorset digest..." Today's Topics: 1. fstrim weirdness (Hamish McIntyre-Bhatty) 2. Re: fstrim weirdness (Neil Stone) 3. Re: fstrim weirdness (Victor Churchill) 4. Re: fstrim weirdness (Neil Stone) 5. Re: fstrim weirdness (Hamish McIntyre-Bhatty) 6. Curious anecdote about using ecryptfs (Hamish McIntyre-Bhatty) 7. Re: fstrim weirdness (Tim Waugh) 8. Re: fstrim weirdness (Hamish McIntyre-Bhatty) 9. Re: fstrim weirdness (Tim Waugh) -- Message: 1 Date: Wed, 9 Feb 2022 17:55:56 + From: Hamish McIntyre-Bhatty To: dorset@mailman.lug.org.uk Subject: [Dorset] fstrim weirdness Message-ID: <47abd098-4851-47a6-ca9e-adef6e5e5...@hamishmb.com> Content-Type: text/plain; charset=UTF-8; format=flowed Hi there, I believe a while back I was talking about TRIM here, more specifically about it not running automatically on my systems, and I think someone recommended I enable fstrim.service with systemd. I finally got around to that, only to find that it was already enabled, and apparently not doing anything. As I don't leave my systems on 24/7, is it safe to assume that the timer isn't firing when the system is booted up later, after the configured time for TRIM has passed? If so, does anyone know how to configure a task like this to run when scheduled, or alternatively when the system is next booted up in the case that the event was missed? I know CRON can't do this, and I assumed the point of using systemd timers was that they could do this, but alas perhaps not. I assume there must be a standard way to do this, because it seems like a rather big omission, considering that other commercial operating systems Who Must Not Be Named (TM) seem to have had this feature for a while. Any ideas? Hamish Hamish, a couple of points: 1. man 5 crontab introduces some special "times" for action, including @reboot, "run once after reboot" 2. On my mageia system, anacron is triggered hourly to sweep up any missed triggers. It usually exits with no jobs run. Best wishes, Graeme -- Next meeting: Online, Jitsi, Tuesday, 2022-03-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] fstrim weirdness
On 10/02/2022 11:07, Tim Waugh wrote: On Thu, 10 Feb 2022 at 11:05, Hamish McIntyre-Bhatty wrote: The second command says it was "Passed" three days ago, but I don't know if that means it ran. There are no other timers in the output from that command. We only asked for the fstrim timer. 'systemctl list-timers' will show you all the timers. Look in the logs to see if it ran? journalctl -u fstrim Tim. */ Yeah, it has been running, my bad. Well, we learn something new every day :) Hamish -- Next meeting: Online, Jitsi, Tuesday, 2022-03-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] fstrim weirdness
On Thu, 10 Feb 2022 at 11:05, Hamish McIntyre-Bhatty wrote: > The second command says it was "Passed" three days ago, but I don't know > if that means it ran. There are no other timers in the output from that > command. > We only asked for the fstrim timer. 'systemctl list-timers' will show you all the timers. Look in the logs to see if it ran? journalctl -u fstrim Tim. */ -- Next meeting: Online, Jitsi, Tuesday, 2022-03-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] fstrim weirdness
On 10/02/2022 10:06, Tim Waugh wrote: On Wed, 9 Feb 2022 at 17:57, Hamish McIntyre-Bhatty wrote: I finally got around to that, only to find that it was already enabled, and apparently not doing anything. As I don't leave my systems on 24/7, is it safe to assume that the timer isn't firing when the system is booted up later, after the configured time for TRIM has passed? This depends on the configuration of the timer. The 'Persistent' field controls this (see systemd.timer(5) ). What does this say?: systemctl show fstrim.timer | grep Persistent Also, find out when it last triggered: systemctl list-timers fstrim Tim. */ Hello Tim. Persistent=yes is what I get from that command. The second command says it was "Passed" three days ago, but I don't know if that means it ran. There are no other timers in the output from that command. Perhaps TRIM has been working fine, given my heavy-IO workload, but when I do run it manually it often has done 100s of GB at a time in the past. Hamish -- Next meeting: Online, Jitsi, Tuesday, 2022-03-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] fstrim weirdness
On Wed, 9 Feb 2022 at 17:57, Hamish McIntyre-Bhatty wrote: > I finally got around to that, only to find that it was already enabled, > and apparently not doing anything. As I don't leave my systems on 24/7, > is it safe to assume that the timer isn't firing when the system is > booted up later, after the configured time for TRIM has passed? This depends on the configuration of the timer. The 'Persistent' field controls this (see systemd.timer(5) ). What does this say?: systemctl show fstrim.timer | grep Persistent Also, find out when it last triggered: systemctl list-timers fstrim Tim. */ -- Next meeting: Online, Jitsi, Tuesday, 2022-03-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] fstrim weirdness
On 09/02/2022 18:23, Neil Stone wrote: See also 'anacron' to run cron tasks that were missed due to the system being off. Hi Victor, many years since we spoke last o/ On Wed, 9 Feb 2022 at 18:16, Victor Churchill wrote: I've not used fstrim, but I assume you're putting a fstrim command into your crontab but concerned that it won't run if the machine is shut down before the cron time comes round. Have you seen the cron '@reboot' facility? This will run whatever command you give it when Linux starts. You might want to give it a script which checks for the existence of some flag to tell it whether it wqants to run fstrim or not, depending on whether fstrim got run by a regular scheduled cronjob (which could set aforesaid flag). best regards, 웃 Victor Churchill, Netley Abbey, Southampton On Wed, 9 Feb 2022 at 17:57, Hamish McIntyre-Bhatty wrote: Hi there, I believe a while back I was talking about TRIM here, more specifically about it not running automatically on my systems, and I think someone recommended I enable fstrim.service with systemd. I finally got around to that, only to find that it was already enabled, and apparently not doing anything. As I don't leave my systems on 24/7, is it safe to assume that the timer isn't firing when the system is booted up later, after the configured time for TRIM has passed? If so, does anyone know how to configure a task like this to run when scheduled, or alternatively when the system is next booted up in the case that the event was missed? I know CRON can't do this, and I assumed the point of using systemd timers was that they could do this, but alas perhaps not. I assume there must be a standard way to do this, because it seems like a rather big omission, considering that other commercial operating systems Who Must Not Be Named (TM) seem to have had this feature for a while. Any ideas? Hamish -- Next meeting: Online, Jitsi, Tuesday, 2022-03-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk -- Next meeting: Online, Jitsi, Tuesday, 2022-03-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk Cheers all, I have added: 7 50 fstrim -av To /etc/anacrontab. Hopefully that'll do it. This should really be in there for most distributions by default IMO. Hamish -- Next meeting: Online, Jitsi, Tuesday, 2022-03-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] fstrim weirdness
See also 'anacron' to run cron tasks that were missed due to the system being off. Hi Victor, many years since we spoke last o/ On Wed, 9 Feb 2022 at 18:16, Victor Churchill wrote: > I've not used fstrim, but I assume you're putting a fstrim command into > your crontab but concerned that it won't run if the machine is shut down > before the cron time comes round. > Have you seen the cron '@reboot' facility? This will run whatever command > you give it when Linux starts. > You might want to give it a script which checks for the existence of some > flag to tell it whether it wqants to run fstrim or not, depending on > whether fstrim got run by a regular scheduled cronjob (which could set > aforesaid flag). > > best regards, > 웃 > Victor Churchill, > Netley Abbey, Southampton > > > > On Wed, 9 Feb 2022 at 17:57, Hamish McIntyre-Bhatty > wrote: > > > Hi there, > > > > I believe a while back I was talking about TRIM here, more specifically > > about it not running automatically on my systems, and I think someone > > recommended I enable fstrim.service with systemd. > > > > I finally got around to that, only to find that it was already enabled, > > and apparently not doing anything. As I don't leave my systems on 24/7, > > is it safe to assume that the timer isn't firing when the system is > > booted up later, after the configured time for TRIM has passed? > > > > If so, does anyone know how to configure a task like this to run when > > scheduled, or alternatively when the system is next booted up in the > > case that the event was missed? > > > > I know CRON can't do this, and I assumed the point of using systemd > > timers was that they could do this, but alas perhaps not. I assume there > > must be a standard way to do this, because it seems like a rather big > > omission, considering that other commercial operating systems Who Must > > Not Be Named (TM) seem to have had this feature for a while. > > > > Any ideas? > > > > Hamish > > > > > > -- > > Next meeting: Online, Jitsi, Tuesday, 2022-03-01 20:00 > > Check to whom you are replying > > Meetings, mailing list, IRC, ... http://dorset.lug.org.uk > > New thread, don't hijack: mailto:dorset@mailman.lug.org.uk > > > -- > Next meeting: Online, Jitsi, Tuesday, 2022-03-01 20:00 > Check to whom you are replying > Meetings, mailing list, IRC, ... http://dorset.lug.org.uk > New thread, don't hijack: mailto:dorset@mailman.lug.org.uk > -- Next meeting: Online, Jitsi, Tuesday, 2022-03-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] fstrim weirdness
I've not used fstrim, but I assume you're putting a fstrim command into your crontab but concerned that it won't run if the machine is shut down before the cron time comes round. Have you seen the cron '@reboot' facility? This will run whatever command you give it when Linux starts. You might want to give it a script which checks for the existence of some flag to tell it whether it wqants to run fstrim or not, depending on whether fstrim got run by a regular scheduled cronjob (which could set aforesaid flag). best regards, 웃 Victor Churchill, Netley Abbey, Southampton On Wed, 9 Feb 2022 at 17:57, Hamish McIntyre-Bhatty wrote: > Hi there, > > I believe a while back I was talking about TRIM here, more specifically > about it not running automatically on my systems, and I think someone > recommended I enable fstrim.service with systemd. > > I finally got around to that, only to find that it was already enabled, > and apparently not doing anything. As I don't leave my systems on 24/7, > is it safe to assume that the timer isn't firing when the system is > booted up later, after the configured time for TRIM has passed? > > If so, does anyone know how to configure a task like this to run when > scheduled, or alternatively when the system is next booted up in the > case that the event was missed? > > I know CRON can't do this, and I assumed the point of using systemd > timers was that they could do this, but alas perhaps not. I assume there > must be a standard way to do this, because it seems like a rather big > omission, considering that other commercial operating systems Who Must > Not Be Named (TM) seem to have had this feature for a while. > > Any ideas? > > Hamish > > > -- > Next meeting: Online, Jitsi, Tuesday, 2022-03-01 20:00 > Check to whom you are replying > Meetings, mailing list, IRC, ... http://dorset.lug.org.uk > New thread, don't hijack: mailto:dorset@mailman.lug.org.uk > -- Next meeting: Online, Jitsi, Tuesday, 2022-03-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] fstrim weirdness
I run this from root cron... 00 4 * * * /sbin/fstrim -av you can, of course, change the timing to whatever you want. HTH On Wed, 9 Feb 2022 at 17:57, Hamish McIntyre-Bhatty wrote: > Hi there, > > I believe a while back I was talking about TRIM here, more specifically > about it not running automatically on my systems, and I think someone > recommended I enable fstrim.service with systemd. > > I finally got around to that, only to find that it was already enabled, > and apparently not doing anything. As I don't leave my systems on 24/7, > is it safe to assume that the timer isn't firing when the system is > booted up later, after the configured time for TRIM has passed? > > If so, does anyone know how to configure a task like this to run when > scheduled, or alternatively when the system is next booted up in the > case that the event was missed? > > I know CRON can't do this, and I assumed the point of using systemd > timers was that they could do this, but alas perhaps not. I assume there > must be a standard way to do this, because it seems like a rather big > omission, considering that other commercial operating systems Who Must > Not Be Named (TM) seem to have had this feature for a while. > > Any ideas? > > Hamish > > > -- > Next meeting: Online, Jitsi, Tuesday, 2022-03-01 20:00 > Check to whom you are replying > Meetings, mailing list, IRC, ... http://dorset.lug.org.uk > New thread, don't hijack: mailto:dorset@mailman.lug.org.uk > -- Next meeting: Online, Jitsi, Tuesday, 2022-03-01 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk