public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] External hard disk doesn't mount on boot
@ 2008-03-20 14:22 Dan Cowsill
  2008-03-20 16:01 ` Alan McKinnon
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Cowsill @ 2008-03-20 14:22 UTC (permalink / raw
  To: gentoo-user

Right, so I have an external USB hard drive always hooked up to my
machine.  I've a listing in /etc/fstab to mount it at boot.
Unfortunately, the drive does not boot because localmount can't find
/dev/sda1.  Now, after the boot process I can find /dev/sda1 and mount
the drive just fine, leading me to believe that localmount tries to
mount the drive without populating /dev with USB devices.

How could I resolve this?

Thanks
-- 
Dan Cowsill
http://www.danthehat.net
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] External hard disk doesn't mount on boot
  2008-03-20 14:22 [gentoo-user] External hard disk doesn't mount on boot Dan Cowsill
@ 2008-03-20 16:01 ` Alan McKinnon
  2008-03-20 17:21   ` Dan Cowsill
  2008-03-20 17:22   ` Dan Cowsill
  0 siblings, 2 replies; 9+ messages in thread
From: Alan McKinnon @ 2008-03-20 16:01 UTC (permalink / raw
  To: gentoo-user

On Thursday 20 March 2008, Dan Cowsill wrote:
> Right, so I have an external USB hard drive always hooked up to my
> machine.  I've a listing in /etc/fstab to mount it at boot.
> Unfortunately, the drive does not boot because localmount can't find
> /dev/sda1.  Now, after the boot process I can find /dev/sda1 and
> mount the drive just fine, leading me to believe that localmount
> tries to mount the drive without populating /dev with USB devices.
>
> How could I resolve this?

The canonical way is of course to use udev to run a mount script as soon 
as the usb drive's device is created. This is hard and requires much 
googling.

The hackish, kludgy, totally not recommended method that always works is 
to put a call to 'mount -a' in /etc/local.d/local.start 

:-)


-- 
Alan McKinnon
alan dot mckinnon at gmail dot com

-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] External hard disk doesn't mount on boot
  2008-03-20 16:01 ` Alan McKinnon
@ 2008-03-20 17:21   ` Dan Cowsill
  2008-03-20 17:22   ` Dan Cowsill
  1 sibling, 0 replies; 9+ messages in thread
From: Dan Cowsill @ 2008-03-20 17:21 UTC (permalink / raw
  To: gentoo-user

On Thu, Mar 20, 2008 at 11:01 AM, Alan McKinnon <alan.mckinnon@gmail.com> wrote:
>
> On Thursday 20 March 2008, Dan Cowsill wrote:
>  > Right, so I have an external USB hard drive always hooked up to my
>  > machine.  I've a listing in /etc/fstab to mount it at boot.
>  > Unfortunately, the drive does not boot because localmount can't find
>  > /dev/sda1.  Now, after the boot process I can find /dev/sda1 and
>  > mount the drive just fine, leading me to believe that localmount
>  > tries to mount the drive without populating /dev with USB devices.
>  >
>  > How could I resolve this?
>
>  The canonical way is of course to use udev to run a mount script as soon
>  as the usb drive's device is created. This is hard and requires much
>  googling.
>
>  The hackish, kludgy, totally not recommended method that always works is
>  to put a call to 'mount -a' in /etc/local.d/local.start
>
>  :-)
>
>
>  --
>  Alan McKinnon
>  alan dot mckinnon at gmail dot com
>
>  --
>  gentoo-user@lists.gentoo.org mailing list
>
>

I'll look into the canonical and implement the hackish.  Thanks for
the help, I'll report back when I can.

Cheers

-- 
Dan Cowsill
http://www.danthehat.net
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] External hard disk doesn't mount on boot
  2008-03-20 16:01 ` Alan McKinnon
  2008-03-20 17:21   ` Dan Cowsill
@ 2008-03-20 17:22   ` Dan Cowsill
  2008-03-20 17:49     ` Alan McKinnon
  2008-03-20 18:13     ` Dan Cowsill
  1 sibling, 2 replies; 9+ messages in thread
