TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: MARTIN GREGORIE
from: CHRIS ELVIDGE
date: 2019-03-27 18:40:00
subject: Re: Mounting USB drives v

On 27/03/2019 18:19, Martin Gregorie wrote:
> Have you used the option of mounting an HDD partition via the Label?
>
> The mount manpage says that this is now the preferred way of mounting a
> partition.
>
> I've recently started doing this for USB-attached HDDs that I use for
> holding offline backups, i.e. using mount's -L LABEL option, and find
> that it works really well.
>
> However, I usually run "fsck -p" against the backup immediately after
> unmounting it and here's where I've hit a snag: neither fsck nor fsck.ext4
> support use of a label to identify the partition to be fscked.
>
> This problem exists for both Raspbian Stretch and Fedora 28
>
> I have a rather nasty workround: run the following before unmounting th
> volume:
>
> usb_dev=$(df --type=ext4 | \
>            gawk '/\/dev\/sd[b-z]/ { device=$1 }
>                  END              {print $1}
>                 ')
> umount -f "$usb_disk"
> fsck -n $usb_dev
>
> This works, but it relies on the disk to be checked being the last volume
> to be mounted, which makes its details the last line containing /dev/sdx
> in the df output.
>
> My reason for asking: does anybody have a less mickey mouse way of
> finding a disk reference that fsck will accept?
>
> If not, I'll attempt to raise a request to add access by label to fsck
> via the RedHat bugzilla - unless, of course, somebody knows a better way
> to get this feature added.
>
>

Have you tried
basename $(readlink /dev/disk/by-label/LABEL)



--

Chris Elvidge, England

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.