You are not logged in.

#1 2015-03-16 09:50:21

jvb
Member
Registered: 2015-03-16
Posts: 11

[SOLVED] Mount USB drive to specific directory with udisks2

Hello, I am trying to solve following challenge:

I have an USB drive, which I want always to (auto)mount to /data every time I connect it to USB port. Or better say, I want always to mount UUID=1d758d8a-1d09-4af2-a278-455149a7fac5 to /data.
I can for sure do that via fstab, but that does not solve my problem, when I disconnect the drive and then connect it to the same running system some moments later. Is it possible to wite udisks2.rules to treat specific UUID differently, so it mounts it to /data but other USB devices remain to be mounted under /run/media (private) or /media (shared)?

Or is my approach false? Can you suggest me different one?


Thank you

Last edited by jvb (2015-03-16 12:03:25)

Offline

#2 2015-03-16 10:01:07

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

Re: [SOLVED] Mount USB drive to specific directory with udisks2

For a similar purpose, I created a symlink from /run/media/tomk to ~/media. I always use labels on my removable devices, so when I plug them in, udisks2 mounts them on /run/media/tomk/<label>, and I access them at ~/media/<label>. Just change the symlink to /data and you should be fine.

Works with UUIDs also, of course.

Last edited by tomk (2015-03-16 10:05:40)

Offline

#3 2015-03-16 11:41:13

jvb
Member
Registered: 2015-03-16
Posts: 11

Re: [SOLVED] Mount USB drive to specific directory with udisks2

Thanks, if noone else will give me another suggestion, I will have to accept symlink as a solution for now.


edit: It seems that I was able to solve it much nicer way, than symlinking it.

I have added

UUID=1d758d8a-1d09-4af2-a278-455149a7fac5 /data   ext4    user,rw,noatime        0 2

to my /etc/fstab and it just works. It seems that udisks2 is respecting my fstab records and after physically disconnecting and reconnecting the drive, it gets properly mounted at /data, which is behavior that I desired. Caveat is, that I dont see an USB-DISK icon in filemanager (nemo), but I can live with that, since I can make a bookmark.

Last edited by jvb (2015-03-16 12:02:40)

Offline

Board footer

Powered by FluxBB