Hot swap SATA not working

On my system, hot swapping of my SATA dock has been working for years using Windows and several Ubuntu derivative distros. BUT, not on EOS.

  • I installed EOS with KDE and printer support, and it is up-to-date.
  • The bios has “AHCI Mode” enabled and the SATA port has “Hot Plug” enabled.
  • dmesg show AHCI is being started with flags 64bit ncq sntf led clo only pio slum part ems deso sadm sds apst
  • When I have a disk plugged in on boot, it is seen; but if I hot plug a disk, it does not.
  • As a workaround, if I run echo '0 0 0' > /sys/class/scsi_host/host5/scan, then the disk is immediately recognized.

I’m hoping for a permanent, automatic solution. I’ve googled every imagined search terms, check the Arch AHCI page, etc., and other than the workaround, nothing has helped. Are there more packages to install or services to enable to get hot swap working on EOS?

Not even with lsblk?

Welcome to EOS btw! :wink:

No, not with lsblk. I also have gnome-disk-utility installed, and it is pretty good about showing all drives immediately. Nothing sees the disk until I do the echo workaround; then gnome-disk and lsblk sees the disk.

No ideas here…
Perhaps @torvic9 or @tbg would know something?

You shouldn’t need to, but perhaps a udev rule running your workaround command might be a little less hacky than having to manually execute the command.

Sorry, but I’m not great at writing udev rules (so I’m not really the one to ask about that).

I would think there should already be a udev rule for this. My guess is there is a bug that is preventing it from executing properly.

I would search for kernel bug reports, as well as testing a different kernel than what you are currently using.

2 Likes

Thanks for the advice. To be sure, I re-tested Kubuntu with 5.4.0-4-generic, and hot swap works fine. I verified how swap is NOT working for me on:

  • 5.7.11-arch1-1 (the one I was on initially)
  • 5.7.12-arch1-2 (the latest available via pacman)
  • 5.4.55-1-lts (the latest LTS version via pacman)

I looked briefly at udev rules, and those look completely out of my league to attempt to isolate and fix a problem. It was not even obvious which of the several rules might be at fault. But, on a lark, I temporarily replaced EOS’s /usr/lib/udev/rules.d with Kubuntu’s /usr/lib/udev/rules.d, and then I rebooted. With Kubuntu’s rules, EOS still does not recognize new disks until the workaround is run. So, I’m doubting that the udev rules are at fault.

But, my workaround is “good enough”, and I’m loving EOS … so thanks again.

1 Like

have you checked here ?
https://wiki.archlinux.org/index.php/Udev

Yes I’ve read that and other pages. If I run udevadm monitor, I see (on both Kubuntu and EOS):

$ sudo udevadm monitor
KERNEL[62.629105] add      /devices/pci0000:00/0000:00:17.0/ata6/host5/target5:0:0 (scsi)
...
UDEV  [62.635292] add      /devices/pci0000:00/0000:00:17.0/ata6/host5/target5:0:0 (scsi)

On Kubuntu, I see the KERNEL/UDEV lines immediately, but on after rebooting to EOS, I must run echo '0 0 0' > /sys/class/scsi_host/host5/scan to see those lines. I deduce the EOS kernel is NOT scanning for or recognizing the new drive. Thus, this is not a udev rules issue, per se, but a failure of the kernel to automatically recognize new disk.

Also, to rule out a transient kernel bug, I built/installed/ran a fresh 5.8 kernel from www.kernel.org with all default build options, and it does not recognize hot swap either. So, some local configuration option, I must assume, is defeating the automatic recognition of hot swapped disks.

1 Like

NOTE: still unsolved and stumped. But I have some new information.

Firstly, I’ve tried two other Arch derivatives also using the Calamares installer, and both see the hot swap drive when plugged in. The closest (in terms of packages and modules) was KDE from ArcoLinuxB Community Editions - Browse /plasma at SourceForge.net; no differences that I detected/reasearched explained the hot swap handling differences. So, something unique to EOS (not Arch, per se) breaks SATA hot swap.

Secondly, the best single reference (I think) on the matter is udevil Homepage. Suggestions include…

[1] Add a udev rule to enable kernel polling on removable devices: echo 'ACTION=="add", ATTR{removable}=="1", ATTR{events_poll_msecs}=="-1", TTR{events_poll_msecs}="2000"' > /etc/udev/rules.d/61-removable-storage-polling.rules.
Which I did on EOS to no avail (and there was no similar rule on ArcoLinux).

[2] To enable kernel polling temporarily and immediately, enable common polling for the block module: sudo bash -c 'echo 2000 > /sys/module/block/parameters/events_dfl_poll_msecs. This value (2000) was already set on distros that worked and on EOS. So, it did not help.

Thirdly, I installed combinations of udisks2, udevil, and udiskie (per udisks - ArchWiki) w/o any luck, also.

Summary: newly plugged in USB drives are seen, just not new hot swap hard drives. Again, not a show stopper. But, I did hope to isolate the problem, but I failed to do so.

Hello @gammazoid
What is the motherboard make and model?

Edit:

Some of the settings on some of these motherboards are hidden or fin-achy such as AHCI Mode could be set to auto but it really needs to be set to enabled for it to work. Even though you have probably looked at the settings already i would just go over them again.

Motherboard info (and two settings):

        Manufacturer: MSI
        Product Name: Z170A GAMING PRO CARBON (MS-7A12)
        Version: 1.0
        SATA Mode: AHCI Mode    # in advanced settings
        SATA 6 Hot Plug: Enabled # in advanced settings (this is the caddy port for certain)

BTW, I did not vary the motherboard settings between distro trials. But, for EOS, I also tried enabling Hot Plug on every SATA port which made no difference.