[Solved] USB device mount problem

Hello!

I recently installed openwrt-ar71xx-generic-tl-wr842n-v2-squashfs-factory.bin to my TL-WR842ND V2 router. Little later I upgraded it with this: lede-17.01.4-ar71xx-generic-tl-wr842n-v2-squashfs-sysupgrade.bin.
I was able to configure the basics on the web GUI. Now I would like to attach and share a drive via USB.
I used this description:
https://lede-project.org/docs/user-guide/usb-drives

Here is the result:
opkg update - successful
opkg install kmod-usb-storage - successful
opkg install usbutils - successful

lsusb -t
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M
|__ Port 1: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 480M

ls -l /dev/sd*
root@LEDE:~# ls -l /dev/sd*
brw------- 1 root root 8, 0 Jan 1 21:43 /dev/sda
brw------- 1 root root 8, 1 Jan 1 21:43 /dev/sda1

opkg install block-mount - successful

So far it's good I think. But by the next step I have no result.
block info | grep "/dev/sd"

As far as I understand the drive wasn't mounted.
Accordingly there is not visible by Mount Points at the GUI but can be seen by SWAP.
I tried 2 USB drive and a 2,5" HDD. The only thing wich was changed is the Device (and therefore its size) by SWAP at the Web GUI
Can somebody help me out what could be the problem?

Regards,
Imre

  • Please post code output and commands within code back ticks (or use the </> button)

.

