New extroot configuration?

Hello
Due to some constant reboots of my router I have decided to downgrade the version of OpenWRT now I use 18.06.8 however I realized that the method I used to do Extroot (explained here) is no longer useful and now on the same website the router tells me that these steps should be followed:
mkdir -p / tmp / introot
mkdir -p / tmp / extroot
mount --bind / / tmp / introot
mount / dev / sda1 / tmp / extroot
tar -C / tmp / introot -cvf -. | tar -C / tmp / extroot -xf -
umount / tmp / introot
umount / tmp / extroot
My question is when do I change this and what happened to the previous method?
Thank you

introot can not be found anywhere in the OpenWrt wiki.

yes maybe (actually i dont checked in the wiki and only guide me by the config page of the router)
but only with that configuration i can finally start my router via the usb port i was triple check the officials configurations (from the wiki) and everything its ok but never mounted the usb and after every reboot, the configuration show disabled the fstab exroot config

My extroot recipe has been the same since LEDE (or maybe even Chaos Calmer), and it still works on 19.07.x (did it on two devices today).

Looking at my method vs the one in the OP and compared to the wiki article (a quick glance at each), they seem like they should all be valid, assuming no syntax issues.

The major difference between what I've been using and the Wiki seems to be the use cp instead or tar and then UCI commands instead of writing directly to the fstab config file. I'm not sure that the exact method matters, but I know mine does work (I'll happily listen and try another method if someone tells me that my method is not optimal for some specific reason).

My extroot process
# Pivot to extroot
mount /dev/sda1 /mnt ; tar -C /overlay -cvf - . | tar -C /mnt -xf - ; umount /mnt

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;
   
reboot

1 Like

I might as well give my recipe that I got from 2017 version of https://openwrt.org/docs/guide-user/additional-software/extroot_configuration

I just used it on 19.07.3

opkg update && opkg install block-mount curl e2fsprogs fdisk kmod-fs-ext4 kmod-usb-ohci kmod-usb-storage kmod-usb-uhci nano

ls /dev
# to find sda number of the USB drive

mkfs.ext4 /dev/sda1

mount /dev/sda1 /mnt ; tar -C /overlay -cvf - . | tar -C /mnt -xf - ; umount /mnt

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;

nano /etc/config/fstab

# Add this to the end of the file


        option  fstype  'ext4'
        option  enabled '1'

2 Likes

tar is more appropriate as it will maintain all file and folder attributes. cp works fine in our case however since there is only root user and group, but creation time will be reset.

1 Like