On Sun, 2020-07-12 at 10:10 +0300, Angelo Moreschini wrote:
Hi,
I made a script that (using rsync <linux utility>) run a backup of some
(particular) data of my computer.
I use an external USB-HD to store data of the backup and, of course, I need
to mount this HD-device before.
A problem come because systemd-udevd automatically mount plugged USB
devices when they are connected to computer.
I my “simple” mind, I fund that this automatically mounted point is”
*/run/media/$USER/partition_label (...this says Gparted…).*
You can change that by adding an fstab entry. I use this for example:
UUID=6cb66da2-147a-4f3c-a513-36f6164ab581 /raid ext4
rw,noauto,user 1 1
and the mount happens automatically when the device is plugged in.
This in OK! (this is working) ! But this is only a my empiric
solution to
the problem, and looking for <”linux how to manually unmounting the
automatically mounted usb device by system-udevd”> I didn't find nothing
*exactly* appropriate for my problem.
I know that are different solutions (using udev rules) to manage the
automatic montage of devices, but since I already have a good script that
work, I only would like find an “official instruction” for the problem to
manually unmout automatically mounted USB devices by systemd-udev.
How does the system know to unmount the drive unless you tell it? There
are some ways to handle putting disks into standby mode after a timeout
(see udisks(8)) but it's not clear if they'll work with USB devices.
In my case, I just explicitly unmount the drive within the backup
script. I don't know if there's really a better way to do it.
poc