Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Desktop
User Name
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.


  Search this Thread
Old 06-10-2011, 05:21 PM   #1
Registered: Nov 2009
Posts: 141

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, 05:50 PM   #2
Registered: Nov 2009
Posts: 141

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

Many thanks to the archlinux people - found the original of this on

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

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


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 07:46 PM
automounting CD-ROMs USB drives kushalkoolwal Debian 28 05-14-2006 06:18 PM
automounting pen drives saini_mw Linux - Hardware 2 04-03-2006 12:33 AM
Kde 3,5 automounting usb on desktop staticblackz Debian 1 12-13-2005 04:37 AM
Automounting Raid drives voldermort Linux - Newbie 3 10-02-2003 09:52 AM

All times are GMT -5. The time now is 12:03 PM.

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