[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: Persistent mountpoint for USB storage
From: Isaac Dunham <ibid.ag () gmail ! com>
Date: 2015-10-31 3:49:31
Message-ID: 20151031034930.GA1526 () newbook
[Download RAW message or body]
On Fri, Oct 30, 2015 at 02:28:11PM +0100, Franz Leu wrote:
> Hi
>
>
>
> I'd like to mount USB storage on persistent mount point depending in the
> USB port it's plugged in.
>
> Plugged in port 0 always mounts to /mnt/usb0
>
> Plugged in port 1 always mounts to /mnt/usb1
>
> ...
>
>
>
> How can I achieve this automatically, manually or by a script.
If you can figure out from sysfs whether a given disk is attached to port
0/1/2/..., you can do the following:
- have /dev/usbdisk<port> in your fstab
- have a script that looks in the proper sysfs dir (/sys/class/block/<disk>)
and follows a bunch of symlinks to figure out if it's usb and which port,
then use a symlink.
However, I'm not sure how you'd do the script.
Right here, it *seems* that I have three ports (1-1, 1-2, and 1-3), and I
can tell the difference by this:
DISKPATH=$(readlink -f /sys/class/block/<disk>)
USBPATH=${DISKSPOT#*/usb}
USBPORT=$(echo $USBPATH | cut -d/ -f2)
But I'm not sure about all that; it's my best guess of what's going on.
HTH,
Isaac Dunham
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic