Hi,
Yes.
Maybe, but you can see for yourself.
If you just want it done without understanding, just try that.
EDIT: For doing everything on linux make sure you have f2fs-tools
installed, specifically fsck.f2fs
.
$ which fsck.f2fs
/usr/sbin/fsck.f2fs
If that is installed, your offset is correct and fsck
doesn't work, try running fsck.f2fs
explicitly.
End EDIT.
If you want to learn how things work and possibly be able to do the expansion on linux before firstboot then here are the steps I recommend.
Flash the image to the sd card.
Determine offset for the overlay area.
Record the contents from that offset to a file with something like: hexdump -Cn 2048 /dev/sdb2 -s $OFFSET | cut -d\ -f 2- >/tmp/hdump-linux-offset
Put the sd-card in the router and boot it.
Log in and check that the loopback for /overlay
is using the exact same offset that you saw on linux.
R4S# losetup -lv
NAME SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE DIO LOG-SEC
/dev/loop0 0 9502720 1 0 /mmcblk1p2 0 512
Check the filesystem used for /overlay
R4S# mount | grep "/overlay"
/dev/loop0 on /overlay type ext4 (rw,noatime)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
I am not running the same image as you are working with so don't expect your output to match mine.
Mine is currently ext4
but your setup might show up as f2fs. *** Especially for standard images ***
It has been posted that the filesystem type for overlay can change and one example was for the size, or amount of added packages in image builder can trigger it.
grab a hexdump of the beginning of /dev/loop0
and save it on your linux system.
R4S# hexdump -Cn 2048 /dev/loop0 | cut -d\ -f 2-
diff
it with the first hexdump from linux.
If it is an exact match then you probably can expand /overlay
on linux before firstboot using the tools appropriate for the filesystem.
Make sure that ypu have the f2fs-tools
package installed on linux if needed.
poweroff
your router and move the sd-card back to linux.
Proceed based on what you learned, adjusting the offset if needed or changing fsck tools etc.
If the hexdumps matched, start again from scratch and try to get it to work.
I did verify commands like losetup mount hexdump
on my R4S but the overall steps were just thought out and some command options on linux may differ slightly so adjust as needed.
Good luck!
This is what the output of hexdump looks like on my router:
R4S# hexdump -Cn 2048 /dev/loop0 | cut -d\ -f 2-
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
e0 5e 00 00 c0 7b 01 00 fc 12 00 00 c6 20 01 00 |.^...{....... ..|
32 5e 00 00 01 00 00 00 00 00 00 00 00 00 00 00 |2^..............|
00 20 00 00 00 20 00 00 e8 07 00 00 c7 0c f9 50 |. ... .........P|
c7 0c f9 50 0b 00 ff ff 53 ef 01 00 01 00 00 00 |...P....S.......|
cf e0 da 63 00 00 00 00 00 00 00 00 01 00 00 00 |...c............|
00 00 00 00 0b 00 00 00 00 01 00 00 3c 00 00 00 |............<...|
c6 02 00 00 6b 04 00 00 c1 6c 28 dd f7 01 41 e6 |....k....l(...A.|
ba cf 76 85 18 3a 54 20 72 6f 6f 74 66 73 5f 64 |..v..:T rootfs_d|
61 74 61 00 00 00 00 00 2f 00 00 00 00 00 00 00 |ata...../.......|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 |................|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
08 00 00 00 00 00 00 00 00 00 00 00 59 99 7f db |............Y...|
5b 19 4a 7a 91 12 b9 db e5 f0 43 56 01 01 40 00 |[.Jz......CV..@.|
0c 00 00 00 00 00 00 00 cf e0 da 63 0a f3 01 00 |...........c....|
04 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 |................|
01 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 |..............@.|
00 00 00 00 00 00 00 00 00 00 00 00 20 00 20 00 |............ . .|
02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00 00 00 00 04 01 00 00 aa 01 00 00 00 00 00 00 |................|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00 00 00 00 00 00 00 00 dd 2d 00 00 00 00 00 00 |.........-......|
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00 00 00 00 00 00 00 00 00 00 00 00 32 22 3a 59 |............2":Y|
00000800
I hope all this helps!