From: Dan Cowsill @ 2008-03-20 17:22 UTC (permalink / raw
  To: gentoo-user

On Thu, Mar 20, 2008 at 11:01 AM, Alan McKinnon <alan.mckinnon@gmail.com> wrote:
>
> On Thursday 20 March 2008, Dan Cowsill wrote:
>  > Right, so I have an external USB hard drive always hooked up to my
>  > machine.  I've a listing in /etc/fstab to mount it at boot.
>  > Unfortunately, the drive does not boot because localmount can't find
>  > /dev/sda1.  Now, after the boot process I can find /dev/sda1 and
>  > mount the drive just fine, leading me to believe that localmount
>  > tries to mount the drive without populating /dev with USB devices.
>  >
>  > How could I resolve this?
>
>  The canonical way is of course to use udev to run a mount script as soon
>  as the usb drive's device is created. This is hard and requires much
>  googling.
>
>  The hackish, kludgy, totally not recommended method that always works is
>  to put a call to 'mount -a' in /etc/local.d/local.start
>
>  :-)
>
>
>  --
>  Alan McKinnon
>  alan dot mckinnon at gmail dot com
>
>  --
>  gentoo-user@lists.gentoo.org mailing list
>
>

http://gentoo-wiki.com/UDEV

Am I on the right track here?

-- 
Dan Cowsill
http://www.danthehat.net
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] External hard disk doesn't mount on boot
  2008-03-20 17:22   ` Dan Cowsill
@ 2008-03-20 17:49     ` Alan McKinnon
  2008-03-20 18:13     ` Dan Cowsill
  1 sibling, 0 replies; 9+ messages in thread
From: Alan McKinnon @ 2008-03-20 17:49 UTC (permalink / raw
  To: gentoo-user

On Thursday 20 March 2008, Dan Cowsill wrote:
> On Thu, Mar 20, 2008 at 11:01 AM, Alan McKinnon 
<alan.mckinnon@gmail.com> wrote:
> > On Thursday 20 March 2008, Dan Cowsill wrote:

<snip>

> >  > How could I resolve this?
> >
> >  The canonical way is of course to use udev to run a mount script
> > as soon as the usb drive's device is created. This is hard and
> > requires much googling.

<snip>

> http://gentoo-wiki.com/UDEV
>
> Am I on the right track here?

Yup, that's the one

I find udev to be a wonderful solution to a tricky problem, but be 
warned - it has a history of changing rapidly with confusing results. 
But having said that it does seem to have stabilised nicely in recent 
times - Greg KH must be finding less and less stuff to take out and 
thus achieving perfection in design.

The wiki page is a good read and an excellent thing to know a lot about 
IMHO

-- 
Alan McKinnon
alan dot mckinnon at gmail dot com

-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] External hard disk doesn't mount on boot
  2008-03-20 17:22   ` Dan Cowsill
  2008-03-20 17:49     ` Alan McKinnon
@ 2008-03-20 18:13     ` Dan Cowsill
  2008-03-20 18:22       ` Mark Knecht
  2008-03-20 18:25       ` Dan Cowsill
  1 sibling, 2 replies; 9+ messages in thread
