Re: pmount could perhaps be of greater utility?
On 11.05.19 14:38, Eric S Fraga wrote:
> On Saturday, 4 May 2019 at 16:43, Erik Christiansen wrote:
> > To provide that convenient automation, I use:
> >
> > $ which lmount
> > lmount is a function
> > lmount ()
> > {
> > pmount $1 `e2label $1`
> > }
>
> This is nice; is there an equivalent for FAT file systems? Most of the
> devices I mount using pmount are sd cards (cameras etc.).
Pmount is just a wrapper around the standard mount program, and that
will try to guess the fs type if not specified in the invocation - as
above. That manages ext2 and ext3 without assistance, but ... Ah, yes,
with a vfat stick it gives:
$ lmount /dev/sdb1
e2label: Bad magic number in super-block while trying to open /dev/sdb1
Couldn't find valid filesystem superblock.
And "tune2fs -l /dev/sdb1" says the same. Quite what the automounter
does to overcome that, I haven't yet figured out. A quick rewrite of
the tiny wrapper wrapper does improve matters somewhat:
lmount () { # Mount a USB stick at /media/read_stick_label
if [ mp=`e2label $1` ] ; then # if e2label can grok the label.
pmount $1 $mp
else # When that fails, TRY TO
pmount -t vfat $1 vfat # use fs type as mountpoint, for now.
fi
}
mounts vfat OK, but the "label" argument, now third, is ignored despite
being compliant with the manpage. So it falls back to mounting on
/media/sdb1 in a most wilful manner:
/dev/sdb1 on /media/sdb1 type vfat
(rw,nosuid,nodev,noexec,relatime,uid=1000,gid=1000,fmask=0177,dmask=0077,codepage=cp437,iocharset=iso8859-1,shortname=mixed,quiet,utf8,errors=remount-ro)
Either I'm not holding my mouth right, or that looks like a bug.
> Thanks.
We're not home yet.
Erik
Reply to: