Unable to extroot DLink D860L B1

Hey!
I'm unable to make extroot to stay. My commands after fresh wipe:

opkg update
opkg install block-mount e2fsprogs fdisk kmod-fs-ext4 kmod-usb-core kmod-usb-storage kmod-usb3 
mount /dev/sda2 /mnt
mkdir /tmp/cproot
mount --bind / /tmp/cproot 
tar -C /tmp/cproot -cvf - . | tar -C /mnt -xvf - 
sync ; umount /mnt 
umount /tmp/cproot
block detect > /etc/config/fstab
service fstab enable

vi /etc/config/fstab :

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  '/mnt/sda1'
        #option uuid    'eea2bd2c-02d3-4c60-b45f-6d5898d952e1'
        option  enabled '1'
        option  device  '/dev/sda1'

config 'mount'
        option  target  '/overlay'
        #option uuid    '51d6bcd2-0082-478f-9b58-7f78b1f04847'
        option  enabled '1'
        option  device  '/dev/sda2'

config 'swap'
        option  device  '/dev/sda3'
        option  enabled '0'

service fstab enable

The above is my full configuration but it cannot make the extroot to work. Despide /dev/sda2 being >800MB it gets out of space so it's still installing onto the /dev/mtblock8 which is the default /overlay partition. In Luci, under 'software' it says the correct size of >800MB.
I've tried 19.0.x, 18.x, 17.x etc. Same outcome.
In df -h it says /dev/sda2 886696 14164 810276 2% /overlay but it's not working.

Please advise what am I doing wrong.

I think your fstab command is wrong. Here is how I have done the pivot to extroot:

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

Note that I use sda1. It appeaoyou are using sda2, so adjust accordingly.

Also assuming you are already using an ext4 formatted partition.

1 Like

Thank for the reply.
Just tested the code provided. Can't really see a difference between my original fstab and what the code does to it. I believe it is searching for the "enabled '0'" option and changes it to '1' and the '/mnt/sda1' into '/overlay', which were already setup in the fstab provided. Am I mistaken?
Yes, I am using a formatted ext4 partition and /mnt/sda2 for my "soon to be" extroot.

Can we see the output of mount and df -h?

1 Like

Before 'mount /dev/sda2 /overlay'

*root@OpenWrt:~# df -h*
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.5M      2.5M         0 100% /rom
tmpfs                    60.5M    260.0K     60.2M   0% /tmp
/dev/mtdblock8           11.6M      7.3M      4.2M  64% /overlay
overlayfs:/overlay       11.6M      7.3M      4.2M  64% /
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/sda1                 1.3T      1.2T     32.9G  97% /mnt/sda1

*root@OpenWrt:~# mount*
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/mtdblock8 on /overlay type jffs2 (rw,noatime)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
/dev/sda1 on /mnt/sda1 type ext4 (rw,relatime,data=ordered)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)

After 'mount /dev/sda2 /overlay'

*root@OpenWrt:~# df -h*
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.5M      2.5M         0 100% /rom
tmpfs                    60.5M    260.0K     60.2M   0% /tmp
/dev/mtdblock8          865.9M     17.8M    787.3M   2% /overlay
overlayfs:/overlay       11.6M      7.3M      4.2M  64% /
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/sda1                 1.3T      1.2T     32.9G  97% /mnt/sda1
/dev/sda2               865.9M     17.8M    787.3M   2% /overlay

*root@OpenWrt:~# mount*
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/mtdblock8 on /overlay type jffs2 (rw,noatime)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
/dev/sda1 on /mnt/sda1 type ext4 (rw,relatime,data=ordered)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
/dev/sda2 on /overlay type ext4 (rw,relatime,data=ordered)

cat /etc/config/fstab

root@OpenWrt:~# cat /etc/config/fstab
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  '/mnt/sda1'
        option  uuid    'eea2bd2c-02d3-4c60-b45f-6d5898d952e1'
        option  enabled '1'

config 'mount'
        option  target  '/overlay'
        option  uuid    'b290cbb0-d7d0-4146-9fa1-8cafbd216d3a'
        option  enabled '1'

config 'swap'
        option  device  '/dev/sda3'
        option  enabled '1'

Even though I've got the 'option enabled "1"' and 'device /dev/sda2' and 'target /overlay' set into the /etc/config/fstab' the extroot it's not mounting automatically and not working overall, even after manually using the mount command service fstab enabled. It might show correctly in df but installing a package like nmap will result in out of storage errors.

Hmmm. I don’t know. It seems that when you mount manually, it mounts over MTDBLOCK8 (sort of), but it isn’t mounting as its own overlay. I’m not sure how to fix that. Hopefully someone else will have some ideas.

Ok, thank you.
</>
Bump. Still having this issue.