incans
Posts: 2
Joined: Sun Jan 27, 2013 3:30 pm

Wait for hard disk during boot

Mon Apr 29, 2013 7:35 pm

A while ago I started configuring the Pi as a server for Slimserver (the Logitech) music server. As part of doing this I set the Pi up with an external 2.5" hard disk with two partitions-

/dev/sda2 mounted on /var
/dev/sda1 mounted on /share

The idea was to get better speed and more space for swap by putting /var on the hard disk. /share is bulk storage space for media files. The disk partitions are configured (using disk labels) in fstab

Problem-

This was running ok until the first time I rebooted the Pi.

When the Pi boots it can't "see" the disk partitions. Thus it fails to mount /var which leaves the machine a bit upset because it can't find a bunch of files, and you can't start X because it needs to write into /var.

Now, interestingly once the machine has been running for few seconds or so, if I run "mount -a" as root, the disk partitions mount and most things start working.

However at this point things look a bit weird-
  • The command "mount" shows each of /var and /share being mounted TWICE. So for example /var is listed as mounted on both /dev/sda2 AND /dev/sdb2
  • Even stranger, if I list /dev, there ARE no sda or sdb devices, my disk now shows as /dev/sdc, /dev/sdc1, and /dev/sdc2
Some of this is a timing issue I think. On a cold (power up) boot the Pi is trying to mount the disk before it has spun up to to speed. However these problems occur if I restart the Pi only with the disk already spinning, so it may also be something to do with the time it takes to enumerate devices and create the entries in /dev.

Am I on a hiding to nothing here and i'd be better off starting from scratch, or is there a way of persuading the Pi to wait for the disk devices to be ready before i tries to mount them?

Any hints much appreciated.


PS: What AM I doing wrong with the BBCode for numbered lists in the forum? I can never get them to work...

Andresen
Posts: 29
Joined: Tue Aug 14, 2012 10:25 pm

Re: Wait for hard disk during boot

Wed May 01, 2013 10:01 pm

Try to add a boot_delay, by adding something like:

Code: Select all

boot_delay=32
to your /boot/cmdline.txt. I have / on an usb-disk and my file is:

Code: Select all

[email protected] ~ $ cat /boot/cmdline.txt 
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/sda2 boot_delay=32 rootfstype=ext4 elevator=deadline rootwait
[email protected] ~ $ 
Regards,
Andresen

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Wait for hard disk during boot

Wed May 01, 2013 10:40 pm

What are the units?

Is 32 32 seconds?
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

Andresen
Posts: 29
Joined: Tue Aug 14, 2012 10:25 pm

Re: Wait for hard disk during boot

Thu May 02, 2013 5:30 am

Joe Schmoe wrote:What are the units?

Is 32 32 seconds?
I don't recall it as the pi waits 32 seconds .. but from http://www.raspberrypi.org/phpBB3/viewt ... 50&t=22809 sure it does look the unit is seconds...

Regards,
Andresen

Return to “Troubleshooting”