[CentOS] How to trigger automount of USB drives in Centos6

Wed Aug 1 06:10:25 UTC 2012
Earl Ramirez <earlaramirez at gmail.com>

On 1 August 2012 14:49, Emmanuel Noobadmin <centos.admin at gmail.com> wrote:

> In brief: Is there is anyway to trigger the same automount mechanism,
> that X appears to use, on unmounted USB drives that are already
> connected?
> Background:
> I've got a C6 server with default desktop GUI installed for the sake
> of the onsite admin. There is a bash script I wrote that runs every
> night checking for specific folders on any drive and dumps data into
> it.
> To ensure fs integrity, I do an unmount in the script when it's done
> in case anybody simply yanks the drive out without doing the proper
> process.
> Now due to that, I would need to remount the drive when the script
> runs if it wasn't unplugged and replugged to trigger the automount.
> Problem is, it is not certain that the same drive will be used so I
> cannot simply hard code a line that just do a mount -t ntfs-3g
> /dev/sde1 /media/backup. I cannot assume it would always be say
> /dev/sde1 or /dev/sdf2 as that depends on how many drives are
> connected before that and how was that particular drive partitioned.
> The inbuilt auto mount mechanism also appears to use different
> mountpoints for different USB drives (based on drive label?) and so
> the best way for me is to force all USB drives to be remounted, and
> scan through the /media folder as that is where the automount mounts
> the partitions.
> I could try to mount all drives found in /proc/partitions but that
> seems very dangerous since the list includes md partitions and array
> members.
> So the question is whether there is anyway to trigger the same
> automount mechanism, that X appears to use, on any unmounted USB
> drives?
> Trying resources I found online, It doesn't seem to be autofs or
> gnome-mount mechanism as neither of these are installed on the server.
> Both automount and gnome-mount command not found.
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos


You can use the UUID instead of the device name

Kind Regards
Earl Ramirez