Article 5Q01G Hotplug Sata drive not being detected automagically while system is (On/Booted/Up) already

Hotplug Sata drive not being detected automagically while system is (On/Booted/Up) already

by
Devious76
from LinuxQuestions.org on (#5Q01G)
Hi There,

Am having an issue with (hot-plugging) my (caddy/3.5 HDD/SSD mount drive bay/ICY-Box SATA drives) which are connected directly to MB SATA ports, as they are not being (populated/mounted) into the system automagically when the caddy is powered on.

OS: EndeavourOS Linux x86_64
Kernel: 5.14.7-arch1-1

Here is what Iv'e done so far :
  • Followed this https://forum.manjaro.org/t/solved-h...hotplug/2911/8 & it DOES work but that's not what am aiming for ! ;)
  • Using EndeavourOS/Manjaro's live distro's works initially (detecting the drive when powered ON), but when I installed it on my system am back to square one.
  • Garuda worked perfectly, which defies what am challenging my self into. (did btw copy '50-sata.rules' file which iv'e found in Garuda & rebooted it with no success)
  • Boot/Reboot DOES populate the drive perfectly with its content when switched ON during those actions.
  • Yes, did try to switch between controllers (Intel & ASM) & changing cables too with no luck!.
  • I've installed "EndeavourOS" with its default settings.
The following outputs were captured during troubleshooting after running the workaround above :

Code:# sudo echo 0 0 0 | tee /sys/class/scsi_host/host*/scan
0 0 0Code:# udevadm monitor

monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent
KERNEL[16886.098196] add /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0 (scsi)
KERNEL[16886.098331] add /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0/5:0:0:0 (scsi)
KERNEL[16886.098397] add /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0/5:0:0:0/scsi_device/5:0:0:0 (scsi_device)
KERNEL[16886.098434] add /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0/5:0:0:0/scsi_disk/5:0:0:0 (scsi_disk)
KERNEL[16886.098487] add /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0/5:0:0:0/bsg/5:0:0:0 (bsg)
UDEV [16886.103322] add /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0 (scsi)
UDEV [16886.104016] add /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0/5:0:0:0 (scsi)
UDEV [16886.104708] add /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0/5:0:0:0/scsi_device/5:0:0:0 (scsi_device)
UDEV [16886.105391] add /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0/5:0:0:0/scsi_disk/5:0:0:0 (scsi_disk)
UDEV [16886.105609] add /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0/5:0:0:0/bsg/5:0:0:0 (bsg)
KERNEL[16886.127297] add /devices/virtual/bdi/8:32 (bdi)
UDEV [16886.127948] add /devices/virtual/bdi/8:32 (bdi)
KERNEL[16886.142947] add /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0/5:0:0:0/block/sdc (block)
KERNEL[16886.142993] add /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0/5:0:0:0/block/sdc/sdc1 (block)
KERNEL[16886.143024] add /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0/5:0:0:0/block/sdc/sdc2 (block)
KERNEL[16886.143051] add /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0/5:0:0:0/block/sdc/sdc5 (block)
KERNEL[16886.157387] bind /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0/5:0:0:0 (scsi)
UDEV [16886.273894] add /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0/5:0:0:0/block/sdc (block)
UDEV [16886.304419] add /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0/5:0:0:0/block/sdc/sdc2 (block)
UDEV [16886.568257] add /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0/5:0:0:0/block/sdc/sdc1 (block)
UDEV [16886.621087] add /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0/5:0:0:0/block/sdc/sdc5 (block)
UDEV [16886.621766] bind /devices/pci0000:00/0000:00:1c.4/0000:0b:00.0/ata6/host5/target5:0:0/5:0:0:0 (scsi)Code:# sudo dmesg -w

[16884.120733] ata1: SATA link down (SStatus 0 SControl 300)
[16884.434305] ata2: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[16884.437661] ata2.00: supports DRM functions and may not be fully accessible
[16884.438376] ata2.00: disabling queued TRIM support
[16884.440491] ata2.00: supports DRM functions and may not be fully accessible
[16884.440869] ata2.00: disabling queued TRIM support
[16884.442558] ata2.00: configured for UDMA/133
[16884.442567] ahci 0000:00:17.0: port does not support device sleep
[16884.442674] ata2.00: Enabling discard_zeroes_data
[16884.757280] ata3: SATA link down (SStatus 0 SControl 300)
[16885.074294] ata4: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[16885.081285] ata4.00: configured for UDMA/133
[16885.397536] ata5: SATA link down (SStatus 0 SControl 300)
[16885.867023] ata6: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[16885.876109] ata6.00: ATA-8: WDC WD2500AAJS-00VTA0, 01.01B01, max UDMA/133
[16885.876119] ata6.00: 488397168 sectors, multi 0: LBA48 NCQ (depth 32), AA
[16885.877440] ata6.00: configured for UDMA/133
[16885.877648] scsi 5:0:0:0: Direct-Access ATA WDC WD2500AAJS-0 1B01 PQ: 0 ANSI: 5
[16885.878334] sd 5:0:0:0: [sdc] 488397168 512-byte logical blocks: (250 GB/233 GiB)
[16885.878375] sd 5:0:0:0: [sdc] Write Protect is off
[16885.878386] sd 5:0:0:0: [sdc] Mode Sense: 00 3a 00 00
[16885.878443] sd 5:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[16885.922188] sdc: sdc1 sdc2 < sdc5 >
[16885.937131] sd 5:0:0:0: [sdc] Attached SCSI diskCode:# lsblk -o name,model,vendor,hotplug,rm,type,subsystems

NAME MODEL VENDOR HOTPLUG RM TYPE SUBSYSTEMS
sda Samsung SSD 870 QVO 2TB ATA 0 0 disk block:scsi:pci
sda1 0 0 part block:scsi:pci
sdb Tech JMicron 1 0 disk block:scsi:usb:pci
sdb1 1 0 part block:scsi:usb:pci
sdb2 1 0 part block:scsi:usb:pci
sdb3 1 0 part block:scsi:usb:pci
sdb4 1 0 part block:scsi:usb:pci
sdc WDC WD2500AAJS-00VTA0 ATA 0 0 disk block:scsi:pci
sdc1 0 0 part block:scsi:pci
sdc2 0 0 part block:scsi:pci
sdc5 0 0 part block:scsi:pci
sr0 HL-DT-ST BD-RE BH20N HL-DT-ST 1 1 rom block:scsi:pci
nvme0n1 CT500P2SSD8 0 0 disk block:nvme:pci
nvme0n1p1 0 0 part block:nvme:pci
nvme0n1p2 0 0 part block:nvme:pci
nvme0n1p3 0 0 part block:nvme:pci
nvme0n1p4 0 0 part block:nvme:pciGenerated logs from EndeavourOS https://clbin.com/ar6E7

Did some tinkering & ALOT of reading to understand this somehow.

According to this https://bbs.archlinux.org/viewtopic....50939#p1750939 & https://en.wikipedia.org/wiki/Udev If I understood correctly:
  • Udev (along with other subsystems attached to it) is a (generic device manager) running that is responsible for your hardware changes (Listener) so to speak.
  • Udev uses a set of rules hence (/lib/udev/rules.d/) & (/etc/udev/rules.d/ for custom rules) to dictate how to operate when an event is "Triggered" (USB plugged in/removed) for example.
  • Based of that rule-set (in my case its a HDD/SSD device) udisks2 is called upon to excute a set of commands to "run" in this event.
  • Now, since I installed EOS with defaults (XFCE), which has "Thunar" as file manager, & it uses "Gnome virtual filesystem (gvfs) provides mounting and trash functionality. (gvfs) uses udisks2 for mounting functionality and is the recommended solution for most file managers."
Based on the above info. (correct me if am wrong) Udev isn't sensing these changes when the device is turned ON.

Being a noob in Linux, & somewhat veteran in M$-Winbloze :scratch: you'll "never Settle" .

So,any suggestions/help would be awesome.

Thank you :)latest?d=yIl2AUoC8zA latest?i=kdi2a9JTFK0:3wWBit1o0zQ:F7zBnMy latest?i=kdi2a9JTFK0:3wWBit1o0zQ:V_sGLiP latest?d=qj6IDK7rITs latest?i=kdi2a9JTFK0:3wWBit1o0zQ:gIN9vFwkdi2a9JTFK0
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments