[lug] USB flash drive mounting

Quentin Hartman qhartman at gmail.com
Mon Apr 6 13:40:26 MDT 2015


I would expect some mount by uuid or mount by volume name would be the
ticket. There are a fair number of potentially important details you leave
out, but roughly something like:

device="/dev/sdb1"
label=$(use fdisk to check the label of partition on the $device)
if [ "$label" == "FLASH" ]; then
  mount $device /mnt/FLASH
  cp $data
  umount /mnt/FLASH
fi

As for the label checking, this conversation has lots of ideas:
http://unix.stackexchange.com/questions/14165/list-partition-labels-from-the-command-line


On Mon, Apr 6, 2015 at 1:20 PM, Gary Hodges - NOAA Affiliate <
gary.hodges at noaa.gov> wrote:

> Hi,
>
> The scenario...
>
> I have multiple USB storage drives and multiple computers.  I want to be
> able to mount from within a script any USB drive on any computer.  I'd like
> all the USB drives to be identified the same way, e.g, FLASH.
>
> Is that clear?  All the computers are configured identically.  I want to
> be able to set up a computer and expect that all my USB drives will be
> treated the same.  I'd like to write a script that checks if a drive is
> mounted, mount if it isn't, write some data to it, then unmount.
>
> Consulting the google has provided some leads, but I haven't been able to
> make any work.
>
> Gary
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20150406/99351229/attachment.html>


More information about the LUG mailing list