Automount

From WL-HDD Wiki

Jump to: navigation, search
WL-HDD Contents
What is the WL-HDD
Features
Pro's/con's
Reviews
Hacking
Inserting the HDD
Hacking Guides
Basic setup guides
Packages guides
Requests
Troubleshooting
This Wiki
Credits
Editing help
Contact Me

Automount Partitions On boot

This section configures the WL-HDD so that after boot, it will automatically mount your storage partition to /opt and activate the swap partition. Olegs firmware lets you run commands or scripts after boot using two files, the post-boot file and the post-firewall file. Lets make these files

mkdir /usr/local/sbin 
touch /usr/local/sbin/post-boot
touch /usr/local/sbin/post-firewall 
chmod +x /usr/local/sbin/* 

The * is known as a wildcard and makes all the files in the sbin/ folder executable

Open the post-boot file in the nano editor- this may not be installed yet, see the ipkg guide:

Now copy and paste this file into the editors window (in windows, you can copy the text in the browser then right click in the putty terminal.

cat << eof > /usr/local/sbin/post-boot 
#!/bin/sh
mount /dev/discs/disc0/part1 /opt
i=0
while [ $i -le 30 ]
do
if [ -d /opt/etc ]
then
break
fi
sleep 1
i='expr $i + 1'
done
swapon /dev/discs/disc0/part2
/opt/etc/init.d/rc.unslung
eof

To save the file in nano, you need to "write-out", hold control and press 'o'. Now exit, hold control and press x.

Note that whilst this is saved for the current session, as soon as the router reboots, it will have forgotten all this and all your hard work will be lost. We need to save it to the flash:

flashfs save
flashfs commit
flashfs enable
reboot

Thats it, now the hard disk should be mounted automatically after boot every time!

If you wish to set your Harddisk to enter standby mode after a certain intervalcheck out the HDD Standby guide.

Personal tools