OpenWrt Forum Archive

Topic: Cannot configure FSTAB to automount USB drive

The content of this topic has been archived on 7 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I am trying to mount my USB drive automatically during startup but I am having little success.  For the sake of troubleshooting I have installed a fresh copy of OPENWRT (openwrt-brcm-2.4-squashfs) on my ASUS WL500GPv2.  I can mount my USB drive using the mount command but I would like it to be automatically mounted on startup by FSTAB.  Maybe I am doing something that wrong?  Any help would be appreciated since I'm pretty much at the point of banging my head against the wall.

Here is what I have done so far:

1) FRESH INSTALL -- openwrt-brcm-2.4-squashfs.trx

2) INSTALL USB DRIVERS AND SOFTWARE

    Install USB Utils - installs lsusb
    #opkg install usbutils

    Kernel driver for USB2 controllers
    #opkg install kmod-usb2

    Kernel modules for USB storage support
    #opkg install kmod-usb-storage

    Kernel driver for OHCI USB controllers
    #opkg install kmod-usb-ohci

    Support for Fat filesystems
    #opkg install kmod-fs-vfat

    Install Fdisk
    #opkg install fdisk


3) TRY AND MOUNT DISK MANUALLY -- SUCCESS!

    Create Mount Point
    #mkdir /mnt/usbdisk

    Get disk information
    #fdisk -l
    >/dev/scsi/host0/bus0/target0/lun0/part1

    Mount the drive
    #mount /dev/scsi/host0/bus0/target0/lun0/part1 /mnt/usbdisk

    Go to directory
    #cd /mnt/usbdisk
    #ls
    SHOWS FILES ON DISK-- HOORAY!


4) INSTALL BLOCK-MOUNT AND BLOCK-HOTPLUG THEN CONFIGURE
   
    Scripts used to mount and check block devices
    #opkg install block-mount

    Scripts used to automatically check and mount filesystem and/or swap
    #opkg install block-hotplug

    Comment out line 45 - echo... from /etc/init.d/fstab
    #vi /etc/init.d/fstab

    Modify mount point settings via LUCI interface and save


/etc/config/fstab:
--------------

config 'global' 'automount'
        option 'from_fstab' '1'
        option 'anon_mount' '1'

config 'global' 'autoswap'
        option 'from_fstab' '1'
        option 'anon_swap' '0'

config 'mount'
        option 'options' 'rw,sync'
        option 'enabled_fsck' '0'
        option 'enabled' '1'
        option 'device' '/dev/scsi/host0/bus0/target0/lun0/part1'
        option 'target' '/mnt/usbdisk'
        option 'fstype' 'auto'

config 'swap'
        option 'device' '/dev/sda2'
        option 'enabled' '0'

config 'mount'
        option 'enabled' '0'

~
-----------

    Commit FSTAB Changes
    #uci commit fstab

    RESTART


5) WHEN I RESTART DRIVE IS NOT MOUNTED!!!!--- THIS IS WHERE I NEED HELP PLEASE


/etc/fstab is a symlink to /tmp/fstab:
lrwxrwxrwx    1 root     root           10 Apr  6  2010 fstab -> /tmp/fstab


there is no file in /tmp/fstab


when I run "mount -a" I get the following response:
mount: cannot read /etc/fstab: No such file or directory

I am thinking the UCI system is not creating the proper file for the mount points??  Is there something I am doing wrong here?

Thanks in advance!!
-Jason

UPDATE:

I created a custom boot file similar to the post: https://forum.openwrt.org/viewtopic.php?id=27210

The boot file just issues the mount command to mount the drive.  It seems to be mounted on boot.  Is this the proper way to go about this??

opkg  install kmod-nls-cp437 kmod-nls-iso8859-1
/etc/init.d/fstab enable

and

config 'mount'
        option 'options' 'rw'
        option 'enabled_fsck' '0'
        option 'enabled' '1'
        option 'device' '/dev/scsi/host0/bus0/target0/lun0/part1'
        option 'target' '/mnt/usbdisk'
        option 'fstype' 'vfat'

Thanks.  I installed the packages, enabled the fstab, and changed my fstab config file.  When I restart, the drive does NOT show up.  I can issue an /etc/init.d/fstab start and I get an error that it can't find a file(/tmp/fstab) but the drive mounts.   I took the advise from this posting https://forum.openwrt.org/viewtopic.php?id=27210 and put "sleep 20" in the start section of the /etc/init.d/fstab file.  (I'm using a USB stick) When I restart, the drive shows up.  Is this now the right way to do this??

Just upgraded to backfire RC5 and my USB HDD disk did not mount at boot time anymore. It was working just fine before upgrading. After reading this thread I also added a "sleep 15" to /etc/init.d/fstab and now it mounts fine at boot time.

Looks like a bug on RC versions (at least RC5)  because I was running Trunk before and it worked.

I had similar problem in rc5 after installing block-mount and I was using sleep 15
in /etc/init.d/fstab workaround, but after installing block-hotplug it stopped to be necessary.

(Last edited by morgwai on 22 Sep 2011, 23:27)

The discussion might have continued from here.