• Home
  • Help
  • Search
  • Login
  • Register
Pages: 1 [2] 3
Author Topic: Managing a USB hard drive on the Plug  (Read 30517 times)
hungarianhc
Jr. Member
**

Karma: 2
Posts: 85


View Profile
« Reply #15 on: December 16, 2009, 12:39:32 AM »

Ah nevermind! I figured it out!

I didn't have the header information that mgillespie had in his script. So then I went back to my totally un-elegant solution of having it just wait and output that that it was taking a nap  Grin. I was watching bootup and while the system was taking a nap, I saw all the USB partitions populate. So if anyone wants a REALLY complicated script... here's mine!

So here were my steps, for noobies like myself, btw...

1) make a new script file in the /etc/init.d/ folder
2) Paste mgillespie's header into it...
3) Add my sleep commands so that the final script looks as follows:

Code:
#!/bin/sh
### BEGIN INIT INFO
# Provides:          wait4usbdisks
# Required-Start:    checkfs
# Required-Stop:
# Should-Start:
# Should-stop:
# Default-Start:     S
# Default-Stop:
# X-Interactive:     true
# Short-Description: Delays boot to ensure USB disks are connected.
### END INIT INFO

echo "Taking a 10 second nap to wait for USB disks to appear"
sleep 10
echo "I'm awake!"
4) Use apt-get to install rcconf... well, heres's the command...
Code:
apt-get install rcconf
5) run rcconf - check the box for your new script. reboot. And you're good to go! disks will be mounted when you reboot  Grin.

If anyone knows a good guide to rcconf, I'd love to see it. Thanks for the help!
Logged

smeagol
Newbie
*

Karma: 0
Posts: 1


View Profile
« Reply #16 on: January 21, 2010, 09:00:49 AM »

Great post, thanks for sharing.

My plans are to use a plug setup with 4 large drives connected via USB as my backup storage.

I assume those of you running with similar configurations are using a powered USB hub?
Are there any problems or considerations in such a layout?

Thanks
Brian
Logged

mhtsaras
Newbie
*

Karma: 0
Posts: 42


View Profile
« Reply #17 on: February 15, 2010, 03:37:12 PM »

I have a similar problem with usb disk that if I mount it or run mount -a it's working fine,
but when I reboot It's prompting me with a recover shell to run fsck and only usb serial terminal access
Linking restamp's script ../init.d/wait4usbdisks /etc/rcS.d/S25wait4usbdisks, means that checkfs.sh has a greater value, S26...,S27...,etc
Given that I boot Debian from sdcard and my :~$ ls /etc/rcS.d :
Code:
S01mountkernfs.sh -> ../init.d/mountkernfs.sh
S02udev -> ../init.d/udev
S03mountdevsubfs.sh -> ../init.d/mountdevsubfs.sh
S04bootlogd -> ../init.d/bootlogd
S05hostname.sh -> ../init.d/hostname.sh
S05hwclockfirst.sh -> ../init.d/hwclockfirst.sh
S06checkroot.sh -> ../init.d/checkroot.sh
S07cryptdisks-early -> ../init.d/cryptdisks-early
S08cryptdisks -> ../init.d/cryptdisks
S09hwclock.sh -> ../init.d/hwclock.sh
S09ifupdown-clean -> ../init.d/ifupdown-clean
S09module-init-tools -> ../init.d/module-init-tools
S09mtab.sh -> ../init.d/mtab.sh
S09udev-mtab -> ../init.d/udev-mtab
S10checkfs.sh -> ../init.d/checkfs.sh
S11ifupdown -> ../init.d/ifupdown
S11mountall.sh -> ../init.d/mountall.sh
S12mountall-bootclean.sh -> ../init.d/mountall-bootclean.sh
S13mountoverflowtmp -> ../init.d/mountoverflowtmp
S14networking -> ../init.d/networking
S14procps -> ../init.d/procps
S14x11-common -> ../init.d/x11-common
S15mountnfs.sh -> ../init.d/mountnfs.sh
S16mountnfs-bootclean.sh -> ../init.d/mountnfs-bootclean.sh
S17bootmisc.sh -> ../init.d/bootmisc.sh
S17screen-cleanup -> ../init.d/screen-cleanup
S17urandom -> ../init.d/urandom
S18stop-bootlogd-single -> ../init.d/stop-bootlogd-single
For the script to run before checkfs.sh (as stated on the thread) in my case I must give it a number:
/etc/rcS.d/S09wait4usbdisks
because /init.d/checkfs.sh has number S10checkfs.sh ?
Logged

wobblybob
Newbie
*

Karma: 0
Posts: 2


View Profile
« Reply #18 on: February 17, 2010, 08:37:24 AM »

Thanks restart, that works a treat, I've done a quick How To on my blog http://myubuntublog.wordpress.com/2010/02/17/sheevaplug-automount-usb-drive-at-boot/ as a bit of a nub guide.

Thanks again
wobblybob
Logged

mhtsaras
Newbie
*

Karma: 0
Posts: 42


View Profile
« Reply #19 on: February 17, 2010, 03:58:44 PM »

To restamp
The script must be placed before or after cryptdisks ?
I'm asking that because debian has the files inside /etc/rcS.d/ in a different order that ubuntu has them.
Logged

restamp
Global Moderator
Sr. Member
*****

Karma: 4
Posts: 273


View Profile
« Reply #20 on: February 17, 2010, 06:50:41 PM »

I can't speak for Debian (although I'm sure I'll move to it eventually), but I have placed the script after checkroot.sh and mtab.sh, and before all the cryptdisk config scripts, here.  Actually, it is at S25 under my current Ubuntu.  I don't use cryptodisks, but I'd suspect the USB subsystem would have to be active prior to mounting any such disks if I did.
Logged

oberger
Newbie
*

Karma: 0
Posts: 14


View Profile
« Reply #21 on: March 22, 2010, 12:17:12 AM »

Hi.

I had the same problem (see http://plugcomputer.org/plugforum/index.php?topic=1480.0).

it turns out the Plug boots faster than the USB subsystem initializes and therein lies the problem:  If I code a line to mount the hard drive in /etc/fstab, specifying (as I should) that it be fscked, if necessary, the fsck command fails because the devices are not available in /dev yet.  This causes the /etc/init.d/checkfs.sh to stop the boot sequence and require manual intervention.

I think an alternative may be to use the
Code:
usbmount
package (on Debian), which succesfully does the jobs for me.

OK, I haven't found how to specify a custom moint point there, but at least the drive is mounted.
Logged

oberger
Newbie
*

Karma: 0
Posts: 14


View Profile
« Reply #22 on: March 27, 2010, 10:47:31 AM »


OK, I haven't found how to specify a custom moint point there, but at least the drive is mounted.

Actually, this can be done with symbolic links.

I have :

Code:
/mnt/backups ->  /var/run/usbmount/IC35L080_AVVA07-0_1
/var/run/usbmount/IC35L080_AVVA07-0_1  -> /media/usb0

So my disk "IC35L080_AVVA07" is supposed to be reachable through /mnt/backups upon reboot...

Not perfect, but avoids hacking away some scripts/rules ;-)
Logged

amye
Newbie
*

Karma: 0
Posts: 1


View Profile
« Reply #23 on: April 08, 2010, 07:53:15 AM »


 I have a project to run Ubuntu + Seven from a 16Gb flash-disk.
 Is working on some (not all) windows computers, booting from flash-disk.
 Can work on Sheeva?
 At moment(I' m in Malaysia) i can't buy a Sheeva, here noone sell it yet, also at Marvell factory here in Penang...
 The project is detailed (free-Open source) at web.me.com/fabsunglee at page amye.

 just a little slow in execution, I hope USB 3.0 can improve.
 When Sheeva with USB 3.0?
 Thanks.
 
Logged

Cloaked Alien
Newbie
*

Karma: 0
Posts: 1


View Profile
« Reply #24 on: May 28, 2010, 06:36:40 PM »

I do not know if this is relevant, or not, as I'm still sort of a linux rookie. But I just solved an issue with an USB-drive (1TB for backups) connected to my GuruPlug and fstab.

I could not get it to work when adding it in /etc/fstab since it borked on boot-up with errors, I tried this script and various other tweaks but to no avail.

The solution? Remove the usbmount package, now it boots/mounts just fine without any scripts/hacks =)
Logged

jkyro
Newbie
*

Karma: 0
Posts: 7


View Profile
« Reply #25 on: May 29, 2010, 11:14:49 AM »


I have a Debian Squeeze setup where the root is on the internal NAND and /usr and /var are on an external USB hard drive. I'm using the latest kernel, 2.6.34.
I have the same problem, I can't mount the drives because the USB disk might not by ready when init gets to mountall.sh. Using rootwait kernel parameter doesn't work either, for some reason the kernel barfs because it cannot mount the ubifs root if the rootwait parameter is enabled.

So far I've solved this by adding a 10s delay to udev init script just before a successful exit.
Logged

mgillespie
Full Member
***

Karma: 7
Posts: 239



View Profile
« Reply #26 on: September 04, 2010, 04:54:51 AM »

this all sort of stopped working for me recently.

I ended going back to:

Code:
#!/bin/sh
### BEGIN INIT INFO
# Provides:          wait4usbdisks
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-stop:
# Default-Start:     S
# Default-Stop:
# X-Interactive:     true
# X-Start-Before: checkfs
# Short-Description: Delays boot to ensure USB disks are connected.
### END INIT INFO
echo "Taking a 10 second nap for USB devices to initialize!"
sleep 10
echo "Done napping!"


and then:

Code:
update-rc.d wait4usbdisks.sh  defaults
Logged

loverdrive
Newbie
*

Karma: 0
Posts: 22


View Profile
« Reply #27 on: October 07, 2010, 10:56:09 AM »

this all sort of stopped working for me recently.

I ended going back to:

Code:
#!/bin/sh
### BEGIN INIT INFO
# Provides:          wait4usbdisks
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-stop:
# Default-Start:     S
# Default-Stop:
# X-Interactive:     true
# X-Start-Before: checkfs
# Short-Description: Delays boot to ensure USB disks are connected.
### END INIT INFO
echo "Taking a 10 second nap for USB devices to initialize!"
sleep 10
echo "Done napping!"



Are you using this script instead one by restamp?

in any case, these scripts don't work for me Sad It's strange but i can't mount usb pen al boot Sad
« Last Edit: October 07, 2010, 11:03:21 AM by loverdrive » Logged

loverdrive
Newbie
*

Karma: 0
Posts: 22


View Profile
« Reply #28 on: October 11, 2010, 12:52:41 PM »

in my sheeva, wait4usbdisk doesn't work. but i have already the script in /etc/init.d ... and i mount devices manually after the boot.
But now... i'm installing vsftpd, and debian give me this warning:

Code:
insserv: warning: script 'S25waitusbdrive' missing LSB tags and overrides
insserv: warning: script 'wait4usbdisks' missing LSB and overrides
insserv: Starting wit4usbdisks depends on stop-bootlogd-single and therefore on system facility '$all' which can not be true!
insserv: Starting wit4usbdisks depends on stop-bootlogd-single and therefore on system facility '$all' which can not be true!
insserv: Starting wit4usbdisks depends on stop-bootlogd-single and therefore on system facility '$all' which can not be true!
insserv: Starting wit4usbdisks depends on stop-bootlogd-single and therefore on system facility '$all' which can not be true!
insserv: Starting wit4usbdisks depends on stop-bootlogd-single and therefore on system facility '$all' which can not be true!
insserv: Max recursions depth 99 reached
insserv: There is a loop at service stop-bootlogd-single if started

what is this problem?! :O
Logged

Max
Newbie
*

Karma: 0
Posts: 2


View Profile
« Reply #29 on: November 14, 2010, 04:07:48 PM »

I'm running Debian Squeeze on my plug and have two external drives with partitions mounted by UUID.

I have zero knolwedge of scripting but I have had a go at combining joosy and mgillespies scripts to meet my needs.

Code:
                                                       
#!/bin/sh
### BEGIN INIT INFO
# Provides:          wait4usbdisks
# Required-Start:    checkfs
# Required-Stop:
# Should-Start:
# Should-stop:
# Default-Start:     S
# Default-Stop:
# X-Interactive:     true
# Short-Description: Delays boot to ensure USB disks are connected.
### END INIT INFO

#
# 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...
#

. /lib/lsb/init-functions

case "$1" in
start)
        FS=`grep "^UUID" /etc/fstab | sed 's/^UUID=\([a-z0-9-]*\).*$/\/dev\/disk\/by-uuid\/\1/i'`
        for f in $FS ;
        do
        for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
        do
          [ -h $f ] && continue 2
          sleep 1
        done
        exit 1
        ;;
stop)
        ;;
esac

Does this look like it might work?

Also as I am running this from rcconf as suggested by mgillespie can I delete restamp's symlink?

Code:
# ln -s ../init.d/wait4usbdisks /etc/rcS.d/S25wait4usbdisks

Any feedback gratefully received.


Logged

Pages: 1 [2] 3
Print
Jump to: