SOLVED: Simple USB Stick Installation Instructions for LEDE

The "crucial part" of extroot (at least for me) is when /etc/config/fstab is created for the fisrt time.

I din't know why, but after rebooting fstab doesn't contain the overlay mount point so in order to overcome this, I copy the contents of fstab before rebooting and after rebooting, paste them again in fstab.

A quick and dirty guide would be like this:

  • Prerequisites:
    cfdisk
    kmod-usb-core
    kmod-usb-storage
    kmod-usb-storage-extras
    kmod-scsi-core
    block-mount
    e2fsprogs
    blkid
    kmod-fs-ext4

  • You may also need (if not installed by default):
    kmod-nls-base
    kmod-nls-cp437
    kmod-nls-iso8859-1
    kmod-nls-utf8

Steps to follow:

  1. Use the cfdisk command to create an ext4 partition on /dev/sda

  2. Create the filesystem
    mkfs.ext4 /dev/sda1

  3. Prepare your external storage root overlay
    mount /dev/sda1 /mnt ; tar -C /overlay -cvf - . | tar -C /mnt -xf - ; umount /mnt

  4. Create fstab

block detect > /etc/config/fstab;
sed -i s/option$'\t'enabled$'\t''0'/option$'\t'enabled$'\t''1'/ /etc/config/fstab;
sed -i s#/mnt/sda1#/overlay# /etc/config/fstab;
cat /etc/config/fstab;

  1. Copy the fstab contents temporarily to a file

  2. Reboot

  3. Edit fstab and paste the contents you have previously copied in the temporary file (if the contents are the same, there is no need for that). Also add "option fstype". The file should look like this:

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'

config 'mount'
option target '/overlay'
option uuid 'c91232a0-c50a-4eae-adb9-14b4d3ce3de1'
option fstype 'ext4'
option enabled '1'

  1. Reboot again and check with df command or alternatively in LuCI (System -> Mount Points) that everything is ok with the overlay and the rest of the partition table.

Normally you are done.

P.S: You probably won't need a swap partition but in the rare case you will, you can also install swap-utils and create a second partition using the cfdisk command which will be the swap. Also create the filesystem using "mkswap /dev/sda2" and follow the rest of the guide.

3 Likes