Monday, June 30, 2014

OpenWRT - Mount rootfs on External Storage

Unable to install more software on OpenWRT ? Below is how to extend the storage using USB drive.

1. What is need :
-OpenWRT Router with USB port
-Any USB Storage

2. opkg update
opkg install kmod-fs-ext4 kmod-usb-storage-extras block-mount

3. Create new partition on USB storage using gparted, 1st partition is Swap partition 64M ( size is depend on your router model, usually mem size x2), 2nd partition is ext3 partition.

4. Duplicate the rootfs to USB storage
root@OpenWrt:/etc/config# mkdir /mnt/usb
root@OpenWrt:/etc/config# mount /dev/sda2 /mnt/usb/
root@OpenWrt:/etc/config# mkdir /tmp/root
root@OpenWrt:/etc/config# mount -o bind / /tmp/root
root@OpenWrt:/etc/config# cp /tmp/root/* /mnt/usb -a
root@OpenWrt:/etc/config# umount /tmp/root/
root@OpenWrt:/etc/config# ls /mnt/usb/

5. Edit the fstab using ssh terminal / putty and add configs below.
# vi /etc/config/fstab
config 'mount'
        option 'target' '/mnt/usb'
        option 'device' '/dev/sda2'
        option 'fstype' 'ext3'
        option 'options' 'rw,sync'
        option 'enabled' '1'
        option 'is_rootfs' '1'
        option 'enabled_fsck' '1'
config 'swap'                    
        option 'device' '/dev/sda1'
        option 'enabled' '1'

6. reboot & verify

No comments:

Post a Comment