Unslung 4 with flash rootfs and HD/USB stick diversion scripts
Unslung 4 beta is primarily intended for use with a root file system entirely located on the hard drive and enables this upon unslinging. Optionally one can run with just the internal flash as the root files system, but tests indicate that this is slower, one has to make changes to the flash risking having to reflash and making further flash upgrades more labour intensive as changes must be backed up and restored.
Unslung 3, however, was mostly used in a combined way. The root file system was located on the flash, but the root directory entry
/opt was a pointer to a directory on one of the hard drives. Furthermore, one could place diversion scripts on the hard drive in order to customize the boot sequence of Unslung only when the drive in question was connected on startup.
Unslung 4 can be used in the same way as Unslung 3 -- that is: running with the internal flash as root FS, but with diversion scripts on a HD (or USB stick). The reason for doing this is wanting some system to remain much a it was under Unslung 3, but it may also be that one is using a pen drive (USB stick) with little memory and will benefit from using the NSLU2 flash memory as well. The problem is that diversion scripts will no longer work as they did in Unslung 3, because the HD (or USB Stick) will no longer be mounted from /etc/rc so HD based diversion scripts will not be available at that time of the boot process. Only later will the drives be mounted, so Unslung 4 is incompatible with Unslung 3 in this respect.
One can go around this problem by creating a diversion script on the flash, located in
/unslung. The purpose of this is to perform the pre-mounting of the hard drive(s) or USB stick(s) containing diversion scripts.
- Note that: THERE IS NO NEED TO DO THIS UNLESS ONE HAS HD/USB STICK BASED DIVERSION SCRIPTS.
- Note that: ONE SHOULD NOT DO THIS IF ONE HAS PERFORMED
UNSLING ON THE DRIVE IN QUESTION. If this has been done, the root file system is entirely located on the drive in question and the drive will be mounted in
- Side note: If one would like to unsling to non-ext3 file systems, a similar trick must be performed to pre-mount the file systems, since Unslung 4 only accepts ext3 file systems as root file systems. Such an approach requires more tweaking, so supplementary wiki pages must be written to deal with this.
- Make sure that the file
/.sdXYroot (where X is a number and Y a letter) is not present on the root. The presence of such a file would indicate that you have performed
unsling and are running with non-flash root file system.
- Make a note of which drive and file system you want to mount early (you could in theory have several file systems mounted, each with its own diversion script, but that is bad practice). We recommend using the
/unslung directory on the data partition of the first HD as the location of your diversion scripts. As our packages are now normally stored on that file system as well, this makes it sufficient to just mount one file system from the flash based diversion script below.
- Place an adaptation (suitably changed to point to the correct partition)of the following script in
/unslung/rc.1 (note: we cannot place it as a diversion to
/etc/rc since the root file system is read only at the time and will not accept mounting).:
# Is there a primary HD/USB stick that will not become our root file system?
# If so, mount the first partition (data parition) on /mnt/sda1/
if ( [ ! -f /sda1root ] && [ -f /proc/hd_conn ] ) ; then
/bin/mount -o noatime -t ext3 /dev/sda1 /mnt/sda1
# Now we must check for HD diversion of /etc/rc.d/rc.1, since this test
# is done prior to the test for this flash diversion of /etc/rc.d/rc.1
if ( [ ! -f /.sda1root ] && [ -f /mnt/sda1/unslung/rc.1 ] && . /mnt/sda1/unslung/rc.1 ) ; then
return 0 ;
# Continue with the original /etc/rc.1 script.