From: Dan Cowsill @ 2008-03-20 18:13 UTC (permalink / raw
  To: gentoo-user

On Thu, Mar 20, 2008 at 12:22 PM, Dan Cowsill <danthehat@gmail.com> wrote:
> On Thu, Mar 20, 2008 at 11:01 AM, Alan McKinnon <alan.mckinnon@gmail.com> wrote:
>  >
>
>
> > On Thursday 20 March 2008, Dan Cowsill wrote:
>  >  > Right, so I have an external USB hard drive always hooked up to my
>  >  > machine.  I've a listing in /etc/fstab to mount it at boot.
>  >  > Unfortunately, the drive does not boot because localmount can't find
>  >  > /dev/sda1.  Now, after the boot process I can find /dev/sda1 and
>  >  > mount the drive just fine, leading me to believe that localmount
>  >  > tries to mount the drive without populating /dev with USB devices.
>  >  >
>  >  > How could I resolve this?
>  >
>  >  The canonical way is of course to use udev to run a mount script as soon
>  >  as the usb drive's device is created. This is hard and requires much
>  >  googling.
>  >
>  >  The hackish, kludgy, totally not recommended method that always works is
>  >  to put a call to 'mount -a' in /etc/local.d/local.start
>  >
>  >  :-)
>  >
>  >
>  >  --
>  >  Alan McKinnon
>  >  alan dot mckinnon at gmail dot com
>  >
>  >  --
>  >  gentoo-user@lists.gentoo.org mailing list
>  >
>  >

Okay, so I wrote a new rule into rules.d that goes like this:

KERNEL=="sda", RUN+="/bin/mount -t ntfs-3g /dev/sda1 /home/dcowsill/usb"

Now, this works (sort of).  If I were to run udevstart, udev would
happily execute mount on the usb drive and all would be well.  If the
system is restarted or the device is plugged in, no joy.

So why is this only executing when I use udevstart?

-- 
Dan Cowsill
http://www.danthehat.net
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] External hard disk doesn't mount on boot
  2008-03-20 18:13     ` Dan Cowsill
@ 2008-03-20 18:22       ` Mark Knecht
  2008-03-20 18:27         ` [gentoo-user] [SOLVED] " Dan Cowsill
  2008-03-20 18:25       ` Dan Cowsill
  1 sibling, 1 reply; 9+ messages in thread
From: Mark Knecht @ 2008-03-20 18:22 UTC (permalink / raw
  To: gentoo-user

On Thu, Mar 20, 2008 at 11:13 AM, Dan Cowsill <danthehat@gmail.com> wrote:
> On Thu, Mar 20, 2008 at 12:22 PM, Dan Cowsill <danthehat@gmail.com> wrote:
>  > On Thu, Mar 20, 2008 at 11:01 AM, Alan McKinnon <alan.mckinnon@gmail.com> wrote:
>  >  >
>  >
>  >
>  > > On Thursday 20 March 2008, Dan Cowsill wrote:
>  >  >  > Right, so I have an external USB hard drive always hooked up to my
>  >  >  > machine.  I've a listing in /etc/fstab to mount it at boot.
>  >  >  > Unfortunately, the drive does not boot because localmount can't find
>  >  >  > /dev/sda1.  Now, after the boot process I can find /dev/sda1 and
>  >  >  > mount the drive just fine, leading me to believe that localmount
>  >  >  > tries to mount the drive without populating /dev with USB devices.
>  >  >  >
>  >  >  > How could I resolve this?
>  >  >
>  >  >  The canonical way is of course to use udev to run a mount script as soon
>  >  >  as the usb drive's device is created. This is hard and requires much
>  >  >  googling.
>  >  >
>  >  >  The hackish, kludgy, totally not recommended method that always works is
>  >  >  to put a call to 'mount -a' in /etc/local.d/local.start
>  >  >
>  >  >  :-)
>  >  >
>  >  >
>  >  >  --
>  >  >  Alan McKinnon
>  >  >  alan dot mckinnon at gmail dot com
>  >  >
>  >  >  --
>  >  >  gentoo-user@lists.gentoo.org mailing list
>  >  >
>  >  >
>
>  Okay, so I wrote a new rule into rules.d that goes like this:
>
>  KERNEL=="sda", RUN+="/bin/mount -t ntfs-3g /dev/sda1 /home/dcowsill/usb"
>
>  Now, this works (sort of).  If I were to run udevstart, udev would
>  happily execute mount on the usb drive and all would be well.  If the
>  system is restarted or the device is plugged in, no joy.
>
>  So why is this only executing when I use udevstart?
>
Good work Dan. I'll save this thread for future reference.

