fstrim -a seems to not trim all points when several can ...

Kernels & Hardware, configuring network, installing services

fstrim -a seems to not trim all points when several can ...

Postby DoubleHP » 2018-12-03 14:08

Raspberry pi 3, Raspbian, Stretch, uSD Sandisk Ultra 16GB white-grey

Just after reboot:

Code: Select all
# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       5.8G  1.8G  3.8G  33% /
devtmpfs        460M     0  460M   0% /dev
tmpfs           464M   32K  464M   1% /dev/shm
tmpfs           464M  6.3M  458M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           464M     0  464M   0% /sys/fs/cgroup
/dev/mmcblk0p3  8.1G  219M  7.4G   3% /srv
/dev/mmcblk0p1   44M   23M   22M  51% /boot
log2ram          40M  5.6M   35M  14% /var/log
tmpfs            93M     0   93M   0% /run/user/0

# fstrim -v -a
/srv: 7.8 GiB (8328622080 bytes) trimmed


# for i in $(mount | awk '{print $3}') ; do echo $i ; fstrim -v $i ; done
/
/: 3.6 GiB (3850960896 bytes) trimmed
/dev
fstrim: /dev: the discard operation is not supported
/sys
fstrim: /sys: the discard operation is not supported
/proc
fstrim: /proc: the discard operation is not supported
/dev/shm
fstrim: /dev/shm: the discard operation is not supported
[...]
/sys/kernel/config
fstrim: /sys/kernel/config: the discard operation is not supported
/srv
/srv: 0 B (0 bytes) trimmed
/boot
fstrim: /boot: the discard operation is not supported
/var/hdd.log
/var/hdd.log: 70 MiB (73351168 bytes) trimmed
/var/log
fstrim: /var/log: the discard operation is not supported
/run/user/0
fstrim: /run/user/0: the discard operation is not supported


1: Obviously, / could be trimmed, but had not been by the first fstrim -a. Why ?

2: Why does consecutive trim end up with freeing 0B, but, after reboot, it's freeing all of free space value ?

Code: Select all
# fstrim -v /
/: 170.5 MiB (178737152 bytes) trimmed
# fstrim -v /
/: 0 B (0 bytes) trimmed
# reboot
# fstrim -v /
/: 3.6 GiB (3839475712 bytes) trimmed
# fstrim -v /
/: 70 MiB (73351168 bytes) trimmed
# fstrim -v /
/: 0 B (0 bytes) trimmed


3: I already run fstrim -a weekly; would it help to add discard to mount options ? I am not satisfied with fstrim -a because it obviously does not trim all mounted points he can.

4: why can it trim /var/log but not /dev/shm ?
https://github.com/azlux/log2ram
DoubleHP
 
Posts: 27
Joined: 2016-10-09 08:55

Re: fstrim -a seems to not trim all points when several can

Postby bw123 » 2018-12-03 14:29

You might find some help in man page for fstrim? I don't use it, and prefer discard, but the way I read the man page, the numbers reported by -v are not accurate. Also mentions that it trims only what is 'unused' at the moment.

I don't think it's a good idea to repeatedly run fstrim like you are showing, or trimming fs which aren't supported. Maybe ease up a little until you figure it out? Good luck.
User avatar
bw123
 
Posts: 3585
Joined: 2011-05-09 06:02
Location: TN_USA


Return to System configuration

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable