LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   udev automounts but I cannot manually unmount: Debian Testing (https://www.linuxquestions.org/questions/linux-newbie-8/udev-automounts-but-i-cannot-manually-unmount-debian-testing-887276/)

mike11 06-20-2011 03:10 AM

udev automounts but I cannot manually unmount: Debian Testing
 
Hi,

I'm using udev to automount an external usb HDD to a fixed location.
This works fine, but when I try to unmount the drive, as a user, I'm getting the error:
Code:

umount: /media/myusb is not in the fstab (and you are not root)
Here is the udev rule I've put in /etc/udev/rules/60-local.rules:
Code:

ATTRS{vendor}=="I-O DATA", ATTR{partition}=="1", ACTION=="add", OWNER="mike", GROUP="mike", RUN="/bin/mount -o user /dev/%k /media/myusb"
Although I'm running mount with the user option, and specifying my group and user on the udev rule, I still cannot unmount the drive.

Adding an entry to /etc/fstab doesn't make sense since, as I understand, fstab is supposed to be for non-removable drives only.

Any ideas?.

TIA.

zakotsi 06-20-2011 03:47 AM

Quote:

Originally Posted by mike11 (Post 4390508)
Hi,

Adding an entry to /etc/fstab doesn't make sense since, as I understand, fstab is supposed to be for non-removable drives only.

Any ideas?.

TIA.

I try to avoid using automounts for removable disks as some times had similar problems.

No /etc/fstab is not only for non-removable devices. If you like check my fstab for a removable usb stick (fat32):

<file system>||<mount point>||<type>||<options>||<dump>||<pass>
/dev/sdX||/mnt/usb_sdX||auto||rw,user,noatime,noauto||0||0

(sorry for the very bad quoting but using || as a separator was the best I could make up).

I have made myself member of group user and mount is done as simple as:
mount /dev/sdX

If you have ext2,ext3,ext4 or any other filesystem just replace auto (in <type>)

Unmount with:
umount /dev/sdX

I use openbox so I have no automounter running in the background, but I think using an entry similar to mine (mount point could be anything you want i.e. /mnt/sdX which you create as root but i thing you know all these...)

You can also try to just make yourself member of user group and replace owner (delete group?) with "user". It might do the trick.

Good luck..

mike11 06-20-2011 08:53 PM

Thanks for replying. I think "user" is not a group, but an option for the mount command, from the mount manpage:
Code:

The non-superuser mounts.
Normally,  only the superuser can mount filesystems.  However, when fstab contains the user option on a line, anybody can mount the corresponding system. Thus, given a line
/dev/cdrom  /cd  iso9660  ro,user,noauto,unhide
any user can mount the iso9660 filesystem found on his CDROM using the command

It seems the problem is that umount looks for an entry in fstab, but there is none, as udev is used for hotplugging.
A few webpages mention fstab is intended for non-removable disks, and the manpage says:
Code:

fstab - static information about the filesystems
so it's desgined for non-changing disks.

So this seems like a broken end: udev can dynamically mount the device without an entry in fstab, but then I cannot unmount the device as a user since there is no entry in the fstab. I can unmount as su, but that's tedious.

Any ideas?.
TIA.

zakotsi 11-09-2011 06:33 AM

Hi,
again after a long long time. If you have found a solution I am happy for you. The problem is as you say that udev gets in your way. I chose to not use it at all and solved the problem (many many times I couldn't copy content as I saw "permission denied" notifications). Unfortunately even if you enter the info I suggested in fstab If you have udev automounting the device you will not be able to unmount it (it seems udev gets the upper hand on this).

A suggestion (I have not tried this): make your user member of udev group (if it exists).

Best of lack....


All times are GMT -5. The time now is 04:49 PM.