Posts Tagged ‘fstab’

Sheevaplug – automount USB drive at boot

17, February 2010

The problem with the Sheevaplug is that it boots too damn fast and the USB drive is too slow to be available for the fstab mount.

The solution, see here for my post on setting up the fstab file to mount your USB drive. When you edit the fstab on the Sheeva you will find it empty but you should end up with an entry similar to this.

# UNCONFIGURED FSTAB FOR BASE SYSTEM
/dev/sda1 /mnt/usbdrive ext3 auto,user,rw,exec 0 0

My usb drive is mounted at /dev/sda1 and I created a mount point called /mnt/usbdrive, the drive is formatted as ext3 but you can replace this with the format of your drive or just replace with the word auto for it to check.

Once you have your fstab in place you need to create a script which will slow down the boot for the USB drive to start. Thanks to restamp on the plugcomputer.org forum see here for the solution.
First navigate to the init.d folder, in a [Terminal] issue the command;

cd /etc/init.d

then using whatever text editor you have installed [I added nano], open a file called wait4usbdrive with;

nano wait4usbdrive

then copy into it restarts script;

#!/bin/sh
#
# If /etc/fstab has been configured to mount a USB drive, pause to give
# the USB drive devices time to show up in /dev. If this is not done,
# checkfs.sh will fail, requiring manual intervention…
#
case "$1" in
start)
grep -q ^/dev/sda /etc/fstab &&
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
[ -b /dev/sda ] && exit 0
sleep 1
done
exit 1
;;
stop)
;;
esac

Then make it executable with;

chmod +x wait4usbdrive

Then link it to the rcS.d folder with this command;

ln -s ../init.d/wait4usbdrive /etc/rcS.d/S25wait4usbdrive

Now you can shutdown and restart the plug and the USB drive should now auto-mount. My USB drive is a 1.5 TB iomega with it’s own power supply.

Auto mount USB Hard Drive at Boot

25, May 2009

To make my external USB Hard Drive auto mount at the same mount point on every boot [especially important if you use scripts to copy backups to it] then follow these instructions..

First create a mount point in the directory /mnt , open a terminal and type;

~$ sudo mkdir /mnt/USB-HD

replace USB-HD with whatever you want to see in the Places list as the name of your Hard Drive.

Now check where the HD is currently mounted, if you navigate to /media you should find that your USB HD is mounted as something like /media/disk, now open a Terminal and type;

~$ mount

You should see something like this, and need to search for the line which includes your disks mount point in my case /media/disk;

/dev/sda1 on / type ext3 (rw,relatime,errors=remount-ro)

tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)

proc on /proc type proc (rw,noexec,nosuid,nodev)

sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)

varrun on /var/run type tmpfs (rw,nosuid,mode=0755)

varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)

udev on /dev type tmpfs (rw,mode=0755)

tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)

devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)

fusectl on /sys/fs/fuse/connections type fusectl (rw)

lrm on /lib/modules/2.6.28-11-generic/volatile type tmpfs (rw,mode=755)

/dev/sdb1 on /home type ext3 (rw,relatime)

securityfs on /sys/kernel/security type securityfs (rw)

binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)

gvfs-fuse-daemon on /home/martin/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=martin)

/dev/sdg1 on /media/disk type ext3 (rw,nosuid,nodev,uhelper=hal)

As you can see my USB Drive is mounted on the last line at /dev/sdg1

Now make a backup of the fstab file which controls the mount points of your file system by adding a .bak to the end of the copied file with;

~$ sudo cp /etc/fstab /etc/fstab.bak

then open the fstab file with;

~$ sudo gedit /etc/fstab

and adding the new line at the bottom of the list as follows, changing the /dev & /mnt options to match your own above;

/dev/sdg1 /mnt/USB-HD auto auto,user,rw,exec 0 0

then re saving the file.

My HD is formatted as an ext3 but the 1st auto in this line checks to see what the disk is formatted as, but you can change it to the actual format if you wish. Now reboot your PC and [fingers crossed] your External HD will mount as USB-HD.