I need an SD card to be mounted unattended, as soon as it is inserted in its slot. Usual enough, but the prbm is it does not get mounted and I am missing why.
In /etc/fstab
:
#Entry for /dev/mmcblk0p1 :
UUID=_____ /mnt/SD-root ext3 defaults,nofail,umask=0027,utf8,comment=x-gvfs-show,x-gvfs-name=SD-root 0 2
EDIT-1: I also tried replacing /mnt/
with /media/myname/
above, and including the options user,uid=1000
(that's me) or users
, to no avail.
Mount point is either /mnt/SD-root
or /media/myname/SD-root
. Mountpoint ownership is set to "root : adm".
$ ls -Al /mnt/ | grep -e 'SD-root'
1 drwxr-x--- 3 root adm 1024 Sep 25 16:51 SD-root/
Right now the only way for a non-root user to mount the SD card is to:
$ sudo mount /dev/mmcblk0p1 /mnt/SD-root/
What am I missing ?
Best Answer
To mount the card automatically at
/mnt
in a running system you could use an additionaludev
rule. Without the rule, the card is mounted in/media/$USER/…
and/dev/disk/…
.The following script and udev rule create a folder in
/mnt
and mount a the partition with a defined UUID. In the current version, the mountpoint is the label of the mounted partition. I personally think, that's a bad idea. I would prefer the UUID and not the label, but the OP wanted this solution.The script
Create a script in
/usr/local/bin
Add the code below
Make the script executable
The udev rule
Create a new rule
Add the code below
or if your drive hasn't the
ID_PART_ENTRY_NAME
, tryID_FS_LABEL
Suppose that the partition is
/dev/sdc1
Replace the value forENV{ID_FS_UUID}==
above with the output ofRestart udev
Plugin your SD card and you should see something like this