I haven't tried it yet but maybe someone already knows...
In the Editing the Startup section could the command with the back quote:
mount `findfs UUID="fc640330-9e49"` /opt
Be changed to use the $(...) notation instead of the back quotes `...`
mount $(findfs UUID="fc640330-9e49") /opt
My old eyes always have trouble with those back quotes and I know the $(...) notation usually works as a replacement.
Good article, I enjoy your topics.
Pogoplug Hackery: How to Set Up Persistent USB Mount Locations
Categories: Pogoplug Hardware PogoPlug Development
Editor's note: Like several of the articles in the development section, this tutorial is meant for those knowledgeable in Pogoplug programming (and hacks in general) and wish to get it to do things it can't do out of the box. This means you should have a solid general idea of the commands you're running, unless you love to live on the dangerous side of things, as tinkering around with Pogoplug's innards can cause unpredictable behavior or even bricking. Have fun and tread carefully!
In a previous post, I talked about how I set up rsync on my Pogoplug.
In that article I mentioned a couple of “Gotchas”, such as the way USB drives may be a
different device name upon reboot.
For Optware to work properly the drives need to stay consistent.
Here is my solution.
You need to install the Optware e2fs libraries and programs, then use blkid and findfs to locate the drive.
The commands below will download and copy the necessary libraries and e2fs utilities for mounting your flash drive in the same location.
The way I do it below is to use the device UUID instead of the drive label to locate the drive, but both are possible.
I also want to modify the NAND (the Pogoplug internal flash drive) as little as possible.
I am ONLY copying the files necessary for this task of finding and mounting specific USB drives to specific locations upon reboot.
Please note that as of Oct 2011, the links below are correct, but be sure to check http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/ for newer version and replace the file names below as necessary.
You need to be familiar with SSH, how to turn it on in your Pogoplug setup and programs like pUtty to do this.
Log into your Pogoplug using pUtty or similar program:
Get the e2fs libraries and utilities
- cd /tmp
- wget http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/e2fslibs_1...
- tar xvzf e2fslibs_1.41.14-1_arm.ipk
- tar xvzf data.tar.gz
- wget http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/e2fsprogs_...
- tar xvzf e2fsprogs_1.41.14-1_arm.ipk
- tar xvzf data.tar.gz
Copying the e2fs files to the internal flash memory
The following command makes it possible to change the Pogoplug flash memory, so be careful from here on out!
Also, I am assuming that /usr/sbin is on your PATH.
- mount / -o remount,rw,noatime
- cd /tmp/opt/lib
- mv libb* /usr/lib
- mv libc* /usr/lib
- mv libe* /usr/lib
- mv libu* /usr/lib
- cd /tmp/opt/sbin
- mv blkid /usr/sbin
- mv findfs /usr/sbin
This puts the files on the NAND and you can use blkid to locate the optware flash drive by UUID, and use findfs use in /etc/init.d/rcS to mount it to /opt.
First we need to locate the actual device UUID for the startup script.
Run blkid to get the UUID, and write this down. For example:
- blkid
- /dev/sda1: UUID="2CB9-87AD" TYPE="vfat" LABEL="LeeJones"
- /dev/sdb1: UUID="fc640330-9e49" TYPE="ext3" LABEL="OPTWARE"
NOTE: the UUID and LABEL are case-sensitive.
In this case, my Optware drive is currently /dev/sdb1 has a UUID of fc640330-9349. Now we should be able to locate the Optware USB drive (or any particular drive) with the findfs command:
- findfs UUID="fc640330-9e49"
This returns the result of /dev/sdb1
Editing the startup /etc/init.d/rcS script
In order for these changes to 'stick' you need to edit the /etc/init.d/rcS using your favorite text editor, add the following line to /etc/init.d/rcS before anything calls /opt
- mount `findfs UUID="fc640330-9e49"` /opt
NOTE: The character before findfs is a back quote (`) not an apostrophe ('). Look for the back quote on the tilde key (~) next to your number 1 key.
Once you have saved the changes to rcS, reboot:
- mount / -o remount,ro
- sync
- sync
- reboot
Extra Credit
I wanted to minimize the changes to my copy of /etc/init.d/rcS, so mine is the factory default one plus the following two extra lines at the end:
- mount `findfs UUID="fc640330-9e49"` /opt # mounts Optware USB
- /opt/etc/init.d/optrun.sh # runs additional software
The contents of /opt/etc/init.d/optrun.sh are as follows:
- #!/bin/sh
- # runs optware startups in sort order
- cd /opt/etc/init.d
- for i in `ls S* | sort`
- do
- ./$i start
- done
This allows me to make minimal changes to /etc/init.d/rcS, just enough to find and properly mount Optware to /opt every single reboot.
The optrun.sh command starts any additional things I want, such as rsync.
Anything file in /opt/etc/init.d that is both executable and begins with a capital S will be ran at boot time.
Also, if I screw up on one on of my additions (been there) and disable my device, all I have to do is power off the Pogoplug, pull out the Optware USB drive and reboot.
After a normal boot, I plug the drive back in and fix my mistake.

RSS


