Ferk / udev-media-automount

A simple automount mechanism using udev rules
Other
121 stars 58 forks source link

3 identical USB drives, only one gets mounted on start up #30

Open aguaviva opened 2 days ago

aguaviva commented 2 days ago

system description

Here are the repro steps:

on boot log

As you can see only sdd mounts properly:

> sudo journalctl -r --boot=0 | grep mount | more
Oct 10 19:24:01 nube systemd[1]: Starting media-automount@sdb1.service...
Oct 10 19:24:01 nube systemd[1]: Started media-automount@sdd1.service.
Oct 10 19:24:01 nube systemd[1]: Started media-automount@sdio.service.
Oct 10 19:24:01 nube systemd[1]: media-automount@sdio.service: Deactivated successfully.
Oct 10 19:24:01 nube ntfs-3g[799]: Mount options: errors=remount-ro,utf8,users,noexec,nosuid,nodev,flush,allow_other,nonempty,relatime,rw,fsname=/dev/sdd1,blkdev,blksize=4096
Oct 10 19:24:01 nube systemd[1]: Started media-automount@sdd.service.
Oct 10 19:24:01 nube media-automount[813]: Device successfully mounted: /media/STUFF
Oct 10 19:24:01 nube ntfs-3g[799]: Cmdline options: rw,errors=remount-ro,relatime,utf8,users,noexec,nosuid,nodev,flush
Oct 10 19:24:01 nube systemd[1]: media-automount@sdd.service: Deactivated successfully.
Oct 10 19:24:01 nube systemd[1]: Started media-automount@sdc.service.
Oct 10 19:24:01 nube systemd[1]: media-automount@sdc.service: Deactivated successfully.
Oct 10 19:24:01 nube media-automount[787]: mounting device /dev/sdd1 in /media/STUFF
Oct 10 19:24:01 nube media-automount[785]: loading configuration for fs type ntfs
Oct 10 19:24:01 nube media-automount[773]: device doesn't exist anymore or is not a block device: /dev/sdio
Oct 10 19:24:01 nube media-automount[759]: /dev/sdd has no known filesystem type, ignoring mount request
Oct 10 19:24:01 nube media-automount[732]: /dev/sdc has no known filesystem type, ignoring mount request
Oct 10 19:24:01 nube systemd[1]: Starting media-automount@sdd1.service...
Oct 10 19:24:01 nube systemd[1]: Starting media-automount@sdc1.service...
Oct 10 19:24:01 nube systemd[1]: Started media-automount@sdb.service.
Oct 10 19:24:01 nube systemd[1]: media-automount@sdb.service: Deactivated successfully.
Oct 10 19:24:01 nube systemd[1]: Started media-automount@sda2.service.
Oct 10 19:24:01 nube systemd[1]: media-automount@sda2.service: Deactivated successfully.
Oct 10 19:24:01 nube systemd[1]: Started media-automount@sda1.service.
Oct 10 19:24:01 nube systemd[1]: media-automount@sda1.service: Deactivated successfully.
Oct 10 19:24:01 nube systemd[1]: Started media-automount@sda.service.
Oct 10 19:24:01 nube systemd[1]: media-automount@sda.service: Deactivated successfully.
Oct 10 19:24:00 nube systemd[1]: Starting media-automount@sdio.service...
Oct 10 19:24:00 nube systemd[1]: Starting media-automount@sdd.service...
Oct 10 19:24:00 nube media-automount[686]: /dev/sdb has no known filesystem type, ignoring mount request
Oct 10 19:24:00 nube media-automount[678]: /dev/sda2 is used as rootfs, automount won't manage it
Oct 10 19:24:00 nube media-automount[668]: /dev/sda1 has no known filesystem type, ignoring mount request
Oct 10 19:24:00 nube systemd[1]: Starting media-automount@sdc.service...
Oct 10 19:24:00 nube media-automount[661]: /dev/sda has no known filesystem type, ignoring mount request
Oct 10 19:24:00 nube systemd[1]: Starting media-automount@sdb.service...
Oct 10 19:24:00 nube systemd[1]: Starting media-automount@sda2.service...
Oct 10 19:24:00 nube systemd[1]: Starting media-automount@sda1.service...
Oct 10 19:24:00 nube systemd[1]: Starting media-automount@sda.service...
Oct 10 19:24:00 nube systemd[1]: Created slice system-media\x2dautomount.slice - Slice /system/media-automount.
Oct 10 19:24:00 nube systemd[1]: Mounted proc-sys-fs-binfmt_misc.mount - Arbitrary Executable File Formats File System.
Oct 10 19:24:00 nube systemd[1]: Mounting proc-sys-fs-binfmt_misc.mount - Arbitrary Executable File Formats File System...
Oct 10 19:24:00 nube systemd[1]: proc-sys-fs-binfmt_misc.automount: Got automount request for /proc/sys/fs/binfmt_misc, triggered by 349 (systemd-binfmt)
Oct 10 19:23:59 nube systemd[1]: Mounted sys-kernel-config.mount - Kernel Configuration File System.
Oct 10 19:23:59 nube systemd[1]: Mounted sys-fs-fuse-connections.mount - FUSE Control File System.
Oct 10 19:23:59 nube systemd[1]: Mounting sys-kernel-config.mount - Kernel Configuration File System...
Oct 10 19:23:59 nube systemd[1]: Mounting sys-fs-fuse-connections.mount - FUSE Control File System...
Oct 10 19:23:59 nube systemd[1]: Finished systemd-remount-fs.service - Remount Root and Kernel File Systems.
Oct 10 19:23:59 nube kernel: EXT4-fs (sda2): re-mounted 802b07b9-173a-45ad-b486-d4bb472b0f63 r/w. Quota mode: none.
Oct 10 19:23:59 nube systemd[1]: Mounted sys-kernel-tracing.mount - Kernel Trace File System.
Oct 10 19:23:59 nube systemd[1]: Mounted sys-kernel-debug.mount - Kernel Debug File System.
Oct 10 19:23:59 nube systemd[1]: Mounted dev-mqueue.mount - POSIX Message Queue File System.
Oct 10 19:23:59 nube systemd[1]: Mounted dev-hugepages.mount - Huge Pages File System.
Oct 10 19:23:59 nube systemd[1]: Starting systemd-remount-fs.service - Remount Root and Kernel File Systems...
Oct 10 19:23:59 nube systemd[1]: Mounting sys-kernel-tracing.mount - Kernel Trace File System...
Oct 10 19:23:59 nube systemd[1]: Mounting sys-kernel-debug.mount - Kernel Debug File System...
Oct 10 19:23:59 nube systemd[1]: Mounting dev-mqueue.mount - POSIX Message Queue File System...
Oct 10 19:23:59 nube systemd[1]: Mounting dev-hugepages.mount - Huge Pages File System...
Oct 10 19:23:59 nube systemd[1]: Set up automount proc-sys-fs-binfmt_misc.automount - Arbitrary Executable File Formats File System Automount Point.
Oct 10 19:23:59 nube kernel: EXT4-fs (sda2): mounted filesystem 802b07b9-173a-45ad-b486-d4bb472b0f63 ro with ordered data mode. Quota mode: none.

