On Sun, Jun 13, 2021 at 5:26 AM Patrick O'Callaghan
<pocallaghan(a)gmail.com> wrote:
>
> I'm 99% certain it's being caused by my external USB dock starting
> up.
> See my reply to Ed. The dock is not mounted at boot, but has a
> BTRFS
> filesystem that (possibly) the kernel insists on checking before
> the
> rest of the startup can proceed. This is speculation at the moment.
>
> systemd-analyze blame shows a long delay in a unit I created to
> automatically power down the dock if it's not mounted:
>
> $ systemd-analyze blame|head
> 4min 18.016s dock-watch.service
> 30.517s systemd-udev-settle.service
> 15.273s logrotate.service
> 6.274s NetworkManager-wait-online.service
> 5.765s raid.mount
> 5.452s plymouth-quit-wait.service
> 5.038s akmods.service
> 4.541s upower.service
> 4.427s sssd.service
>
> I've uploaded the dock-watch unit and the scripts it calls,
> together
> with the automount unit, to:
>
>
https://drive.google.com/drive/folders/1BT5w4u7TzBmWbhx97sWvfOErCIUylrik?...
dock-wait script contains:
RAID=/dev/sdd
This may not be reliable because /dev nodes frequently change between
reboots. You're better off using /dev/disk/by-... any of them are
better than node. You can use label, uuid, wwn, whatever.
I actually use a udev rule for idle spin down:
$ cat /etc/udev/rules.d/69-hdparm.rules
ACTION=="add", SUBSYSTEM=="block", \
KERNEL=="sd*[!0-9]", \
ENV{ID_SERIAL_SHORT}=="WDZ47F0A", \
RUN+="/usr/sbin/hdparm -B 100 -S 252 /dev/disk/by-id/wwn-
0x5000c500a93cae8a"
$
Good point. I was already nervous about a hard-wired device name though
it hasn't bitten me so far.
poc