[CentOS] Automounting a USB drive

Fred Smith fredex at fcshome.stoneham.ma.us
Mon Feb 13 02:52:50 UTC 2017


On Sun, Feb 12, 2017 at 06:19:34PM -0700, tdukes at palmettoshopper.com wrote:
> 
> Hello,
> 
> Been try to use autofs to mount and unmount a usb flashdrive.

I've never had to do anything at all to make this work,...
I insert the USB device, wait a few seconds, and voila!

are you trying this because you can't get it to work the "normal" way,
or is this simply an educational experience?

Fred

> 
> The mount point is /media
> 
> When the drive is NOT inserted, /media is empty. When Iinsert the drive,
> I see directories in /media that are on the usb drive but nocontent.
> 
> So, its kind working.
> 
> /etc/auto,master:
> 
> #
> # Sample auto.master file
> # This is a 'master' automounter map and it has thefollowing format:
> # mount-point [map-type[,format]:]map [options]
> # For details of the format look at auto.master(5).
> #
> /misc     /etc/auto.misc
> #
> # NOTE: mounts done from a hosts map will be mounted withthe
> #             "nosuid"and "nodev" options unless the "suid" and "dev"
> #             optionsare explicitly given.
> #
> /net       -hosts
> #
> # Include /etc/auto.master.d/*.autofs
> # The included files must conform to the format of thisfile.
> #
> +dir:/etc/auto.master.d
> #
> # Include central master map if it can be found using
> # nsswitch sources.
> #
> # Note that if there are entries for /net or /misc (as
> # above) in the included master map any keys that are the
> # same will not be seen as the first read key seen takes
> # precedence.
> #
> +auto.master
> 
> /media   /etc/auto.usb
> 
> /etc/auto.usb:
> 
> usb        -fstype=auto        :/dev/sdb1
> 
> The particular usb drive is a REAR backup drive but Iused -fstype=auto
> in case it may be something different.
> 
> TIA
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos

-- 
---- Fred Smith -- fredex at fcshome.stoneham.ma.us -----------------------------
                    The Lord detests the way of the wicked 
                  but he loves those who pursue righteousness.
----------------------------- Proverbs 15:9 (niv) -----------------------------



More information about the CentOS mailing list