plug-unplug

if I plug-unplug sdb it still doesn't show up

Oct 10 19:32:43 nube systemd[1]: Starting media-automount@sdb1.service...
Oct 10 19:32:43 nube systemd[1]: Stopped media-automount@sdb1.service.
Oct 10 19:32:43 nube systemd[1]: media-automount@sdb1.service: Deactivated successfully.
Oct 10 19:32:43 nube systemd[1]: Starting media-automount@sdb.service...
Oct 10 19:32:43 nube systemd[1]: Stopped media-automount@sdb.service.
Oct 10 19:32:43 nube systemd[1]: media-automount@sdb.service: Deactivated successfully.
Oct 10 19:32:39 nube systemd[1]: Starting media-automount@sdb.service...
Oct 10 19:32:39 nube systemd[1]: Starting media-automount@sdb1.service...

using mount

USB disks mount properly when using the mount command

mounting using udev

issuing:

 udevadm trigger --action=add /dev/sdb1

gets me:

Oct 10 19:41:02 nube systemd[1]: Failed to start media-automount@sdb1.service.
Oct 10 19:41:02 nube systemd[1]: media-automount@sdb1.service: Failed with result 'timeout'.
Oct 10 19:41:02 nube systemd[1]: media-automount@sdb1.service: start operation timed out. Terminating.
Oct 10 19:39:31 nube systemd[1]: Starting media-automount@sdb1.service...

I hope this helps and please let me know if I forgot to add any details

aguaviva commented 2 days ago

I am mounting the 3 drives using fstab and they take their sweet time, not sure if this is related:

[    1.144738] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    1.144843] sd 0:0:0:0: [sda] 500118192 512-byte logical blocks: (256 GB/238 GiB)
[    1.144972] sd 0:0:0:0: [sda] Write Protect is off
[    1.145025] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    1.145068] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    1.145175] sd 0:0:0:0: [sda] Preferred minimum I/O size 512 bytes
[    1.146824]  sda: sda1 sda2
[    1.147190] sd 0:0:0:0: [sda] supports TCG Opal
[    1.147242] sd 0:0:0:0: [sda] Attached SCSI disk
[    1.331248] tsc: Refined TSC clocksource calibration: 2893.282 MHz
[    1.331359] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x29b478e661d, max_idle_ns: 440795325242 ns
[    1.331565] clocksource: Switched to clocksource tsc
[    1.449712] ata4: SATA link down (SStatus 0 SControl 300)
[    1.453825] e1000e 0000:00:19.0 eno1: renamed from eth0
[    2.134336] usb 4-3: new SuperSpeed USB device number 2 using xhci_hcd
[    2.147544] usb 4-3: New USB device found, idVendor=04e8, idProduct=4001, bcdDevice= 1.00
[    2.147679] usb 4-3: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[    2.147773] usb 4-3: Product: PSSD T7
[    2.147857] usb 4-3: Manufacturer: Samsung
[    2.147936] usb 4-3: SerialNumber: S7MLNS0X528017K
[    3.006355] usb 4-5: new SuperSpeed USB device number 3 using xhci_hcd
[    3.019396] usb 4-5: New USB device found, idVendor=04e8, idProduct=4001, bcdDevice= 1.00
[    3.019533] usb 4-5: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[    3.019629] usb 4-5: Product: PSSD T7
[    3.019714] usb 4-5: Manufacturer: Samsung
[    3.019798] usb 4-5: SerialNumber: S6XJNS0TB11633H
[    3.878340] usb 4-6: new SuperSpeed USB device number 4 using xhci_hcd
[    3.891358] usb 4-6: New USB device found, idVendor=04e8, idProduct=4001, bcdDevice= 1.00
[    3.891493] usb 4-6: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[    3.891592] usb 4-6: Product: PSSD T7
[    3.891673] usb 4-6: Manufacturer: Samsung
[    3.891758] usb 4-6: SerialNumber: S6TWNS1RC22768H
[    4.107501] usbcore: registered new interface driver usb-storage
[    4.115852] scsi host5: uas
[    4.119737] scsi host6: uas
[    4.123239] scsi host7: uas