8

I know of the legacy Linux way of mounting a USB stick or drive: mount /dev/sdb1 /mnt/

But in some CentOS 6.x installations I saw, you just insert the USB stick and CentOS automagically mounts it, to /media/<VOLUMENAME>

This auto-sense must be handled by some kind of a daemon/service, right?

What is the name of that service and how do I find it using the /sbin/service command?

  • What desktop environment are you running? – Gilles 'SO- stop being evil' Apr 29 '13 at 23:53
  • 1
    @Gilles I am not running any desktop. My CentOS 6.4 based server boots to runlevel 3 and stays there. I am basically facing ae problem similar to the one described here. – Very Objective Apr 29 '13 at 23:55
  • 1
    That thread points to a tip involving a deamon named gnome-volume-manager, but I have no such file in my CentOS 6.4 system. What replaced it? – Very Objective Apr 30 '13 at 00:04
  • I believe the daemon that's automounting is part of the desktop, when in runlevel 3 this facility won't be available. – slm Apr 30 '13 at 00:15
  • If you're system is running in runlevel3 you most likely don't have any of the Desktop RPMs installed. – slm Apr 30 '13 at 00:33
  • 1
    I found the new name of gnome-volume-manager BTW. It's called gnome-disk-utility in CentOS6, I just confirmed that that RPM is in the default yum repos. This U&L Q lead me to it: http://unix.stackexchange.com/a/9067/7453. Do a yum search gnome-disk-utility* – slm Apr 30 '13 at 00:43

3 Answers3

7

As others have commented I don't believe this is possible in runlevel3. The application in question under GNOME 2.x is called gnome-volume-manager. You can reconfigure it a bit using gnome-volume-properties.

screenshot

            ss of gnome-volume-properties

Given you're in runlevel 3 I don't believe this is an option. You could however coax udev into doing the mounting for you in a similar fashion.

1. add a file automount.rules in /etc/udev/rules.d

2. add the following lines to automount.rules

automount.rules

# automounting usb flash drives
# umask is used to allow every user to write on the stick
# we use --sync in order to enable physical removing of mounted memory sticks -- this is OK for fat-based sticks
# I don't automount sda since in my system this is the internal hard drive
# depending on your hardware config, usb sticks might be other devices than sdb*
ACTION=="add",KERNEL=="sdb*", RUN+="/usr/bin/pmount --sync --umask 000 %k"
ACTION=="remove", KERNEL=="sdb*", RUN+="/usr/bin/pumount %k"
ACTION=="add",KERNEL=="sdc*", RUN+="/usr/bin/pmount --sync --umask 000 %k"
ACTION=="remove", KERNEL=="sdc*", RUN+="/usr/bin/pumount %k"

3. reload the udev rules:

udevadm control --reload-rules

gome-disk-utility

I found the new name of gnome-volume-manager BTW. It's called gnome-disk-utility in CentOS6, I just confirmed that that RPM is in the default yum repos.

This U&L Q lead me to it: USB storage devices aren't automatically mounted when inserted on a fresh install of Debian 6.0.

Do the following command to find it:

$ yum search gnome-disk-utility*
gnome-disk-utility-devel.i686 : Development files for gnome-disk-utility-libs
gnome-disk-utility-devel.x86_64 : Development files for gnome-disk-utility-libs
gnome-disk-utility-ui-devel.i686 : Development files for gnome-disk-utility-ui-libs
gnome-disk-utility-ui-devel.x86_64 : Development files for gnome-disk-utility-ui-libs
gnome-disk-utility.x86_64 : Disk management application
gnome-disk-utility-libs.i686 : Shared libraries used by Palimpsest
gnome-disk-utility-libs.x86_64 : Shared libraries used by Palimpsest
gnome-disk-utility-ui-libs.i686 : Shared libraries used by Palimpsest
gnome-disk-utility-ui-libs.x86_64 : Shared libraries used by Palimpsest

References

slm
  • 369,824
0

Another option is to use pmount. It seems a little easier to use commonly. However it requires installing (from the EPEL repository).

CentOS Forum on pmount

wattahay
  • 121
0

A good command-line method for doing automount is the 'autofs' package.

You need to specify two things, in two different files:

/etc/auto.master

# USB backup drives
/mnt/offsite            /etc/auto.offsite       --timeout=300

/etc/auto.offsite

OFFSITE1 -fstype=auto,rw,noatime,data=journal,commit=1 :/dev/disk/by-uuid/b5c1db0d-776f-499b-b4f2-ac53ec3bf0ef

The result is that when the USB drive is attached, it will appear at /mnt/offsite/OFFSITE1. It will not show up until you access something under that path, such as doing a "ls" or "find". After 300 seconds of inactivity, it will automatically dismount the file system (making it safe to remove).

tgharold
  • 283