Announcement

Collapse
No announcement yet.

[solved] External disk not mounting on boot

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [solved] External disk not mounting on boot

    I have an external hard disk connected via usb, identified as sdb. The partition being used is sdb2. It is all set up in /etc/fstab and will mount happily if, after boot, I just type mount -a

    The fstab entry is: /dev/sdb2 /media/drivex ext4 auto,user,exec,async 0 0

    However, during boot up, the disk doesn't connect. If I use the safe mode to see all the system messages, a message flashes by saying something like 'mounting special device on /dev/sdb2 [failed]'. dmesg doesn't seem to offer any clues:

    dmesg | grep sdb
    [ 9.302685] sd 2:0:0:0: [sdb] 976773168 512-byte hardware sectors: (500 GB/465 GiB)
    [ 9.303329] sd 2:0:0:0: [sdb] Write Protect is off
    [ 9.303339] sd 2:0:0:0: [sdb] Mode Sense: 00 38 00 00
    [ 9.303345] sd 2:0:0:0: [sdb] Assuming drive cache: write through
    [ 9.304193] sd 2:0:0:0: [sdb] 976773168 512-byte hardware sectors: (500 GB/465 GiB)
    [ 9.304820] sd 2:0:0:0: [sdb] Write Protect is off
    [ 9.304831] sd 2:0:0:0: [sdb] Mode Sense: 00 38 00 00
    [ 9.304837] sd 2:0:0:0: [sdb] Assuming drive cache: write through
    [ 9.304850] sdb: sdb1 sdb2
    [ 9.312580] sd 2:0:0:0: [sdb] Attached SCSI disk
    [ 48.321225] EXT4 FS on sdb2, internal journal on sdb2:8

    You can see where I manually mounted the disk at 48 seconds, but there's no sort of error message from the boot process. Anybody got any thoughts?

    #2
    Re: External disk not mounting on boot

    I think the answer basically goes "internal hard drives are one thing, and USB drives are another".

    Internal hard drives (PATA and SATA) are handled by the libata driver, and are automatically mounted as part of the boot process, according to the /etc/fstab mount table.

    External USB drives are different deal altogether. They are seen by the system as a "pluggable" device, along with digital cameras, cell phones, memory sticks, and whatever else has a USB connector. These things are mounted by HAL, upon being detected on the USB bus. The USB bus is not "read" by the system during boot, AFAIK, but sometime soon thereafter. So your external drive is not going to mount during boot.

    If this is a drive that you plan to leave permanently connected, such that you want it mounted every time you boot your computer, then you just need a little bash script that says "mount -a" and you need to set that script to run at every boot into KDE. Here you go:

    #!/bin/bash
    sh -c 'mount -a'
    sleep 5
    echo "External drive mounted and ready"
    #end
    Save as "go-drv.sh" in your user folder, and then make it executable with
    Code:
    chmod +x go-drv.sh
    Test it first. Boot your computer, then open a Konsole window, and enter
    Code:
    sh go-drv.sh
    and observe that it does its job correctly. If so, then open System Settings>Advanced>Autostart and hit "Add Script" and add go-drv.sh to start immediately after boot. Save the settings.


    p.s. Errors will result if you don't have your drive plugged in, and you boot your system ....

    Comment


      #3
      Re: External disk not mounting on boot

      That's really helpful. I thought I was doing something wrong with the fstab, but knowing an external disk will never mount that way is what I needed to know.

      I've actually solved the issue in a slightly different way to your suggestion. I created the script you suggested, but put it into /etc/init.d (the script was called mountdrivex.sh). Then I ran

      sudo update-rc mountdrivex.sh defaults

      as detailed here and that's working just fine.

      Many thanks.

      Comment

      Working...
      X