As someone who has used lots of external drives in the past you might
want to do your mount by label or some sort of drive specific UUID and
not by /dev/sda1. What can happen over time is that you'll add a
second drive and because USB or 1394 often do device discovery order
by which drive spins up first two identical drives will come up in
random orders which switches your mounting around strangely.

I've had good luck just mounting by label without using udev but I've
wanted to figure this out. You've given me a nice start. thanks.

Cheers,
Mark
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] [SOLVED] External hard disk doesn't mount on boot
  2008-03-20 18:13     ` Dan Cowsill
  2008-03-20 18:22       ` Mark Knecht
@ 2008-03-20 18:25       ` Dan Cowsill
  1 sibling, 0 replies; 9+ messages in thread
From: Dan Cowsill @ 2008-03-20 18:25 UTC (permalink / raw
  To: gentoo-user

On Thu, Mar 20, 2008 at 1:13 PM, Dan Cowsill <danthehat@gmail.com> wrote:
>
> On Thu, Mar 20, 2008 at 12:22 PM, Dan Cowsill <danthehat@gmail.com> wrote:
>  > On Thu, Mar 20, 2008 at 11:01 AM, Alan McKinnon <alan.mckinnon@gmail.com> wrote:
>  >  >
>  >
>  >
>  > > On Thursday 20 March 2008, Dan Cowsill wrote:
>  >  >  > Right, so I have an external USB hard drive always hooked up to my
>  >  >  > machine.  I've a listing in /etc/fstab to mount it at boot.
>  >  >  > Unfortunately, the drive does not boot because localmount can't find
>  >  >  > /dev/sda1.  Now, after the boot process I can find /dev/sda1 and
>  >  >  > mount the drive just fine, leading me to believe that localmount
>  >  >  > tries to mount the drive without populating /dev with USB devices.
>  >  >  >
>  >  >  > How could I resolve this?
>  >  >
>  >  >  The canonical way is of course to use udev to run a mount script as soon
>  >  >  as the usb drive's device is created. This is hard and requires much
>  >  >  googling.
>  >  >
>  >  >  The hackish, kludgy, totally not recommended method that always works is
>  >  >  to put a call to 'mount -a' in /etc/local.d/local.start
>  >  >
>  >  >  :-)
>  >  >
>  >  >
>  >  >  --
>  >  >  Alan McKinnon
>  >  >  alan dot mckinnon at gmail dot com
>  >  >
>  >  >  --
>  >  >  gentoo-user@lists.gentoo.org mailing list
>  >  >
>  >  >
>
>  Okay, so I wrote a new rule into rules.d that goes like this:
>
>  KERNEL=="sda", RUN+="/bin/mount -t ntfs-3g /dev/sda1 /home/dcowsill/usb"
>
>  Now, this works (sort of).  If I were to run udevstart, udev would
>  happily execute mount on the usb drive and all would be well.  If the
>  system is restarted or the device is plugged in, no joy.
>
>  So why is this only executing when I use udevstart?
>
>
>
>  --
>  Dan Cowsill
>  http://www.danthehat.net
>

Yeh, I wasn't being specific enough with my rule.  This rule (revised)
works perfectly:

KERNEL=="sda1", RUN+="/bin/mount -t ntfs-3g /dev/sda1 /home/dcowsill/usb"

Thanks Alan, for putting me on the right track.  Also, much
appreciation goes to Greg Kroah-Hartman, who wrote udevtest!

Cheers
-- 
Dan Cowsill
http://www.danthehat.net
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] [SOLVED] External hard disk doesn't mount on boot
  2008-03-20 18:22       ` Mark Knecht
