fstrim with Buster

If none of the more specific forums is the right place to ask

Re: fstrim with Buster

Postby p.H » 2019-02-03 14:32

Head_on_a_Stick wrote:I think fstrim.timer should be sufficient

IIUC your message #2, fstrim.timer is not enabled by default.

Head_on_a_Stick wrote:Isn't fragmentation a spinning rust "feature"?

Fragmentation is a filesystem feature and also exists on SSDs (and any other kind of random access storage). It just has a lower impact on performance thanks to the much lower access time.

Head_on_a_Stick wrote:I don't think defragmentation is needed for an SSD, am I wrong?

No. Worse, it is undesirable because it causes extra workload and writes for no benefit.
But you wrote "just treat the SSD as if it were a spinning rust drive". Doesn't it imply that if one defragments their hard disk, they should also defragment their SSD ?

Head_on_a_Stick wrote:Don't most disk partitioning utilities align to the 4K standard automatically?

Actually 1 MB. Any hard disk is fine with 4-KiB, but a SSD needs a bigger alignment size depending on its write page and erase block sizes. Watch out if you clone an old disk with cylinder aligment to an SSD.
p.H
 
Posts: 1123
Joined: 2017-09-17 07:12

Re: fstrim with Buster

Postby p.H » 2019-02-03 14:40

Head_on_a_Stick wrote:relatime has been the default for ext4 since kernel 2.6.30

According to the mount(8) man page, relatime is a filesystem-independant mount option and is the default for any filesystem type, not only ext4.
p.H
 
Posts: 1123
Joined: 2017-09-17 07:12

Re: fstrim with Buster

Postby Head_on_a_Stick » 2019-02-03 14:41

^ & ^^, thanks!
User avatar
Head_on_a_Stick
 
Posts: 10474
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: fstrim with Buster

Postby kalle123 » 2019-02-03 16:17

kalle123 wrote:- ENABLE weekly trim

Code: Select all
$ sudo systemctl enable fstrim.timer


- CHECKING trim

Code: Select all
$ systemctl status fstrim.timer

View fstrim.timer status:

$ systemctl status fstrim.timer
● fstrim.timer - Discard unused blocks once a week
   Loaded: loaded (/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled)
   Active: active (waiting) since Thu 2018-07-05 05:45:11 BST; 4h 42min ago
  Trigger: Mon 2018-07-09 00:00:00 BST; 3 days left
     Docs: man:fstrim
Start/Stop/Restart fstrim.timer:
(immediate activate/deactivate/reactivate, does not change startup status)


$ sudo systemctl [start/stop/restart] fstrim.timer
Enable/Disable fstrim.timer:
(add to/remove from startup, does not change immediate active status)

$ sudo systemctl [enable/disable] fstrim.timer
View fstrim.timer configuration:

$ systemctl cat fstrim.timer
# /lib/systemd/system/fstrim.timer
[Unit]
Description=Discard unused blocks once a week
Documentation=man:fstrim

[Timer]
OnCalendar=weekly
AccuracySec=1h
Persistent=true

[Install]
WantedBy=timers.target
View fstrim.service configuration:

$ systemctl cat fstrim.service
# /lib/systemd/system/fstrim.service
[Unit]
Description=Discard unused blocks

[Service]
Type=oneshot
ExecStart=/sbin/fstrim -av
View related systemd journal entries:

$ journalctl -u fstrim.timer
Jul 04 14:18:41 user-laptop systemd[1]: Started Discard unused blocks once a week.
Jul 04 21:59:26 user-laptop systemd[1]: Stopped Discard unused blocks once a week.
etc...

$ journalctl -u fstrim.service
Jun 25 10:59:44 user-laptop systemd[1]: Starting Discard unused blocks...
Jun 25 10:59:48 user-laptop fstrim[955]: /: 92.5 GiB (99335237632 bytes) trimmed
Jun 25 10:59:48 user-laptop systemd[1]: Started Discard unused blocks.
-- Reboot --
Jul 02 04:27:41 user-laptop systemd[1]: Starting Discard unused blocks...
Jul 02 04:27:46 user-laptop fstrim[1032]: /: 92.3 GiB (99150807040 bytes) trimmed
Jul 02 04:27:46 user-laptop systemd[1]: Started Discard unused blocks.
etc...


That reduces my list a bit on Buster :D

I checked Low-Latency IO-Scheduler with 3 SSDs and 1 "spinning rust" here

Code: Select all
~$ grep . /sys/block/sd?/queue/rotational
/sys/block/sda/queue/rotational:0
/sys/block/sdb/queue/rotational:1
/sys/block/sdc/queue/rotational:0
/sys/block/sdd/queue/rotational:0


Code: Select all
$ grep . /sys/block/sd?/queue/scheduler
/sys/block/sda/queue/scheduler:[mq-deadline] none
/sys/block/sdb/queue/scheduler:[mq-deadline] none
/sys/block/sdc/queue/scheduler:[mq-deadline] none
/sys/block/sdd/queue/scheduler:[mq-deadline] none


No need to do settings there .....
User avatar
kalle123
 
Posts: 229
Joined: 2015-03-21 11:17
Location: Rhineland - Germany

Re: fstrim with Buster

Postby shep » 2019-02-03 18:30

I just installed Buster AMD64 to an HP Stream 14. This is my 1st exposure to emmc memory and a quick web search regarding fstrim/emmc did not really provide much guidance as to whether fstrim would be beneficial. Anybody know the answer?
shep
 
Posts: 314
Joined: 2011-03-15 15:22

Re: fstrim with Buster

Postby Head_on_a_Stick » 2019-02-03 19:11

shep wrote:fstrim/emmc

Run
Code: Select all
lsblk --discard

and check the DISC-GRAN (discard granularity) and DISC-MAX (discard max bytes) columns — non-zero values indicate TRIM support.

Alternatively, install hdparm and use
Code: Select all
# hdparm -I /dev/sdX | grep TRIM

Replace X with the appropriate drive letter.

Sample outputs:
Code: Select all
empty@shinken:~ $ lsblk --discard
NAME   DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
sda           0      512B       2G         0
├─sda1        0      512B       2G         0
├─sda2        0      512B       2G         0
└─sda3        0      512B       2G         0
empty@shinken:~ $ su -c '/sbin/hdparm -I /dev/sda | grep TRIM'                   
           *    Data Set Management TRIM supported (limit 1 block)
empty@shinken:~ $

As you can see, my drive supports TRIM :)
User avatar
Head_on_a_Stick
 
Posts: 10474
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: fstrim with Buster

Postby shep » 2019-02-03 20:33

My emmc does support trim and I implemented it. This reminds me of medicine: Here, take this pill. You will not feel any better but will benefit in the long run. Trust me.
shep
 
Posts: 314
Joined: 2011-03-15 15:22

Previous

Return to General Questions

Who is online

Users browsing this forum: No registered users and 10 guests

fashionable