OUR NETWORK:TiVoCommunity TechLore MyOpenRouter Dijit Community MediaSmart Home See all... About UsAdvertiseContact Us

 
Learn about scoring Forum's Raw Score: 68707.5
September 13, 2011 11:18 AM

Categories: PogoPlug Development

Rating (0 votes)
  • 1
  • 2
  • 3
  • 4
  • 5
Rate This!

Member Avatar

Lee Jones

Member
Joined: 08/29/2011

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

Discussion:    Add a Comment | Comments 1-8 of 8 | Latest Comment

September 13, 2011 11:23 AM

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

September 13, 2011 12:29 PM

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

February 28, 2012 4:09 AM


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.

March 29, 2012 4:08 PM updated: March 29, 2012 4:11 PM

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.

March 29, 2012 5:38 PM

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?

March 29, 2012 7:08 PM

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

March 29, 2012 7:51 PM

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?

March 29, 2012 8:06 PM updated: March 29, 2012 8:06 PM

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

Discussion:    Add a Comment | Back to Top | Comments 1-8 of 8 | Latest Comment

Add Your Reply

(will not be displayed)

Email me when comments are added to this thread

 
 

Please log in or register to participate in this community!

Log In

Remember

Not a member? Sign up!

Did you forget your password?

You can also log in using OpenID.

close this window
close this window