@ 2008-03-20 18:27         ` Dan Cowsill
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Cowsill @ 2008-03-20 18:27 UTC (permalink / raw
  To: gentoo-user

On Thu, Mar 20, 2008 at 1:22 PM, Mark Knecht <markknecht@gmail.com> wrote:
>
> On Thu, Mar 20, 2008 at 11:13 AM, Dan Cowsill <danthehat@gmail.com> wrote:
>  > On Thu, Mar 20, 2008 at 12:22 PM, Dan Cowsill <danthehat@gmail.com> wrote:
>  >  > On Thu, Mar 20, 2008 at 11:01 AM, Alan McKinnon <alan.mckinnon@gmail.com> wrote:
>  >  >  >
>  >  >
>  >  >
>  >  > > On Thursday 20 March 2008, Dan Cowsill wrote:
>  >  >  >  > Right, so I have an external USB hard drive always hooked up to my
>  >  >  >  > machine.  I've a listing in /etc/fstab to mount it at boot.
>  >  >  >  > Unfortunately, the drive does not boot because localmount can't find
>  >  >  >  > /dev/sda1.  Now, after the boot process I can find /dev/sda1 and
>  >  >  >  > mount the drive just fine, leading me to believe that localmount
>  >  >  >  > tries to mount the drive without populating /dev with USB devices.
>  >  >  >  >
>  >  >  >  > How could I resolve this?
>  >  >  >
>  >  >  >  The canonical way is of course to use udev to run a mount script as soon
>  >  >  >  as the usb drive's device is created. This is hard and requires much
>  >  >  >  googling.
>  >  >  >
>  >  >  >  The hackish, kludgy, totally not recommended method that always works is
>  >  >  >  to put a call to 'mount -a' in /etc/local.d/local.start
>  >  >  >
>  >  >  >  :-)
>  >  >  >
>  >  >  >
>  >  >  >  --
>  >  >  >  Alan McKinnon
>  >  >  >  alan dot mckinnon at gmail dot com
>  >  >  >
>  >  >  >  --
>  >  >  >  gentoo-user@lists.gentoo.org mailing list
>  >  >  >
>  >  >  >
>  >
>  >  Okay, so I wrote a new rule into rules.d that goes like this:
>  >
>  >  KERNEL=="sda", RUN+="/bin/mount -t ntfs-3g /dev/sda1 /home/dcowsill/usb"
>  >
>  >  Now, this works (sort of).  If I were to run udevstart, udev would
>  >  happily execute mount on the usb drive and all would be well.  If the
>  >  system is restarted or the device is plugged in, no joy.
>  >
>  >  So why is this only executing when I use udevstart?
>  >
>  Good work Dan. I'll save this thread for future reference.
>
>  As someone who has used lots of external drives in the past you might
>  want to do your mount by label or some sort of drive specific UUID and
>  not by /dev/sda1. What can happen over time is that you'll add a
>  second drive and because USB or 1394 often do device discovery order
>  by which drive spins up first two identical drives will come up in
>  random orders which switches your mounting around strangely.
>
>  I've had good luck just mounting by label without using udev but I've
>  wanted to figure this out. You've given me a nice start. thanks.
>
>  Cheers,
>  Mark
>  --
>
>
> gentoo-user@lists.gentoo.org mailing list
>
>

Yeh, I only opted for matching the kernel name of the device because
the headless server I'm working on very likely will never encounter a
new USB device.  But the rule would be more robust.

Glad I could help.

Cheers

-- 
Dan Cowsill
http://www.danthehat.net
-- 
gentoo-user@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-03-20 18:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-20 14:22 [gentoo-user] External hard disk doesn't mount on boot Dan Cowsill
2008-03-20 16:01 ` Alan McKinnon
2008-03-20 17:21   ` Dan Cowsill
2008-03-20 17:22   ` Dan Cowsill
2008-03-20 17:49     ` Alan McKinnon
2008-03-20 18:13     ` Dan Cowsill
2008-03-20 18:22       ` Mark Knecht
2008-03-20 18:27         ` [gentoo-user] [SOLVED] " Dan Cowsill
2008-03-20 18:25       ` Dan Cowsill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox