OK, using blkid and findfs worked. I moved the necessary files to nand (put the libraries in/usr/lib and the binaries in /usr/sbin).
Lee Jones
Categories: PogoPlug Development
Anybody know how to keep a USB drive mounting on the same /dev/sd??
I'm trying to mount the same drives at the same place so I can predictably find the contents of, say, my 1TB drive at /tmp/.cemnt/mnt_sda1.
However, on MOST boots it is /tmp/.cemnt/mnt_sdb1, some times it is /tmp/.cemnt/mnt_sda1
There's a device ID in the .ceid file, but there's GOT to be a better way than scripting based off a .ceid file, right?
Ubuntu has udev. What options do I have? Can we mount by label or UUID? It does not seem the "mount" accepts either -L or -U
Lee Jones
OK, using blkid and findfs worked. I moved the necessary files to nand (put the libraries in/usr/lib and the binaries in /usr/sbin).
Lee Jones
I was going to say:I found your blog post explaining how you did this. I am able to get it to work for my ext2 formatted flash drive, but I attempted to apply the same idea to my attached harddrives, and yet they appear to mount as they please. Is this method limited by the formatting of the drive? If I want to do this, should I be directing my drives to mount on their respective /tmp/.cemnt/mnt_sd?? locations, or should I create new directories for them in / ?
But I answered my own question. For others' reference, a directory must be created in / . I was unable to get this to work by mounting /tmp/.cemnt/mnt_sd??, or in other directories below / .
This may have been a no brainer for most, but it wasn't for me, but I'm glad I was able to figure it out.
I appreciate your walkthroughs on your site and your replies to yourself. I hate when this happens.
Adam,
Don't know if this will solve your problem, but here ate the shell script lines I use to establish fixed mount points for the thumb drive that contains my Optware and other command-line software:
UUID_OPTWARE=$( blkid | grep 'Optware' | cut -f4 -d'"' )
DEV_OPTWARE=$( findfs UUID=$UUID_OPTWARE )
mount $DEV_OPTWARE /opt
These script lines will dynamically identify and mount any drive with the label "Optware." You need to wget, unpack, and copy blkid and findfs, which are not included in the Pogoplug builds to /usr/sbin and /usr/lib to make this work.
I was able to do something similar, by using blkid to get the UUID of the drive, and then findfs to identify the drive for mounting by UUID which is described above and at Lee's website. I am thinking about replacing the nested if statements that searches for the /opt/sbin in the mount_optext2 file.
My problem at the time of posting this was that I was attempting to mount into the /mnt directory, which apparently doesn't work. Mounting to / worked, but then I decided to just mkdir a mountable directory in /tmp.
On a side note, I have some S## scripts to start various applications on the plug, most of them run just fine on start up (added to the mount_optext2 file), but a couple don't seem to start there. However, when I just run the S## script manually, it works just fine. Any thoughts?
You may need to add a delay at the start of your script to allow the USB device and systems software to finish initializing.
This is what I've done to my boot procedures.
I added a single line at the end of rcS:
/etc/init.d/startOptware.sh
And a script in /etc/init.d/startOptware.sh that mounts my "Optware" drive after waiting for 15 seconds. If the drive is found and it mounts it and starts a supplemental rcS script located on the Optware drive. That way if I make changes that "brick" my Plug, I can back them out by pulling my Optware drive out and doing a cold start:
#! /bin/sh
# Load and run Optware functions:
# Locate and mounts a drive labeled Optware
# Wxecute /opt/etc/init.d /rcS_opt.sh
# Delay needed before USB drives can be detected.
sleep 15
# Get Optware drive UUID, use the UUID to get the device, mount at /opt
UUID_OPTWARE=$( blkid | grep 'Optware' | cut -f4 -d'"' )
DEV_OPTWARE=$( findfs UUID=$UUID_OPTWARE )
mount $DEV_OPTWARE /opt
# Rotate logs on Optware drive
rm /opt/opt_log.old
mv /opt/opt_log /opt/opt_log.old
echo "$(date): Optware drive mounted. Current mounts are:" > /opt/opt_log
mount >> /opt/opt_log
# Start the Optware/supplemental boot script if it exists.
if [ -f /opt/etc/init.d/rcS_opt.sh ]; then
echo "$(date): Starting rcS_opt.sh Optware script" >> /opt/opt_log
/opt/etc/init.d/rcS_opt.sh
else
if [ -f /opt/opt_log ]; then
echo "$(date): Optware script //opt//etc//init.d//rcS_opt.sh not loaded (not found)" >> /opt/opt_log
fi
fi
I like that idea. I am still unsure about why my startup scripts don't all work. They are right before and after other startup scripts that do work, so I'm not sure why they wouldn't. And, like I said, when I call the script manually, it works just fine. Now, some of the apps take a few seconds to start up, would calling another start up script immediately after (no delay added) cause the slower app to abort?
I was having the same problem. I grubbed around for a while before finding this thread that addressed it:
http://www.pogoplugged.com/forum/thread/17497/Problem-with-optware-and-reboot
Did you forget your password?
You can also log in using OpenID.
Well, a little more digging... since we're reliant on busybox, and the L and U options were not compiled, I looked at the busybox links.
I think I MAY be able to script something with blkid and findfs to locate and mount the drive by UUID.
Lee Jones