You are not logged in.

#1 2011-11-25 21:35:44

axs
Member
Registered: 2009-01-23
Posts: 71
Website

udev: add mountpoints for removable devices

Yet another solution to the removable devices problem.

After a minor system overhaul I finally decided to get rid of a bunch of static mountpoints I had in /mnt. I checked Arch wiki, and what I saw there, well, raised some questions. I mean, it's udev, it's not supposed to be pretty, but pmount with a fixed user, as a recommended solution? Ugh.

So I came up with a perl script that modifies /etc/fstab dynamically and creates mountpoints under /mnt, but doesn't actually mount anything. This way user mounts do not require any specific handling, and overall it looks nice and simple.

To my slight surprise I couldn't find any good scripts that would do this even outside of the wiki (which is strange, btw, because the solution is obvious), so I decided to put it here. Maybe I'm not the only one who thinks auto-mounting is never a good thing.

https://raw.github.com/nkf/udevh/master/udevh-sd | https://raw.github.com/nkf/udevh/master/README

Comments, suggestions etc. are welcome.
Please check the source and udev rules before doing anything, it's fstab after all.

Offline

#2 2011-11-25 23:04:15

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: udev: add mountpoints for removable devices

As long as you're happy..... smile

I'll just respond to your opinion that "the solution is obvious":

fstab man page wrote:

fstab - static information about the filesystems

default /etc/fstab wrote:

# /etc/fstab: static file system information

fstab man page (again) wrote:

fstab is only read by programs, and not written; it is the  duty of the system administrator to properly create and maintain this file.

Also, the kludgy automount suggestions on the udev page - pmount with fixed user ZOMG - are deprecated now in favour of udisks-based setups.

Offline

#3 2011-11-26 00:06:05

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: udev: add mountpoints for removable devices

axs wrote:

which is strange, btw, because the solution is obvious), so I decided to put it here. Maybe I'm not the only one who thinks auto-mounting is never a good thing.

I think you're in the minority of folks who think dynamically modifying a system config file as crucial as /etc/fstab is a good thing.

Offline

#4 2011-11-26 06:56:16

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: udev: add mountpoints for removable devices

With the above. Fstab is static, hacking that is just so counterproductive. There's nothing more easy than udisks - and there are plenty of frontends to it, like udiskie.

https://wiki.archlinux.org/index.php/Udiskie

Reinventing the wheel is not always necessary wink.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#5 2011-11-26 13:50:53

axs
Member
Registered: 2009-01-23
Posts: 71
Website

Re: udev: add mountpoints for removable devices

tomk wrote:

As long as you're happy.....

Well, yeah. I'm not a big fan of the current udev implementation, but this time it all worked very well.

As for the man page, well, it's not really set in stone. Ok, I admit I didn't read it, in Arch at least, but anyway, there must be reasons to call it static. mount is a simple tool, it's clear how it works, that's the only file it reads, and I see no intrinsic features in mount that would require fstab to be static. I'd say it's more of an self-imposed challenge to treat it as static, and not a necessity. At least for current implementation of mount, and current format of fstab, with "user", "users" etc.

Also, the kludgy automount suggestions on the udev page - pmount with fixed user ZOMG - are deprecated now in favour of udisks-based setups.

Maybe it should be removed then, or at least clearly labeled as deprecated?
Because when you read the page, it comes as a suggested solution. And udisks, well, I skipped that section at all, partly because it was above "Auto mounting USB devices", and party because it talks about KDE, Gnome and automounting.

Oh, and btw: I've just noticed that the fixed user in that example is "tomk" ;-)

falconindy wrote:

I think you're in the minority of folks who think dynamically modifying a system config file as crucial as /etc/fstab is a good thing.

Somewhat off-topic, but /etc/fstab is one of the least critical files in the system, and one of the easiest to fix.
I didn't check with the current version, but if I'd was unable to boot without fstab, I'd call it a bug in initscripts.

.:B:. wrote:

There's nothing more easy than udisks - and there are plenty of frontends to it, like udiskie. (...) Reinventing the wheel is not always necessary.

Well, I'm reading about udisks now, and the problem is, when I want a wheel, I want a wheel, not a Segway.
I like my system to be simple (arch way and all), while this thing wants d-bus, polkit, some frontends and org.freedesktop.stuff.die.must.java style configuration variables just to be able to type "mount /mnt/sda1". Easy, maybe, for a given values of "easy"; simple, anything but.

Offline

#6 2011-11-26 15:56:30

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,688
Website

Re: udev: add mountpoints for removable devices

.:B:. wrote:

https://wiki.archlinux.org/index.php/Udiskie

Reinventing the wheel is not always necessary wink.

I'm confused... how is xfce4 out-of-the-box aware of usb drives when inserted?


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#7 2011-11-26 19:05:10

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: udev: add mountpoints for removable devices

How am I supposed to know? I don't even use it tongue.

And I didn't mention Xfce as far as I recall hmm

Last edited by .:B:. (2011-11-26 19:05:40)


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

Board footer

Powered by FluxBB