Answer the question
In order to leave comments, you need to log in
Automount a USB drive via udev. Why does it turn off after 1-2 seconds?
There is RASPBERRY PI 3 with Raspbian Wheezy, purely console mode, X is not and is not needed.
The task is to automatically mount the USB drive, and regardless of the user's login, the drive is used by background processes.
Devices sda1, sdb1 are assigned to fstab - periodically the system defines them differently.
/dev/sda1 /media/exfat exfat defaults,noauto 0 0
/dev/sdb1 /media/exfat exfat defaults,noauto 0 0
ACTION=="add", KERNEL=="sd[ab][0-2]", RUN+="/bin/mount /dev/%k", OPTIONS="last_rule"
ACTION=="remove", KERNEL= ="sd[ab][0-2]", RUN+="/bin/umount /media/exfat"
[email protected]:/media# ls -la
ls: cannot access exfat: Transport endpoint is not connected
total 8
drwxr-xr-x 3 root root 4096 Jun 5 23:19 .
drwxr-xr-x 21 root root 4096 Apr 10 09:58 ..
d????????? ? ? ? ? ? exfat
Answer the question
In order to leave comments, you need to log in
In the process of checking various possible causes, it was possible to establish that such a problem exists only with exFAT and NTFS file systems. Drives with FAT32 are mounted normally. But you need exFAT (or NTFS, although it is undesirable) - 64GB drives.
The only thing left to do is to understand why exFAT automounting works crookedly, but manually works fine.
Checked through udevadm monitor - at FAT32 UDEV-event "change" does not appear.
Also, through "udevadm monitor --property" I checked all the data for "add" and "change" - everything is identical, i.e. in fact, there are no prerequisites for the appearance of "change".
UPDATE: I found a similar problem on several forums and supposedly it is that udev kills all child processes within 30 seconds. But still it is not clear what kind of connection is 30 seconds, and disappears after 1-2 seconds on the UDEV-event "change", and FAT32 works fine.
Nevertheless, I began to look for another solution, I did not use HAL due to obsolescence. Installed devmon from the udevil package, set it to autoload, everything works, there are no problems.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question