I'm running a headless server, so no GUI, just ssh logins. I don't seem to
have the mechanism that automounts USB drives to a subdirectory of /media,
and from googling around I think that's a feature of a GUI-based system.
What implements it? Right now I manually create a mountpoint in /mnt and
then manually mount by label from /dev/disk/by-label after plugging the
drive in. It would be convenient if the drive automounted when plugged in.
Comments
Re: text-mode system and /media
By Benjamin Hackl at 06/07/2011 - 05:13I'd recommend automount. I think it is installed by default.
Have a look at /etc/auto.misc
Just add an entry like
foobar -mountoptions :/dev/disk/by-label/foobar
which would mount your device as /misc/foobar
Also check /etc/auto.master and man {autofs,automount,auto.master}
Don't forget to
chkconfig autofs on
Brgds
Re: text-mode system and /media
By John R Pierce at 06/07/2011 - 00:38On 06/06/11 7:31 PM, Kenneth Porter wrote:
indeed, this is a ongoing peeve of mine with linux. getting wireless
networking functioning without those GUI helpers is a real pain too.
this stuff should all be implemented in underlying daemons, with both
text and GUI control surfaces.
Re: text-mode system and /media
By Ljubomir Ljubojevic at 06/07/2011 - 09:42John R Pierce wrote:
"iwlist ath0 scanning will list all available AP's in range so you can
choose ESSID for system-config-network config screen (it should work in
console mode.
Ljubomir)
Re: text-mode system and /media
By Robert Heller at 06/06/2011 - 23:58The problem is this: you also need some way to unmount the disk. And
for FAT file systems, you need to somehow map the ownership. The GUI
does the mount in the logged in user and the [GNome] desktop icon
includes a right-click menu with an 'eject' / 'unmount' item.
Delegate this functing to some daemon running as root or to a hotplug
script (which would also be running as root), would be problematical for
obvious reasons.
Question are these random thumb drives? Or are they magnetic drives? Are
then always connected? Regularly connected? FAT file systems? Ext2/3
file systems?
There are several options:
One option is to include a line in /etc/fstab like this:
/dev/thumb /media/thumb auto noauto,user,rw 0 0
(/dev/thumb in this case is created by this udev rule:
KERNEL=="sd[a-z]*", BUS=="scsi", SYSFS{device/vendor}=="Kingston", NAME="thumb"
disk-by-label is not possible since this disk is formatted FAT)
This disk is still manually mounted and dismounted, but a
non-priviledged user can do the mount and unmount and only the mount
point is used.
The other option is to use automount with lines like this in an
automount config file:
/reposi386 -fstype=ext2 :LABEL=REPOSI386
/reposx86_64 -fstype=ext2 :LABEL=REPOSX86_64
(these are 16gig thumb drives reformatted with labeled ext2 file systems)
These drives are mounted on-demand and auto dismount after period of
idleness.
Re: text-mode system and /media
By Kenneth Porter at 06/07/2011 - 01:40--On Tuesday, June 07, 2011 12:58 AM -0400 Robert Heller
In my case they're all magnetics with ext3 logical drives, so they show up
with labels.
My practice has been to label them "Backup1", "Backup2", etc. and then
"mount /dev/disk/by-label/Backup1 /mnt/Backup1". Or list all the
possibilities in /etc/fstab so I can just name the mount point in the mount
command.
An additional complication is that some USB drives spin down after some
idle time, and don't spin back up when accessed, leading to errors and FS
corruption. I've used "hdparam -s 0 --prefer-ata12 /dev/sdb" (for example)
but some drives ignore that, so I end up needing to start a script that
touches a file and sync's every few seconds.