FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 08-01-2012, 05:49 AM
Emmanuel Noobadmin
 
Default How to trigger automount of USB drives in Centos6

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@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 08-01-2012, 06:10 AM
Earl Ramirez
 
Default How to trigger automount of USB drives in Centos6

On 1 August 2012 14:49, Emmanuel Noobadmin <centos.admin@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@centos.org
> http://lists.centos.org/mailman/listinfo/centos
>

Emmanuel,

You can use the UUID instead of the device name


--
Kind Regards
Earl Ramirez
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 08-01-2012, 06:44 PM
Emmanuel Noobadmin
 
Default How to trigger automount of USB drives in Centos6

On 8/1/12, Earl Ramirez <earlaramirez@gmail.com> wrote:

> You can use the UUID instead of the device name

I thought of doing that but that assumes the same devices are used all
the time. Otherwise, I would have to maintain a list of UUIDs to add
every time and to keep trying every time the script is run which
doesn't sound very efficient to me. Thus it seems to me like there
should be a better way to do this especially since the mechanism
already appears to exist.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 08-02-2012, 04:33 PM
Daniel Haas
 
Default How to trigger automount of USB drives in Centos6

On Wed, Aug 1, 2012 at 2:44 PM, Emmanuel Noobadmin
<centos.admin@gmail.com> wrote:
> On 8/1/12, Earl Ramirez <earlaramirez@gmail.com> wrote:
>
>> You can use the UUID instead of the device name
>
> I thought of doing that but that assumes the same devices are used all
> the time. Otherwise, I would have to maintain a list of UUIDs to add
> every time and to keep trying every time the script is run which
> doesn't sound very efficient to me. Thus it seems to me like there
> should be a better way to do this especially since the mechanism
> already appears to exist.
> _______________________________________________
> CentOS mailing list
> CentOS@centos.org
> http://lists.centos.org/mailman/listinfo/centos

Perhaps, this article maybe of interest.

http://blog.jasonantman.com/2009/11/running-a-script-on-usb-drive-insertion/
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 04:59 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org