LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices



Reply
 
Search this Thread
Old 06-10-2011, 06:21 PM   #1
nokangaroo
Member
 
Registered: Nov 2009
Posts: 140

Rep: Reputation: 23
Automounting usb drives in KDE?


I just installed KDE, because Lubuntu/Openbox is just too unstable (The panels crash all the time). I'll get used to KDE, especially as konsole does not automatically quote anything that's dragged into it, and gwibber and ubuntuone are not installed by default (Also, video works without fracture lines!).

So far, so good. But how do I automount usb drives in /media when booted from an external disk? I just noticed that /home (/dev/sdb5 in this case) is mounted in /media, where it has absolutely no business. This also means that my backup scripts won't work. How can I fix this?
 
Old 06-10-2011, 06:50 PM   #2
nokangaroo
Member
 
Registered: Nov 2009
Posts: 140

Original Poster
Rep: Reputation: 23
Solved - installed usbmount and copied the following udev rule, named 69-local.rules, to /etc/udev/rules.d:


# Leave sda to fstab
KERNEL!="sd[b-z]*", GOTO="media_by_label_auto_mount_end"
# If booted from /dev/sdb with home on /dev/sdb5:
# KERNEL!="sd[c-z]*", GOTO="media_by_label_auto_mount_end"
# KERNEL=="sdb5", GOTO="media_by_label_auto_mount_end"

# Handling only ext4 partitions; better leave this commented out
# ENV{ID_FS_TYPE}!="ext4", GOTO="media_by_label_auto_mount_end"

# Import FS info
IMPORT{program}="/sbin/blkid -o udev -p %N"

# Get a label if present, otherwise specify one
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"

# Mount options
ACTION=="add", ENV{ID_FS_TYPE}=="ext3|ext4", ENV{mount_options}="rw,nodev,nosuid,relatime,acl,uhelper=udisks"
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="rw,relatime,utf8,gid=100,umask=002,uhelper=udisks"
ACTION=="add", ENV{ID_FS_TYPE}=="hfsplus", ENV{mount_options}="rw,nosuid,nodev,uhelper=udisks"

# Mount the device
ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -t %E{ID_FS_TYPE} -o %E{mount_options} /dev/%k /media/%E{dir_name}"

# Clean up after removal
ACTION=="remove", RUN+="/bin/umount /dev/%k", RUN+="/bin/rmdir /media/%E{dir_name}"

# Exit
LABEL="media_by_label_auto_mount_end"


Many thanks to the archlinux people - found the original of this on https://wiki.archlinux.org/index.php/Udev

"Safely remove drive" will work with kde, but it did not work in GNOME.

Last edited by nokangaroo; 06-10-2011 at 07:53 PM.
 
  


Reply

Tags
automount, kde, usb


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Something other than ivman automounting my drives William (Dthdealer) Linux - Software 2 04-25-2010 08:46 PM
automounting CD-ROMs USB drives kushalkoolwal Debian 28 05-14-2006 07:18 PM
automounting pen drives saini_mw Linux - Hardware 2 04-03-2006 01:33 AM
Kde 3,5 automounting usb on desktop staticblackz Debian 1 12-13-2005 05:37 AM
Automounting Raid drives voldermort Linux - Newbie 3 10-02-2003 10:52 AM


All times are GMT -5. The time now is 07:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration