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


Groups > linux.debian.user > #204406 > unrolled thread

Command line mounting all partitions of pluggable device

Started byRichard Owlett <rowlett@cloud85.net>
First post2019-01-14 14:20 +0100
Last post2019-01-14 21:30 +0100
Articles 17 — 7 participants

Back to article view | Back to linux.debian.user


Contents

  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

#204406 — Command line mounting all partitions of pluggable device

FromRichard Owlett <rowlett@cloud85.net>
Date2019-01-14 14:20 +0100
SubjectCommand line mounting all partitions of pluggable device
Message-ID<xgajL-4es-3@gated-at.bofh.it>
I have competing mount requirements.
I have 2 1TB USB drives with a dozen or more partitions, only one of 
which may be of current interest. Disabling automoun is a suitable 
solution to mounted clutter.

However I have several USB drives (64GB - 250GB) with multiple 
partitions. How do I mount all partitions of a specific device
(e.g. /dev/sdc)?

TIA

[toc] | [next] | [standalone]


#204408

Fromrhkramer@gmail.com
Date2019-01-14 14:40 +0100
Message-ID<xgaD8-4l6-7@gated-at.bofh.it>
In reply to#204406
On Monday, January 14, 2019 08:11:11 AM Richard Owlett wrote:
> I have competing mount requirements.
> I have 2 1TB USB drives with a dozen or more partitions, only one of
> which may be of current interest. Disabling automoun is a suitable
> solution to mounted clutter.
> 
> However I have several USB drives (64GB - 250GB) with multiple
> partitions. How do I mount all partitions of a specific device
> (e.g. /dev/sdc)?
> 
> TIA

Assuming there are entries in fstab for each partition, you could use a (bash) 
for loop, like:

for i in  /dev/sd<device_letter>*;  do  mount $i; done

[toc] | [prev] | [next] | [standalone]


#204411

FromRichard Owlett <rowlett@cloud85.net>
Date2019-01-14 15:20 +0100
Message-ID<xgbfP-4OX-1@gated-at.bofh.it>
In reply to#204408
On 01/14/2019 07:33 AM, rhkramer@gmail.com wrote:
> On Monday, January 14, 2019 08:11:11 AM Richard Owlett wrote:
>> I have competing mount requirements.
>> I have 2 1TB USB drives with a dozen or more partitions, only one of
>> which may be of current interest. Disabling automoun is a suitable
>> solution to mounted clutter.
>>
>> However I have several USB drives (64GB - 250GB) with multiple
>> partitions. How do I mount all partitions of a specific device
>> (e.g. /dev/sdc)?
>>
>> TIA
> 
> 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
> 
> 
> 

[toc] | [prev] | [next] | [standalone]


#204412

Fromrhkramer@gmail.com
Date2019-01-14 16:10 +0100
Message-ID<xgc2d-5lF-1@gated-at.bofh.it>
In reply to#204411
On Monday, January 14, 2019 09:12:30 AM Richard Owlett wrote:
> On 01/14/2019 07:33 AM, rhkramer@gmail.com 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.

[toc] | [prev] | [next] | [standalone]


#204413

Fromrhkramer@gmail.com
Date2019-01-14 16:10 +0100
Message-ID<xgc2d-5lF-19@gated-at.bofh.it>
In reply to#204412
Top posting intentionally:  I guess the key is something has to know where to 
mount those devices, and you are the one that has to decide that and tell 
mount in one way or another.


On Monday, January 14, 2019 10:01:15 AM rhkramer@gmail.com wrote:
> On Monday, January 14, 2019 09:12:30 AM Richard Owlett wrote:
> > On 01/14/2019 07:33 AM, rhkramer@gmail.com 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.

[toc] | [prev] | [next] | [standalone]


#204417

FromRichard Owlett <rowlett@cloud85.net>
Date2019-01-14 17:20 +0100
Message-ID<xgd7X-5Zg-1@gated-at.bofh.it>
In reply to#204413
On 01/14/2019 09:02 AM, rhkramer@gmail.com wrote:
> Top posting intentionally:  I guess the key is something has to know where to
> mount those devices, and you are the one that has to decide that and tell
> mount in one way or another.

Using your scheme of "/dev/sd<device_letter><n>" the desired mount point 
can be "computed" by piping the output of "lsblk -l -o name,label" to 
appropriate script(s).
The input parameter would be "sd<device_letter><n>".
The desired mount point would be
  "/media/richard/<label of sd<device_letter><n>>".
{Any 'partition' with a blank label is not to be mounted.}

> 
> 
> On Monday, January 14, 2019 10:01:15 AM rhkramer@gmail.com wrote:
>> On Monday, January 14, 2019 09:12:30 AM Richard Owlett wrote:
>>> On 01/14/2019 07:33 AM, rhkramer@gmail.com 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.
> 
> 
> 

[toc] | [prev] | [next] | [standalone]


#204415

From"Thomas Schmitt" <scdbackup@gmx.net>
Date2019-01-14 16:30 +0100
Message-ID<xgclA-5sm-5@gated-at.bofh.it>
In reply to#204411
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

[toc] | [prev] | [next] | [standalone]


#204418

FromRichard Owlett <rowlett@cloud85.net>
Date2019-01-14 17:30 +0100
Message-ID<xgdhE-62Y-7@gated-at.bofh.it>
In reply to#204415
On 01/14/2019 09:22 AM, Thomas Schmitt wrote:
> 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).

But thankfully I don't have to deal with the most general case as I am 
as compulsive about giving all partitions a reasonably unique label as 
Debian is about assigning UUIDs.

I sketched a procedure in my response to rhkramer.

I have errands that must be run. When I return I will check to see if 
your scripts catches anything mine doesn't.



> 
> 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
> 
> 
> 

[toc] | [prev] | [next] | [standalone]


#204420

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2019-01-14 21:20 +0100
Message-ID<xggSe-8ls-13@gated-at.bofh.it>
In reply to#204418
On Mon 14 Jan 2019 at 10:20:51 (-0600), Richard Owlett wrote:
> On 01/14/2019 09:22 AM, Thomas Schmitt wrote:
> > 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).
> 
> But thankfully I don't have to deal with the most general case as I am
> as compulsive about giving all partitions a reasonably unique label as
> Debian is about assigning UUIDs.

"Reasonably unique" doesn't really cut it. You're better off
generating a nonce name for the real mount point like so:

    Newmtpt=/media/richard/$(uuidgen)
    mkdir -p "$Newmtpt"

and then making a symlink to it using your LABELs. That way, mounting
will always succeed even if creating the link fails (which tells you
to take some action to rectify things).

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#204428

FromRichard Owlett <rowlett@cloud85.net>
Date2019-01-15 02:10 +0100
Message-ID<xgloR-2OV-3@gated-at.bofh.it>
In reply to#204420
On 01/14/2019 02:18 PM, David Wright wrote:
> On Mon 14 Jan 2019 at 10:20:51 (-0600), Richard Owlett wrote:
>> On 01/14/2019 09:22 AM, Thomas Schmitt wrote:
>>> 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).
>>
>> But thankfully I don't have to deal with the most general case as I am
>> as compulsive about giving all partitions a reasonably unique label as
>> Debian is about assigning UUIDs.
> 
> "Reasonably unique" doesn't really cut it.

For my current 2.2TB, the labels seem acceptably unique:
> MainCdrive	my-big-dvd	fromdell	richardofdell	debversionricharProjects	F_drive	OldMachine		fullstretch	debian8.6		recover-common 
tomboy-testing	owlcommon	new-net-inst	good-fvwm	tst_mysql	tst_mariadb 
dummy		target		gddrescued_commo	jessie8-6-6	common		stretch-2nd 
17oct2017	common-bak		backup_homedirs			myhome		dectest		scratch_pad	 
FreeAgentGoFlexDrive		windows		GOFLEXPART5	recovered	mate-full 
post-failure	MISC-backups	

[toc] | [prev] | [next] | [standalone]


#204480

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2019-01-17 06:00 +0100
Message-ID<xh7Wx-7up-1@gated-at.bofh.it>
In reply to#204428
On Mon 14 Jan 2019 at 19:06:29 (-0600), Richard Owlett wrote:
> On 01/14/2019 02:18 PM, David Wright wrote:
> > On Mon 14 Jan 2019 at 10:20:51 (-0600), Richard Owlett wrote:
> > > On 01/14/2019 09:22 AM, Thomas Schmitt wrote:
> > > > 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).
> > > 
> > > But thankfully I don't have to deal with the most general case as I am
> > > as compulsive about giving all partitions a reasonably unique label as
> > > Debian is about assigning UUIDs.
> > 
> > "Reasonably unique" doesn't really cut it.
> 
> For my current 2.2TB, the labels seem acceptably unique:
> > MainCdrive	my-big-dvd	fromdell	richardofdell	debversionricharProjects	F_drive	OldMachine		fullstretch	debian8.6		recover-common
> tomboy-testing	owlcommon	new-net-inst	good-fvwm	tst_mysql	tst_mariadb
> dummy		target		gddrescued_commo	jessie8-6-6	common		stretch-2nd
> 17oct2017	common-bak		backup_homedirs			myhome		dectest		scratch_pad	
> FreeAgentGoFlexDrive		windows		GOFLEXPART5	recovered	mate-full
> post-failure	MISC-backups	

Sure, but this sort of ad hoc naming "scheme" means that you have to
be aware of the entire current population of names every time you
create a new one. That presents a danger of collision.

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#204512

FromRichard Owlett <rowlett@cloud85.net>
Date2019-01-18 14:50 +0100
Message-ID<xhCGZ-1lB-7@gated-at.bofh.it>
In reply to#204480
On 01/15/2019 10:40 AM, David Wright wrote:
> On Mon 14 Jan 2019 at 19:06:29 (-0600), Richard Owlett wrote:
>> On 01/14/2019 02:18 PM, David Wright wrote:
>>> On Mon 14 Jan 2019 at 10:20:51 (-0600), Richard Owlett wrote:
>>>> On 01/14/2019 09:22 AM, Thomas Schmitt wrote:
>>>>> 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).
>>>>
>>>> But thankfully I don't have to deal with the most general case as I am
>>>> as compulsive about giving all partitions a reasonably unique label as
>>>> Debian is about assigning UUIDs.
>>>
>>> "Reasonably unique" doesn't really cut it.
>>

NOTE: When I posted this list, I used tabs rather than spaces to format 
the list. I've reformatted the list so it should survive post & 
quotation problems.

>> For my current 2.2TB, the labels seem acceptably unique:
>> MainCdrive           my-big-dvd     fromdell    richardofdell  debversionrichar	
>> Projects             F_drive        OldMachine  fullstretch    debian8.6
>> recover-common       tomboy-testing owlcommon   new-net-inst   good-fvwm
>> tst_mysql            tst_mariadb    dummy       target         gddrescued_commo
>> jessie8-6-6          common         stretch-2nd 17oct2017      common-bak
>> backup_homedirs      myhome         dectest     scratch_pad
>> FreeAgentGoFlexDrive windows        GOFLEXPART5 recovered       mate-full
>> post-failure         MISC-backups	
>> 
> Sure, but this sort of ad hoc naming "scheme" means that you have to
> be aware of the entire current population of names every time you
> create a new one. That presents a danger of collision.

If partition labels were not explicitly assigned on an _ad hoc basis_, 
they would be useless.

Consider the usefulness of a dictionary arranged by UUID rather than on 
an _ad hoc basis_ ;/

Quoting 
[https://corporatefinanceinstitute.com/resources/knowledge/terms/ad-hoc/]

> The term “ad hoc” is a Latin phrase that literally means “to this” and
> commonly understood as meaning “for this purpose.” It can also be used
> to mean “as needed.” It is commonly used in both business and government
> settings. Ad hoc refers to actions taken to address a specific situation,
> circumstance, or problem, and not usually intended to address other or
> ongoing issues.

IOW “for this purpose” == "finding partition with needed content".
If the labels were not "acceptably unique" they would, by definition, 
*NOT* be "ad hoc" [i.e. not suitable for intended purpose].







> 
> Cheers,
> David.
> 
> 
> 

[toc] | [prev] | [next] | [standalone]


#204527

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2019-01-19 04:50 +0100
Message-ID<xhPNT-XU-5@gated-at.bofh.it>
In reply to#204512
On Fri 18 Jan 2019 at 07:45:56 (-0600), Richard Owlett wrote:
> On 01/15/2019 10:40 AM, David Wright wrote:
> > On Mon 14 Jan 2019 at 19:06:29 (-0600), Richard Owlett wrote:
> > > On 01/14/2019 02:18 PM, David Wright wrote:
> > > > On Mon 14 Jan 2019 at 10:20:51 (-0600), Richard Owlett wrote:
> > > > > On 01/14/2019 09:22 AM, Thomas Schmitt wrote:
> > > > > > 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).
> > > > > 
> > > > > But thankfully I don't have to deal with the most general case as I am
> > > > > as compulsive about giving all partitions a reasonably unique label as
> > > > > Debian is about assigning UUIDs.
> > > > 
> > > > "Reasonably unique" doesn't really cut it.
> > > 
> 
> NOTE: When I posted this list, I used tabs rather than spaces to
> format the list. I've reformatted the list so it should survive post &
> quotation problems.

Perhaps "FreeAgent" went walkabout from line 6?

> > > For my current 2.2TB, the labels seem acceptably unique:
> > > MainCdrive           my-big-dvd     fromdell    richardofdell  debversionrichar	
> > > Projects             F_drive        OldMachine  fullstretch    debian8.6
> > > recover-common       tomboy-testing owlcommon   new-net-inst   good-fvwm
> > > tst_mysql            tst_mariadb    dummy       target         gddrescued_commo
> > > jessie8-6-6          common         stretch-2nd 17oct2017      common-bak
> > > backup_homedirs      myhome         dectest     scratch_pad
> > > FreeAgentGoFlexDrive windows        GOFLEXPART5 recovered       mate-full
> > > post-failure         MISC-backups	
> > > 
> > Sure, but this sort of ad hoc naming "scheme" means that you have to
> > be aware of the entire current population of names every time you
> > create a new one. That presents a danger of collision.
> 
> If partition labels were not explicitly assigned on an _ad hoc basis_,
> they would be useless.

One could debate the merits of any particular naming scheme all day,
but your statement that any planned or systematic scheme is "useless"
seems very odd. But I applaud your consistency: even your choice of
punctuation and capitalisation appears to be ad hoc.

> Consider the usefulness of a dictionary arranged by UUID rather than
> on an _ad hoc basis_ ;/

Not very different, if you're talking about conventional dictionaries
(rather than, say, hashes and other technical meanings).
Dictionary headwords are normally arranged in alphabetical order and,
beneath those headwords, each entry is arranged by grammatical category,
like verb transitive, verb intransitive, noun, adjective, etc.
A dictionary arranged by UUID would effectively be random.

But I think what you're revealing here (correct me if I'm wrong) is
that you've chosen to use partition LABELs as "headwords" for the
information contained in each partition.

> Quoting [https://corporatefinanceinstitute.com/resources/knowledge/terms/ad-hoc/]
> 
> > The term “ad hoc” is a Latin phrase that literally means “to this” and
> > commonly understood as meaning “for this purpose.” It can also be used
> > to mean “as needed.” It is commonly used in both business and government
> > settings. Ad hoc refers to actions taken to address a specific situation,
> > circumstance, or problem, and not usually intended to address other or
> > ongoing issues.
> 
> IOW “for this purpose” == "finding partition with needed content".

That's your choice of *purpose* for the LABEL; it doesn't follow
from the referenced page. Applying that quotation to this thread,
"as needed" refers to the *process* of choosing LABEL names (ad hoc
as opposed to planned). The purpose, the "needed content", is needed
because, one assumes, that's the content you need to lay your hands on
now or at some time in the future. Your purpose is not ad hoc.

Mentioning other methods of finding content would widen this
discussion excessively, but describing the contents of a partition
in 16 characters (your purpose) does not seem to be particularly
sensible.

> If the labels were not "acceptably unique" they would, by definition,
> *NOT* be "ad hoc" [i.e. not suitable for intended purpose].

That doesn't make sense: "ad hoc" can of course mean "suitable
for intended purpose". It doesn't follow that "Not ad hoc" means
"unsuitable for intended purpose".

(Uniqueness doesn't come into the meaning of ad hoc.)

Using the definition at the top of that web page, your collection
of LABELs certainly looks like a collection of "one off" choices
to me, which is why I described your process of choosing them as
ad hoc.

My own method of choosing LABELs is also vulnerable to name collision,
but because every LABEL starts with the device's name (chosen in an
ad hoc set of systematic ways, and physically written on it when
acquired), collision is unlikely to occur.

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#208846

FromAndrei POPESCU <andreimpopescu@gmail.com>
Date2019-05-19 13:30 +0200
Message-ID<xZsaR-1LA-3@gated-at.bofh.it>
In reply to#204428

[Multipart message — attachments visible in raw view] — view raw

On Lu, 14 ian 19, 19:06:29, Richard Owlett wrote:
> On 01/14/2019 02:18 PM, David Wright wrote:
> > On Mon 14 Jan 2019 at 10:20:51 (-0600), Richard Owlett wrote:
> > > On 01/14/2019 09:22 AM, Thomas Schmitt wrote:
> > > > 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).
> > > 
> > > But thankfully I don't have to deal with the most general case as I am
> > > as compulsive about giving all partitions a reasonably unique label as
> > > Debian is about assigning UUIDs.
> > 
> > "Reasonably unique" doesn't really cut it.
> 
> For my current 2.2TB, the labels seem acceptably unique:
> > MainCdrive	my-big-dvd	fromdell	richardofdell	debversionricharProjects	F_drive	OldMachine		fullstretch	debian8.6		recover-common
> tomboy-testing	owlcommon	new-net-inst	good-fvwm	tst_mysql	tst_mariadb
> dummy		target		gddrescued_commo	jessie8-6-6	common		stretch-2nd
> 17oct2017	common-bak		backup_homedirs			myhome		dectest		scratch_pad	
> FreeAgentGoFlexDrive		windows		GOFLEXPART5	recovered	mate-full
> post-failure	MISC-backups	

A reasonably easy and safe way to avoid name collisions would be to 
track devices by creating/deleting mountpoints with same name as the 
label as soon as you add/remove a device/partition to your collection.

Then you could also use that to script a 'mount-all' 
command/function/one-liner, something like:

    for $dir in /media/removable/*
    do
        mount /dev/disk/by-label/$dir /media/removable/$dir
    done
    (with appropriate quoting, etc.)

You could even group devices in different classes as needed (removable, 
fixed, spinning, SSDs, etc.).

Kind regards,
Andrei
-- 
http://wiki.debian.org/FAQsFromDebianUser

[toc] | [prev] | [next] | [standalone]


#208899

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2019-05-20 15:40 +0200
Message-ID<xZQGe-17a-1@gated-at.bofh.it>
In reply to#208846
On Sun, May 19, 2019 at 02:20:19PM +0300, Andrei POPESCU wrote:
>     for $dir in /media/removable/*
>     do
>         mount /dev/disk/by-label/$dir /media/removable/$dir
>     done

for dir in /media/removable/*
do
    mount /dev/disk/by-label/"$dir" /media/removable/"$dir"
done

Note the lack of $ in the first line.  That's a fatal bug.

The quotes around "$dir" in the third line should be used, but if you
forget them, it'll *probably* still work in most cases, because your
directory names probably don't contain spaces or glob characters.
Until that day in the distant future when all of a sudden, they do,
and everything falls down.

[toc] | [prev] | [next] | [standalone]


#208926

FromAndrei POPESCU <andreimpopescu@gmail.com>
Date2019-05-20 21:10 +0200
Message-ID<xZVPz-4tu-9@gated-at.bofh.it>
In reply to#208899

[Multipart message — attachments visible in raw view] — view raw

On Lu, 20 mai 19, 09:31:05, Greg Wooledge wrote:
> On Sun, May 19, 2019 at 02:20:19PM +0300, Andrei POPESCU wrote:
> >     for $dir in /media/removable/*
> >     do
> >         mount /dev/disk/by-label/$dir /media/removable/$dir
> >     done
> 
> for dir in /media/removable/*
> do
>     mount /dev/disk/by-label/"$dir" /media/removable/"$dir"
> done
> 
> Note the lack of $ in the first line.  That's a fatal bug.
 
It was late... early... Sunday :p

> The quotes around "$dir" in the third line should be used, but if you
> forget them, it'll *probably* still work in most cases, because your
> directory names probably don't contain spaces or glob characters.
> Until that day in the distant future when all of a sudden, they do,
> and everything falls down.

As I said "(with appropriate quoting, etc.)".

Kind regards,
Andrei
-- 
http://wiki.debian.org/FAQsFromDebianUser

[toc] | [prev] | [next] | [standalone]


#204421

FromBrian <ad44@cityscape.co.uk>
Date2019-01-14 21:30 +0100
Message-ID<xgh1U-8p5-5@gated-at.bofh.it>
In reply to#204418
On Mon 14 Jan 2019 at 10:20:51 -0600, Richard Owlett wrote:

> On 01/14/2019 09:22 AM, Thomas Schmitt wrote:
> > 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).
> 
> But thankfully I don't have to deal with the most general case as I am as
> compulsive about giving all partitions a reasonably unique label as Debian
> is about assigning UUIDs.

Would you like to say how you designate unique labels? Is there a
pattern to them on a particular device? As in: p1, p2 etc.

In the light of

 > Each device is normally associated with a specific function
 > (e.g. sneaker-net) or personal project.

do you distinguish between devices by means of the label? As in pers-p1,
pers-p2 etc.

-- 
Brian.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web