You are not logged in.

#1 2009-07-10 19:38:06

oib111
Member
Registered: 2009-06-20
Posts: 87

Automounting USB Devices

I was wondering if th ere was a way I could make Arch automatically mount USB devices? It's quite annoying that everytime I plug in my flash drive I  have to manually mount it.

Offline

#2 2009-07-10 20:48:36

Blayder
Member
Registered: 2006-07-29
Posts: 43

Re: Automounting USB Devices

if i'm correct - the easiest way would be:
- install hal (pacman -S hal)
- add it to daemons array in rc.conf
and basicaly thats all you must do...
http://wiki.archlinux.org/index.php/HAL

Offline

#3 2009-07-10 21:12:04

oib111
Member
Registered: 2009-06-20
Posts: 87

Re: Automounting USB Devices

It's ok I actually looked deeper into the HAL wiki page and noticed the bit about AutoFS so I installed that.

Offline

#4 2009-07-10 21:35:28

djszapi
Member
From: Cambridge, United Kingdom
Registered: 2009-06-14
Posts: 1,439
Website

Re: Automounting USB Devices

Or you can put the desired device in the /etc/fstab or the desired command to /etc/rc.local too.

Offline

#5 2009-07-10 22:52:02

oib111
Member
Registered: 2009-06-20
Posts: 87

Re: Automounting USB Devices

Well, it probably won't be in the same place the whole time, and I may have more than one. For example right now it would be sdb (I took out one hard drive), but if i put that back in it'd be sdc, and if I put another in it would either be sdc or sdd (depending if the hard drive is in). Would I be able to accommodate that?

Offline

#6 2009-07-11 04:23:45

kgas
Member
From: Qatar
Registered: 2008-11-08
Posts: 718

Re: Automounting USB Devices

which file manager are you using? If you use GNOME DE and nautilus as fm to take care of USB auto mounts. As Blayder said you need hal also. If you are using pcmanfm .fdi rules to be set correctly to read / write the USB drives and also ntfs-3g to take care  of ntfs paritions.

Offline

#7 2009-07-11 06:38:04

oib111
Member
Registered: 2009-06-20
Posts: 87

Re: Automounting USB Devices

I'm using Wmii.

Offline

#8 2009-07-11 10:17:04

nbvcxz
Member
From: Poland
Registered: 2007-12-29
Posts: 202

Re: Automounting USB Devices

You DON'T NEED TO USE HAL OR AUTOFS or any other of this crap. However some people like to have 1000 daemons running in their system in your case the solution is simple - you can use only UDEV. So please create the file /etc/udev/rules.d/10-my_mount.rules (can be other filename) that consist:

KERNEL=="sd[a-z]", NAME="%k", SYMLINK+="usbhd-%k", GROUP="users", OPTIONS="last_rule" 
ACTION=="add", KERNEL=="sd[a-z][0-9]", SYMLINK+="usbhd-%k", GROUP="users", NAME="%k" 
ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mkdir -p /media/usbhd-%k" 
ACTION=="add", KERNEL=="sd[a-z][0-9]", PROGRAM=="/lib/udev/vol_id -t %N", RESULT=="vfat", RUN+="/bin/mount -t vfat -o rw,noauto,flush,quiet,nodev,nosuid,noexec,noatime,dmask=000,fmask=111 /dev/%k /media/usbhd-%k", OPTIONS="last_rule" 
ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mount -t auto -o rw,noauto,sync,dirsync,noexec,nodev,noatime /dev/%k /media/usbhd-%k", OPTIONS="last_rule" 
ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/umount -l /media/usbhd-%k" 
ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/rmdir /media/usbhd-%k", OPTIONS="last_rule"

All your usb stick will be auto mounted in /media

Last edited by nbvcxz (2009-07-11 15:51:17)


Lenovo G50 | LXQT-git | compton | conky

Offline

#9 2009-07-11 11:34:11

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,523

Re: Automounting USB Devices

"-t vfat" might not be necessary, mount will try to guess the file system

F


do it good first, it will be faster than do it twice the saint wink

Offline

Board footer

Powered by FluxBB