Hello there,
For many years I had a working config for my 5 HDDs SATA connected to a power switch and my USB/SATA bay.
For some reason, I can’t write on some of them and I have to fix it.
General question:
Nowadays, what is the best practice to automount rw SATA HDDs on-demand when I switch it on or when I plug and switch on a HDD in my USB bay?
I know I can use or autofs/auto.master or fstab. what is the best way?
Many thanks
I use automount through systemd for NFS, but you can of course adopt the entry for a local device.
boven.henm.xs4all.nl:/home/wij /home/wij nfs noauto,nofail,x-systemd.automount,x-systemd.mount-timeout=10,x-systemd.idle-timeout=5min 0 0
The extra options are:
- noauto because we refrain from mounting at boot;
- nofail as an extra, may not be needed;
- x-systemd.automount to let systemd-automount do it’s work: mount when required;
- x-systemd.mount-timeout=10 time before it errors because of e.g. NFS server down;;
- x-systemd.idle-timeout=5min after 5 minutes of no usage the fs will be unmounted (to be mounted auto at next access)
See also:
man systemd.automount
man systemd.mount
Thank you, I’ll remove my old way (autofs) and change to fstab.
Just a question; Iin the man, I can’t understand the practical difference between
x-systemd.mount-timeout=
and
x-systemd.device-timeout=
I have seen one or other in example. Should I write the both?
Hm, while they are different it is unclear to me what this means in reality. I doubt the device one is useful in my NFS mount, but you have hardware devices.
I guess, a bit of testing might help you without being dangerous.
I got the anwser from Grok with the question:
linux, in fstab file, systemd command
What is the difference between the option
x-systemd.mount-timeout=
and
x-systemd.device-timeout=
A bit long to copy here.
Short:
x-systemd.device-timeout=
For network and any mount where the device node might be missing at first
x-systemd.mount-timeout=
For any case where the device exists but mount hangs/takes forever
Many thanks for your help
I made some tests but it seems to be not very handy for my usage.
With autofs, when I started Opensuse without the spare HDD, I didn’t see the mount point in the file manager (Caja/Nautilus). When needed, I switched on the HDD and it appeared in the leff side of Caja with the little arrow to unmount it.
With fstab, when I switch on the HDD nothing appears. I have to create a bookmark but the bookmark is always visible and I can’t guess if the HDD is mounted or not. Moreover there is not way in Caja to unmount it.
If I can’t get a better interface, fstab is not what I need.
Any idea ?
@MrNice In Nautilus if I plug in a USB device it appears fine, if I have a bookmark and connect, it shows up at the bottom and the ability to unmount just like USB devices. This sounds like a bug with caja?
Yes, with a USB device, it shows up but not with SATA.
fstab for theses device is
# On-demand SATA HDD mount
UUID=e36711e7-67c4-460c-b002-529e09e7c792 /mnt/Store1 ext4 noauto,nofail,x-systemd.automount,x-systemd.mount-timeout=10,x-systemd.idle-timeout=10min 0 0
I use MATE that include Caja. Do you think I should try Nautilus? Is there any incompatibility to install it beside Caja?
@MrNice from memory there maybe a udev rule that is hiding the SATA devices… I would suggest running udevadm monitor and then attach the SATA device and check output.
~> udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent
KERNEL[9572.585133] add /devices/virtual/devlink/:ata3--scsi:2:0:0:0 (devlink)
KERNEL[9572.585570] add /devices/pci0000:00/0000:00:02.1/0000:01:00.1/ata3/host2/target2:0:0 (scsi)
KERNEL[9572.585686] add /devices/pci0000:00/0000:00:02.1/0000:01:00.1/ata3/host2/target2:0:0/2:0:0:0 (scsi)
KERNEL[9572.585722] add /devices/pci0000:00/0000:00:02.1/0000:01:00.1/ata3/host2/target2:0:0/2:0:0:0/scsi_device/2:0:0:0 (scsi_device)
KERNEL[9572.585818] add /devices/pci0000:00/0000:00:02.1/0000:01:00.1/ata3/host2/target2:0:0/2:0:0:0/scsi_generic/sg0 (scsi_generic)
KERNEL[9572.585882] add /devices/pci0000:00/0000:00:02.1/0000:01:00.1/ata3/host2/target2:0:0/2:0:0:0/scsi_disk/2:0:0:0 (scsi_disk)
KERNEL[9572.585922] add /devices/pci0000:00/0000:00:02.1/0000:01:00.1/ata3/host2/target2:0:0/2:0:0:0/bsg/2:0:0:0 (bsg)
KERNEL[9572.586886] add /devices/virtual/bdi/8:0 (bdi)
UDEV [9572.591506] add /devices/virtual/devlink/:ata3--scsi:2:0:0:0 (devlink)
UDEV [9572.592425] add /devices/pci0000:00/0000:00:02.1/0000:01:00.1/ata3/host2/target2:0:0 (scsi)
UDEV [9572.593303] add /devices/pci0000:00/0000:00:02.1/0000:01:00.1/ata3/host2/target2:0:0/2:0:0:0 (scsi)
UDEV [9572.593319] add /devices/virtual/bdi/8:0 (bdi)
UDEV [9572.594115] add /devices/pci0000:00/0000:00:02.1/0000:01:00.1/ata3/host2/target2:0:0/2:0:0:0/scsi_device/2:0:0:0 (scsi_device)
UDEV [9572.594297] add /devices/pci0000:00/0000:00:02.1/0000:01:00.1/ata3/host2/target2:0:0/2:0:0:0/scsi_disk/2:0:0:0 (scsi_disk)
UDEV [9572.594429] add /devices/pci0000:00/0000:00:02.1/0000:01:00.1/ata3/host2/target2:0:0/2:0:0:0/scsi_generic/sg0 (scsi_generic)
UDEV [9572.594715] add /devices/pci0000:00/0000:00:02.1/0000:01:00.1/ata3/host2/target2:0:0/2:0:0:0/bsg/2:0:0:0 (bsg)
KERNEL[9572.623096] add /devices/pci0000:00/0000:00:02.1/0000:01:00.1/ata3/host2/target2:0:0/2:0:0:0/block/sda (block)
KERNEL[9572.623140] add /devices/pci0000:00/0000:00:02.1/0000:01:00.1/ata3/host2/target2:0:0/2:0:0:0/block/sda/sda1 (block)
KERNEL[9572.623167] bind /devices/pci0000:00/0000:00:02.1/0000:01:00.1/ata3/host2/target2:0:0/2:0:0:0 (scsi)
UDEV [9572.787804] add /devices/pci0000:00/0000:00:02.1/0000:01:00.1/ata3/host2/target2:0:0/2:0:0:0/block/sda (block)
UDEV [9572.916645] add /devices/pci0000:00/0000:00:02.1/0000:01:00.1/ata3/host2/target2:0:0/2:0:0:0/block/sda/sda1 (block)
UDEV [9572.917215] bind /devices/pci0000:00/0000:00:02.1/0000:01:00.1/ata3/host2/target2:0:0/2:0:0:0 (scsi)
What do you see?
I tried Nautilus, same issue
When no file manager window is open and I switch on the HDD, there is no new window
@MrNice So it’s sda1 that is hot plugged? I would suggest a visit to the MATE and Caja folks upstream for pointers.
Yes, this is the first I switched on. Nothing appears in Caja, even no window show up.
Do you have any link to MATE forum/support, I can’t find one. Only IRC but nobody is there.
Contact details here https://en.opensuse.org/Portal:MATE
For reference, after lot of reading:
This issue is due to my bad command in fstab
noauto,x-systemd.automount
tells systemd:
•
Do not mount at boot
•
Do not mount when the device appears
•
Mount only when something accesses /mnt/Store1
Caja shows nothing
With these commands, it is the expected behavior.
Moreover to get a good Caja integration prefer /run/media/{$USER}/myHDD as mount point.
The command should be:
UUID=e36711e7-67c4-460c-b002-649e9e792 /run/media/user1/Store1 ext4 nofail,x-systemd.idle-timeout=10min 0 0
Thanks for you time
Re-reading your original question in the title and the first post, there was no mention at all of something named “caja”.
Thus I gave you the solution that answers exactly to want you mention:
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.