1 (edited by EvilDevil 2007-12-23 11:28:25)

Topic: "mount" command with -L (label) or -U (uuid) mounting enabled?

Hello,

I'm searching for a mount command which supports -L or -U to be able to mount my USB-stick for pivot root. I'm running Kamikaze 7.09 on a WGT634U, 1x 4Port USB-hub (USB-stick, USB-harddisk, bluetooth, usb-audio). There's no /dev/disc/by-label or by-uuid tree to alternatively mount it that way. Only /dev/sdaX and /dev/sdbX exists, but my harddisk and my stick are randomly assigned to sda and sdb on boot-time. The busybox mount does not support -L or -U (and according to http://www.busybox.net/downloads/BusyBo … item_mount it cannot be configured to support it).
So... is there any way to mount discs by label or create a /dev/disc/by-label tree?

Thanks in advance!

Regards,
EvilDevil

It looks like udev doesn't knows about labels or uuids either.

UEVENT[946685263.314083] remove   /devices/pci0000:00/0000:00:02.2/usb1/1-1/1-1.4/1-1.4:1.0/usb_endpoint/usbdev1.5_ep81 (usb_endpoint)
UEVENT[946685263.315991] remove   /devices/pci0000:00/0000:00:02.2/usb1/1-1/1-1.4/1-1.4:1.0/usb_endpoint/usbdev1.5_ep02 (usb_endpoint)
UEVENT[946685263.316417] remove   /devices/pci0000:00/0000:00:02.2/usb1/1-1/1-1.4/1-1.4:1.0/usb_endpoint/usbdev1.5_ep83 (usb_endpoint)
UEVENT[946685263.316829] remove   /class/scsi_device/1:0:0:0 (scsi_device)
UEVENT[946685263.317230] remove   /class/scsi_disk/1:0:0:0 (scsi_disk)
UEVENT[946685263.317624] remove   /block/sda/sda2 (block)
UEVENT[946685263.318019] remove   /block/sda/sda1 (block)
UEVENT[946685263.318408] remove   /block/sda (block)
UEVENT[946685263.318996] remove   /devices/pci0000:00/0000:00:02.2/usb1/1-1/1-1.4/1-1.4:1.0/host1/target1:0:0/1:0:0:0 (scsi)
UEVENT[946685263.319409] remove   /class/scsi_host/host1 (scsi_host)
UEVENT[946685263.319806] remove   /devices/pci0000:00/0000:00:02.2/usb1/1-1/1-1.4/1-1.4:1.0 (usb)
UEVENT[946685263.320209] remove   /devices/pci0000:00/0000:00:02.2/usb1/1-1/1-1.4/usb_endpoint/usbdev1.5_ep00 (usb_endpoint)
UEVENT[946685263.320620] remove   /devices/pci0000:00/0000:00:02.2/usb1/1-1/1-1.4 (usb)
UEVENT[946685266.242854] add      /devices/pci0000:00/0000:00:02.2/usb1/1-1/1-1.4 (usb)
UEVENT[946685266.243313] add      /devices/pci0000:00/0000:00:02.2/usb1/1-1/1-1.4/usb_endpoint/usbdev1.6_ep00 (usb_endpoint)
UEVENT[946685266.264529] add      /devices/pci0000:00/0000:00:02.2/usb1/1-1/1-1.4/1-1.4:1.0 (usb)
UEVENT[946685266.264987] add      /class/scsi_host/host2 (scsi_host)
UEVENT[946685266.265627] add      /devices/pci0000:00/0000:00:02.2/usb1/1-1/1-1.4/1-1.4:1.0/usb_endpoint/usbdev1.6_ep81 (usb_endpoint)
UEVENT[946685266.266049] add      /devices/pci0000:00/0000:00:02.2/usb1/1-1/1-1.4/1-1.4:1.0/usb_endpoint/usbdev1.6_ep02 (usb_endpoint)
UEVENT[946685266.266467] add      /devices/pci0000:00/0000:00:02.2/usb1/1-1/1-1.4/1-1.4:1.0/usb_endpoint/usbdev1.6_ep83 (usb_endpoint)
UEVENT[946685271.287586] add      /devices/pci0000:00/0000:00:02.2/usb1/1-1/1-1.4/1-1.4:1.0/host2/target2:0:0/2:0:0:0 (scsi)
UEVENT[946685271.292303] add      /class/scsi_disk/2:0:0:0 (scsi_disk)
UEVENT[946685271.362152] add      /block/sdc (block)
UEVENT[946685271.362586] add      /block/sdc/sdc1 (block)
UEVENT[946685271.362975] add      /block/sdc/sdc2 (block)
UEVENT[946685271.363364] add      /class/scsi_device/2:0:0:0 (scsi_device)

PS:
There are files which are provided by 2 packages:

root@OpenWrt:/# ipkg install libblkid
Installing libblkid (1.39-1) to root...
Downloading http://downloads.openwrt.org/kamikaze/7.09/brcm47xx-2.6/packages/./libblkid_1.39-1_mipsel.ipk
An error ocurred, return value: 2.
Collected errors:
Package libblkid wants to install file /usr/lib/libblkid.so.1
        But that file is already provided by package e2fsprogs
Package libblkid wants to install file /usr/lib/libblkid.so.1.0
        But that file is already provided by package e2fsprogs
--
Backfire 10.03.1 on TP-Link TL-WR1043ND,
Barrier Breaker on TP-Link TL-WR941ND,
Backfire (r22711) on Linksys WRT54G v3.1

Re: "mount" command with -L (label) or -U (uuid) mounting enabled?

i use this hack on linux 2.4 powered wl500gp
/etc/hotplug.d/usb/00-uuid:

#!/bin/sh
base=/dev/disk/by-uuid
mkdir -p "$base"
rm "$base"/* 
for dev in /dev/discs/disc*/part* ; do
  uuid="`blkid -c /dev/null -s UUID "$dev" | sed -n -e 's/.*: UUID="\(.*\)" /\1/p'`"
  ln -sf "$dev" "$base"/"$uuid"
done

blkid compiled, but not included in package e2fsprogs

Re: "mount" command with -L (label) or -U (uuid) mounting enabled?

Hi !

   I am using Kamikaze 7.09 where neither blkid nor /dev/discs is present !
I could use tune2fs and /dev/sd* in a similar hack, but ... What a mess !

   There is a real need for a "LABEL=" fstab syntax or a persistent device
names tool, IMHO.

   How do you manage USB storage ?

Re: "mount" command with -L (label) or -U (uuid) mounting enabled?

I was wandering the same thing. Mounting by label would be nice, but I'd be happy with any other way to mount disks by some identifier that does not change on repooting, as sda or sdb might do.

Neither a label tree nor /dev/scsi/host*/bus*/target*/lun*/*  seems to be present on openwrt 7.09, at least not in the nslu2.flavour of it.

Re: "mount" command with -L (label) or -U (uuid) mounting enabled?

Actually mounting a partition using its LABEL or UUID is possible.
You just have to install mount-utils.

Before that you have to remove the old busybox symlinks:

rm /bin/mount
rm /bin/umount

After that you can install mount-utils:

opkg update
opkg install mount-utils

And now you're able to mount by LABEL and UUID, e.g.:

mount LABEL=xxx /mnt
mount UUID=xxx /mnt

Actually im missing this possibility for swap partitions. hmm

Re: "mount" command with -L (label) or -U (uuid) mounting enabled?

Busybox will also mount by "LABEL=" if you build from trunk and manually
configure busybox.  The config entries are under "linux system utilities", select
"Routines for detecting label and uuid on common filesystems" and check all
the file systems you use, then enable all the mount options for LABEL/UUID.

This will allow device names like "LABEL=foo" to appear in /etc/fstab and even
in the LuCI "mount points" dialog.

Of course, if it's a usb block device, it probably will NOT mount on boot since the
mounting of stuff in fstab occurs before the device settles.  Simply get rid of the
bogus "/etc/hotplug.d/block/10-mount" script and replace it with the command
"mount -a".  That way when the device settles, it will get mounted where /etc/fstab
wants it to go.

Works for me on an NSLU2:  KAMIKAZE (bleeding edge, r15247)

......................jim (narem@narem.com, http://www.narem.com)

Re: "mount" command with -L (label) or -U (uuid) mounting enabled?

Install mount-utils package or recompile Busybox with these options enabled if Busybox provide them.