Mounting a USB flash drive in libreCMC

If you are in need of more storage space on your router and have a properly functioning USB port you can mount an ext4 formatted drive. The following directions should work on most if not all releases of libreCMC, but that said the directions were validated on a TPE-R1300 running libreCMC 1.5.13.

Step 1: Open a terminal and connect to the router via ssh (this assumes you are on a distribution or operating system with ssh)

ssh root@192.168.10.1

No password is set by default, but the password will be the same as the one you use to login to the router via the web user interface.

Step 2: Install the following packages

opkg update && opkg install block-mount e2fsprogs kmod-fs-ext4 kmod-usb-storage kmod-usb2 kmod-usb3

Step 3: Identify the partitions and drive you want to mount

ls -al /dev/sd*

Step 4: Create a folder to mount the flash drive

mkdir /sda1

Step 5: Mount a flash drive that has a ext4 formatted partition on it

mount /dev/sda1 /sda1

Note: You might have to replace /dev/sda1 with whatever the output is in step 3 to reflect what your USB drive shows up as

Step 6: Verify it's mounted

df -h

Note: It should show you a line with /dev/sda1 and where it is mounted (in our example /sda1) and how much usable space is on the drive

Step 7: You can also now change to the directory you mounted

cd /sda1

Step 8: You can write a file to it

touch hello.txt

Step 9: You can unmount the partition and remove the drive and then see that file you created on a computer (running GNU/Linux or another OS that supports ext4 at least)

cd /
umount /sda1

Step 10: Connect your USB drive to a computer running GNU/Linux and you should see your file hello.txt on the drive

If you want to mount the device automatically you can ssh back into the router and run the following commands:

block detect | uci import fstab
uci set fstab.@mount[0].enabled='1' && uci set fstab.@global[0].anon_mount='1' && uci commit fstab
/etc/init.d/fstab boot