/dev/sda is the USB drive, and /dev/sda1 is the 1st partition on the drive (in this specific case, your drive currently only has one partition, but if there were more, they'd be listed in ascending chronological order [i.e. sda2, sda3, etc.])

  • You're also going to want to install some additional kmods:

    • opkg update && opkg install kmod-usb-core kmod-usb-storage-extras kmod-usb-ledtrig-usbport kmod-usb2 kmod-fs-cifs kmod-fs-exfat kmod-fs-ext3 kmod-fs-ext4 e2fsprogs kmod-fs-f2fs f2fs-tools kmod-fs-ntfs ntfs-3g ntfs-3g-utils gdisk

.

What's the output of block detect (before and after installing the above packages)?

If wishing to setup network shares for Windows devices, see Samba Configuration (can also be used for BSD/Linux), for BSD/Linux environment, see NFS Configuration

Thanks for the quick reply!
I left out the successfully installed ones from the logs. Unfortunately I went through your post line by line therefore I only have the output of block detect after the installations. If it is necessary I roll back the system to default. Besides that the USB device still not mounted. Correct me if I wrong (I'm not an expert) but I think the drive must be first mounted and only after can be shared via SMB.

  root@LEDE:~# opkg update
Collected errors:
 * pkg_hash_add_from_file: Failed to open /var/opkg-lists/reboot_routing: Out of memory.
root@LEDE:~# opkg install kmod-usb-storage-extras
opkg: unknown sub-command insta▒all
root@LEDE:~# install kmod mod-fs-exfat
-ash: install: not found
root@LEDE:~# opkg install kmod mod-fs-exfat
Installing kmod (20-1) to root...
Downloading http://downloads.lede-project.org/releases/17.01.4/packages/mips_24kc/packages/kmod_20-1_mips_24kc.ipk
Installing zlib (1.2.11-1) to root...
Downloading http://downloads.lede-project.org/releases/17.01.4/packages/mips_24kc/base/zlib_1.2.11-1_mips_24kc.ipk
Unknown package 'mod-fs-exfat'.
Configuring zlib.
Configuring kmod.
Collected errors:
 * opkg_install_cmd: Cannot install package mod-fs-exfat.
root@LEDE:~# opkg install kmod-fs-ext3
Unknown package 'kmod-fs-ext3'.
Collected errors:
 * opkg_install_cmd: Cannot install package kmod-fs-ext3.

root@LEDE:~# opkg install e2fsprogs
root@LEDE:~# opkg install kmod-fs-f2fs
root@LEDE:~# opkg install f2fs-tools
root@LEDE:~# opkg install kmod-fs-ntfs
root@LEDE:~# opkg install ntfs-3g
root@LEDE:~# opkg install ntfs-3g
root@LEDE:~# opkg install ntfs-3g-utils
root@LEDE:~# opkg install gdisk
root@LEDE:~# block detect
config 'global'
        option  anon_swap       '0'
        option  anon_mount      '0'
        option  auto_swap       '1'
        option  auto_mount      '1'
        option  delay_root      '5'
        option  check_fs        '0'

You installed a few things you shouldn't have, as it appears you either mis-typed or didn't copy & paste as a single line, as you installed kmod, which you don't need, as well as zlib, which you also don't need (it's a dependency of kmod), and extfat didn't install since the k was missing from kmod

When you issued block detect, is there a USB drive plugged in? If so, I'm not sure why it's not being detected, however I would recommend backing up your config. flashing again, and starting anew as the output above doesn't make sense

root@LEDE:~# opkg install kmod-usb-storage-extras
opkg: unknown sub-command insta▒all

This is also concerning

  root@LEDE:~# opkg update
Collected errors:
 * pkg_hash_add_from_file: Failed to open /var/opkg-lists/reboot_routing: Out of memory.
1 Like

Yes, USB drive was connected. I flashed again and I configured only the basic settings on the web GUI. (pppoe, wifi, root password) Could you please recommend a guide with which I could mount a drive?

To manually mount...

mount /dev/sda1 /mnt

To automount on reboot, see this section in the LEDE User Guide...

https://lede-project.org/docs/user-guide/usb-drives#automount_the_partition

Some other guides on the OpenWrt site
https://wiki.openwrt.org/doc/howto/usb.essentials
https://wiki.openwrt.org/doc/howto/usb.storage
For Samba
https://wiki.openwrt.org/start?do=search&id=samba

1 Like

Thanks for the guides!

Unfortunately this didn't work.

root@LEDE:~# mount /dev/sda1 /mnt
mount: mounting /dev/sda1 on /mnt failed: I/O error

By the first guide I had this error message:

root@LEDE:~# uci set fstab.@mount[0].enabled='1'
uci: Invalid argument

By USB storage guide mounting part also didn't work,

I also tried this: http://www.geektalks.org/setup-usb-drive-and-sambanas-on-openwrt-from-scratch/
No succcess again by the mounting.
root@OpenWrt:~# block detect > /etc/config/fstab
root@OpenWrt:~# cat /etc/config/fstab
I had only the 'global' part.

I rolled back the default image twice to have the default system again. Can there be something wrong with my router? The factory firmware sometimes recognized the USB devices sometimes not but mostly not.
Maybe it is time to buy a newer router...

That doesn't look good:

Some questions:

  • Are you sure that the current USB drive you are trying to mount is OK? Does this drive work on other machines?
  • Have you tried a different USB drive?
  • What filesystem is the USB drive formatted with?
  • Have you tried re-formatting the USB drive?

I tried with 2 device. One with exfat and one with NTFS. Earlier I tried ext3 as well.
Devices are working well on win10. I used a 3rd party partition manager.
I reformatted on of the device to exfat and started over from sysupgrade.
I tried to mount again but still without success.

root@LEDE:~# block info
/dev/mtdblock2: UUID="babd86bf-59725bf1-d9cfae42-be909ef9" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
/dev/mtdblock3: MOUNT="/overlay" TYPE="jffs2"
root@LEDE:~# mount /dev/sda1 /mnt
root@LEDE:~# block info
/dev/mtdblock2: UUID="babd86bf-59725bf1-d9cfae42-be909ef9" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
/dev/mtdblock3: MOUNT="/overlay" TYPE="jffs2"
root@LEDE:~# mount /dev/sda1 /mnt
mount: mounting /dev/sda1 on /mnt failed: Resource busy
root@LEDE:~#
root@LEDE:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.3M      2.3M         0 100% /rom
tmpfs                    13.8M    728.0K     13.0M   5% /tmp
/dev/mtdblock3            4.4M      1.6M      2.7M  38% /overlay
overlayfs:/overlay        4.4M      1.6M      2.7M  38% /
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/sda1                 7.5G    192.0K      7.5G   0% /mnt
root@LEDE:~# ls -l /dev/sd*
brw-------    1 root     root        8,   0 Jan  1  1970 /dev/sda
brw-------    1 root     root        8,   1 Jan  1  1970 /dev/sda1
root@LEDE:~# mount /dev/sda1 /mnt
mount: mounting /dev/sda1 on /mnt failed: Resource busy
  • This implies there's some other resource accessing, or trying to access, the device, however your device is mounted:
    root@LEDE:~# df -h
    Filesystem                Size    Used        Available    Use%    Mounted on
    /dev/sda1                 7.5G    192.0K      7.5G         0%      /mnt
    

.
Just a general off-topic FYI: I personally don't recommend exfat for a filesystem format due to it's licensing, among other things.

  • If the USB drive/HDD is only ever going to be attached to the router, utilize F2FS or ext3 for USB drive file systems (as you don't want journaling on a USB drive, which ext4 will) and ext4 for the HDD (although xfs is a good file system for multimedia).

  • If the drive is going to be physically used across other devices, ext4 or NTFS are fine (as is HFS+ for Apple products)

    • Although if utilizing on an Android device at some point, it must be exfat unless you're rooted or running Lineage OS/other 3rd party firmware
    • If you have multiple OS architectures you use which include BSD/Linux, and you also utilize Windows, Paragon's Linux File Systems for Windows is worth the $20, as it provides transparent r/w access to BSD/Linux file system.

Thanks for the great summary and the great support!
I reformatted the USB device to ext3 once again and this time it can be mounted successfully. It is visible by block info and as well by mount points at LUCI. Probably I did something wrong last time when I tried ext3.
Exfat still doesn't work (installed packages for file systems: kmod-fs-exfat,kmod-fs-ext4,kmod-fs-ntfs) but for me it doesn't matter I just would like to use an HDD shared with the router. (current dirve is only for testing)

I would have one more question. It is off topic and please just ignore it if it doesn't fit to this forum.
What kind of and how large HDD could I use for this task and with which solution should I attach to the router? I didn't buy them yet. I was thinking about a 1 or 2 TB western digital red HDD with a one bay docking station.

There should be no issue with that, and the only downside is since your router only has a USB2 port, it will be limited to a max transfer speed of ~50MB/s.

  • Ensure you create a decent sized swap partition on the HDD, as it will likely be required for large file transfers.