Once a month I have script that scrubs and trims the SSDs with btrfs.
In LEAP 42.3 this was not a problem.
In LEAP 15.0 the OS keeps changing the /dev/sd* assignments at each boot. It makes the pre-recorded /dev/ values incorrect resulting in errors like below.
ERROR: cannot check /dev/sdb2: No such file or directory
ERROR: '/dev/sdb2' is not a mounted btrfs device
I can see no other option for specifying a volume besides “/dev/sdXN”.
Is there another way to perform these functions?
The script:
LOGDIR="/home/xxx/logs"
LOG="${LOGDIR}/disk-scrub.log"
SCRUB="/usr/sbin/btrfs scrub";
DATE="date +%Y%m%dT%H:%M:%S"
DISKLIST="sdb2 sdb3 sdb4 sdc1 sdd1"
echo Volume scrub began `$DATE` >> ${LOG}
for dsk in $DISKLIST
do
echo Scrubbing ${dsk} >> ${LOG}
txt="${SCRUB} start -Bd /dev/${dsk}"
echo $txt >> ${LOG}
$txt >> ${LOG}
done
#
echo Volume SSD TRIM began `$DATE` >> ${LOG}
txt="/sbin/fstrim -v -a"
echo $txt >> ${LOG}
$txt >> ${LOG}
But, where did you get the system wouldn’t ? Asking since we see quite a lot of people using things from a “computertips” site by someone that ( I know ) doesn’t even run openSUSE and lets people do things manually that the system by default already does. Playing with trim, swappiness, that kind of stuff. With no support at all, so we get people here for support, with systems that are by no means default installs.
Hmm. btrfs-(balance, defrag, trim, scrub). They are both disabled and inactive. And cannot be enabled or made active.
This service cannot be enabled/disabled because it has no "install" section in the description file.
Possibly this is why I created a manual method; I do not recall how it came about as it was 2 - 3 years ago when btrfs was just going public and SSDs were no longer expensive toys.
I do recall being deeply annoyed by having snapper on by default, and it creating dozens of Time Machine style backups that consumed the system disk’s free space; that feature is next to useless for anyone besides kernel devs. And the trim and scrub features were not enabled, far more useful features.
Note: the system journal has been rendered largely useless because Gnome is spewing stack traces every few minutes, and systemd is spewing useless symlink notices. These now represent nearly 95% of the log.
You can’t enable the service, but you can enable the timer.
erlangen:~ # systemctl enable btrfs-balance.service
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
instance name specified.
**erlangen:~ # systemctl enable btrfs-balance.timer
Created symlink /etc/systemd/system/timers.target.wants/btrfs-balance.timer → /usr/lib/systemd/system/btrfs-balance.timer.
erlangen:~ #
**