[Solved] What's unmounting my USB disks?

Post Reply
Nuems
Posts: 169
Joined: Thu Sep 19, 2013 3:50 am
languages_spoken: english, german
ODROIDs: xu, c1, n2
Has thanked: 2 times
Been thanked: 15 times
Contact:

[Solved] What's unmounting my USB disks?

Post by Nuems »

Context:
For a couple of years, I've been using a udev rule (inspired by a post on the German debian forum - https://debianforum.de/forum/viewtopic. ... 0#p1002121 ) and a script on my Odroid-XU (headless Debian8) to do the following things when a USB drive is connected:
*create a directory called <partition label> in /media unless it already exists
*mount the partition there
*share it via NFS and CIFS
This works like a charm. In theory, this mechanism is also supposed to clean up on removal of the drive, however, that doesn't work so well ... (different story) :(

Current problem:
I'm trying to move all servers to my brand new N2 (running @tobetter's Ubuntu 20.04). So I tried to use my udev rule and script there as well which only sort of works:
Drives are mounted, but then something umounts them almost immediately.
At first I thought that there's something wrong with my udev rule or my script, so I put an additional line at the script's end

Code: Select all

mount > /tmp/mountlog
Lo and behold - in that log file, I can always see that the drive is mounted - for a second or so. I haven't been able to see it as a human user, though, because unmounting occurs too quickly. What's more, I can't find anything in the logs.
I'd appreciate any input because I'm out of ideas.
Last edited by Nuems on Sun Sep 13, 2020 12:45 am, edited 1 time in total.

User avatar
tobetter
Posts: 5878
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 248 times
Been thanked: 718 times
Contact:

Re: What's unmounting my USB disks?

Post by tobetter »

Have you tried with out your udev rule but with a package 'usbmount'?

Nuems
Posts: 169
Joined: Thu Sep 19, 2013 3:50 am
languages_spoken: english, german
ODROIDs: xu, c1, n2
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: What's unmounting my USB disks?

Post by Nuems »

Not yet, but I'll try. Thanks.

Edit:
Hm. My first impression is mixed:
*the package might be broken. I could rebuild it from git, however:
*usbmount from the repositories doesn't seem to mount a usb drive if it is already connected during boot - a udev rule does.
*mounting to /media/usb<0-7> instead of /media/<partition-label> is going to be confusing and makes scripting quite a bit more complex. I'll have to look at the detailled configuration options, though.

Nuems
Posts: 169
Joined: Thu Sep 19, 2013 3:50 am
languages_spoken: english, german
ODROIDs: xu, c1, n2
Has thanked: 2 times
Been thanked: 15 times
Contact:

Re: What's unmounting my USB disks?

Post by Nuems »

While I still don't know what exactly unmounted my usb drives*, I've found a solution on serverfault.com. As far as mounting usb drives is concerned, this is exactly what I need.

*Apparently, it's somehow systemd related, because that's the main difference between my prior solution and this one.
These users thanked the author Nuems for the post:
odroid (Mon Sep 14, 2020 9:42 am)

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 3 guests