Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #204415

Re: Command line mounting all partitions of pluggable device

From "Thomas Schmitt" <scdbackup@gmx.net>
Newsgroups linux.debian.user
Subject Re: Command line mounting all partitions of pluggable device
Date 2019-01-14 16:30 +0100
Message-ID <xgclA-5sm-5@gated-at.bofh.it> (permalink)
References <xgbfP-4OX-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

rhkramer@gmail.com wrote:
> > Assuming there are entries in fstab for each partition, [...]
> > for i in  /dev/sd<device_letter>*;  do  mount $i; done

Rchard Owlett wrote:
> There are not.

In the most general case i would have a where-to-mount directory with
lots of directories for the various partitions (here 10 drives with
20 partitions each).

For once:

  mkdir /media/all_sd_dir
  for i in a b c d e f g h i j
  do
    for j in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
    do
      mkdir /media/all_sd_dir/sd"$i""$j"
    done
  done

Then i'd use a variation of the proposed loop (in a script, of course):

  for i in /dev/sd[a-j][1-9] /dev/sd[a-j]1[0-9] /dev/sd[a-j]20
  do

    # Skip unresolved patterns which still contain brackets
    if echo "$i" | fgrep ']' >/dev/null
    then
  continue
    fi
 
    # Skip already mounted partitions
    if mount | grep '^'"$i"' ' >/dev/null
    then
  continue
    fi

    # Obtain the drive letter and partition number from /dev/sd path
    dp=$(echo "$i" | sed -e 's/\/dev\/sd//')

    # Now try mounting and report success if mount did not fail
    if mount "$i" /media/all_sd_dir/sd"$dp"
    then
      echo "======= mounted:  $i  /media/all_sd_dir/sd$dp"
    fi
  done

Next, one could try to identify the content by skilled guessing and
create symbolic links to the mounted directories. (The risk is high
to end up with an systemd+udev revenant.)


Have a nice day :)

Thomas

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Command line mounting all partitions of pluggable device Richard Owlett <rowlett@cloud85.net> - 2019-01-14 14:20 +0100
  Re: Command line mounting all partitions of pluggable device rhkramer@gmail.com - 2019-01-14 14:40 +0100
    Re: Command line mounting all partitions of pluggable device Richard Owlett <rowlett@cloud85.net> - 2019-01-14 15:20 +0100
      Re: Command line mounting all partitions of pluggable device rhkramer@gmail.com - 2019-01-14 16:10 +0100
        Re: Command line mounting all partitions of pluggable device rhkramer@gmail.com - 2019-01-14 16:10 +0100
          Re: Command line mounting all partitions of pluggable device Richard Owlett <rowlett@cloud85.net> - 2019-01-14 17:20 +0100
      Re: Command line mounting all partitions of pluggable device "Thomas Schmitt" <scdbackup@gmx.net> - 2019-01-14 16:30 +0100
        Re: Command line mounting all partitions of pluggable device Richard Owlett <rowlett@cloud85.net> - 2019-01-14 17:30 +0100
          Re: Command line mounting all partitions of pluggable device David Wright <deblis@lionunicorn.co.uk> - 2019-01-14 21:20 +0100
            Re: Command line mounting all partitions of pluggable device Richard Owlett <rowlett@cloud85.net> - 2019-01-15 02:10 +0100
              Re: Command line mounting all partitions of pluggable device David Wright <deblis@lionunicorn.co.uk> - 2019-01-17 06:00 +0100
                Re: Command line mounting all partitions of pluggable device Richard Owlett <rowlett@cloud85.net> - 2019-01-18 14:50 +0100
                Re: Command line mounting all partitions of pluggable device David Wright <deblis@lionunicorn.co.uk> - 2019-01-19 04:50 +0100
              Re: Command line mounting all partitions of pluggable device Andrei POPESCU <andreimpopescu@gmail.com> - 2019-05-19 13:30 +0200
                Re: Command line mounting all partitions of pluggable device Greg Wooledge <wooledg@eeg.ccf.org> - 2019-05-20 15:40 +0200
                Re: Command line mounting all partitions of pluggable device Andrei POPESCU <andreimpopescu@gmail.com> - 2019-05-20 21:10 +0200
          Re: Command line mounting all partitions of pluggable device Brian <ad44@cityscape.co.uk> - 2019-01-14 21:30 +0100

csiph-web