Web lists-archives.com

Re: Command line mounting all partitions of pluggable device

On Monday, January 14, 2019 09:12:30 AM Richard Owlett wrote:
> On 01/14/2019 07:33 AM, rhkramer@xxxxxxxxx wrote:
> > On Monday, January 14, 2019 08:11:11 AM Richard Owlett wrote:

> >> How do I mount all partitions of a specific device
> >> (e.g. /dev/sdc)?
> > 
> > Assuming there are entries in fstab for each partition,
> There are not. I have a varying number of devices. Each device is
> normally associated with a specific function (e.g. sneaker-net) or
> personal project. A specific physical device may be reformatted and
> assigned a new purpose.
> > you could use a (bash) for loop, like:
> > 
> > for i in  /dev/sd<device_letter>*;  do  mount $i; done

Hmm, well, that makes it (for me) harder.

If they all have similar mounting options (e.g., RO, things like that), and 
the mount points correspond to some system (e.g., /dev/sd<device_letter><n> 
gets mounted on /mnt/<mountpoint><n>), then you might modify the mount command 
in that loop appropriately, e.g.:

mount  /dev/sd<device_letter><n> /mnt/<mountpoint><n> <options>

Or, if groups of those devices have mountpoints that correspond to some 
system, then you could haved multiple for loops to do the groups.

Or you could put mount commands in a file, one line per file, and run  a for 
loop on the lines of the file, or some variation of this.