Expand partition for packages in TP-LINK Archer V60 with expanded storage

Hi,

I´m learning OPENWRT with what I got at hand wich is a TP-LINK Archer V60 v1 home router, that had 8MB of SPI internal storage and no USB ports for expansion with well documented tutorials.
So I opened it up and replace it´s internal 8MB SPI FLASH IC with one of 16MB, but Its getting impossible for me to expand the internakl partition for storage packages to use the new free space.-

I suppose this could be possible, but no idea how.

Any help is appreciated.

Thanks! Have a good one

You could also use the extra space for extroot, I guess - https://openwrt.org/docs/guide-user/additional-software/extroot_configuration.

1 Like

Hey @frollic, thanks for the hint!
Correct me if I´m wrong, but on the link you provided, it´s about expanding to a USB drive, but my home router doesn´t have any USB port :frowning:
If in the provided link to documentation it have something related to resize current internal partition in actual internal storage, I´m unable to identify it or understand it

Thanks!

You can expand it onto anything mountable...

Okay, so, is there a way to "resize" the internal partition of where the packages are installed? Maybe my approach should focus in that way

That's exactly what the thread I linked to plus the links inside it, are about.

Okay, I´m sorry, but I´m not getting it...

opkg update opkg install block-mount kmod-fs-ext4 e2fsprogs parted kmod-usb-storage

If you are using an ssd in a usb enclosure, you will probably need to add the kmod-usb-storage-uas package as well.

Identify the name of the USB disk.

ls -l /sys/block

### 2. Partitioning and formatting

Partition and format the USB disk.

DISK="/dev/sda" parted -s ${DISK} -- mklabel gpt mkpart extroot 2048s -2048s DEVICE="${DISK}1" mkfs.ext4 -L extroot ${DEVICE}

What I little understand here from what I read, is it tells me how to partition a USB disk, but I have no USB disks, I only upgraded the internal flash memory from 8MB (Winbond 25Q64) https://http2.mlstatic.com/D_810545-MLA82912174986_032025-C.jpg with 16MB (Winbond 25Q128) https://images.tokopedia.net/img/cache/500-square/VqbcmM/2023/7/21/913551ee-9430-481b-8978-07d51e482781.jpg , so I don´t know how to resize rootfs_data to take the extra 8MB or so

Here´s a link of my actual hardware

https://openwrt.org/toh/tp-link/archer_c60_v2

Thanks in advance

Custom(ized) hardware means custom firmware. If you replace the flash chip with one of a different size, you now need to patch (DTS, image recipe, …) your locally forked version of OpenWrt accordingly (into all eternity). It's not a case of the purely mechanical job of replacing the flash chip once, you also need to fix the firmware side (and it's not going to 'stick', so you will have to fix every future firmware upgrade).

Okay, I got the point, and please correct me because I´m sure wrong, but OPENWRT it´s not a kind of Linux, creating partitions, and if so, if it have the ability to create a partition, should it have the ability to modifiy it´s size somehow?

Thanks!

It has the ability, but flash layout is usually predefined, and shouldn't be altered.

That's why you were told to use extroot, since it doesn't affect the original layout.

Okay, it makes sense, but, once again, i don´t get the idea to modify and run the EXTROOT commands without pointing to an USB drive, which my router doesn´t have any usb physical port and I have no idea how to "map" or whatever it names to map an unknown free space in the internal SPI FLASH IF EXTROOT have the ability to.-

Thanks!

On this hardware, there wouldn't be any way around (into all eternity) patching the source and rebuilding it. Extroot would only be possible either via USB XOR using the free space on your replaced flash chip, but you can't do so without first changing the DTS to make this space accessible (at which point doing the extroot dance would be pointless).

Perfectly undestood.
Thank you all for looking a way around.

I just found this: https://openwrt.org/toh/tp-link/archer_c60_v2

Another possible method of installation is directly to the flash chip (W25Q64). First you need to obtain a dump of the chip (by reading the chip from your device or by finding a dump on the internet). The partition map is located at the address 0x7df800 on the chip:

partition factory-boot base 0x00000 size 0x1fb00 partition default-mac base 0x1fb00 size 0x00200 partition pin base 0x1fd00 size 0x00100 partition product-info base 0x1fe00 size 0x00100 partition device-id base 0x1ff00 size 0x00100 partition fs-uboot base 0x20000 size 0x10000 partition os-image base 0x30000 size 0x100000 partition file-system base 0x130000 size 0x6a9500 partition soft-version base 0x7d9500 size 0x00100 partition support-list base 0x7d9600 size 0x00100 partition extra-para base 0x7d9700 size 0x00100 partition profile base 0x7d9800 size 0x03000 partition default-config base 0x7dc800 size 0x03000 partition partition-table base 0x7df800 size 0x00800 partition user-config base 0x7e0000 size 0x0c000 partition certificate base 0x7ec000 size 0x04000 partition radio base 0x7f0000 size 0x10000

To install OpenWrt, we need to replace the os-image and file-system partitions with the OpenWrt firmware, and copy everything else. First copy everything preceding these two partitions:

dd if=archer_c60_ac1350_v2.bin of=owrt_frankenstein.bin bs=1 count=196608

Then copy the OpenWrt image:

dd if=openwrt-19.07.3-ath79-generic-tplink_archer-c60-v3-squashfs-sysupgrade.bin bs=1 count=4653056 >> owrt_frankenstein.bin

Add padding to match the size of os-image+file-system:

dd if=/dev/zero bs=1 count=3380480 | tr “\000” “\377” >>owrt_frankenstein.bin

And lastly, copy everything else:

dd if=archer_c60_ac1350_v2.bin bs=1 skip=8230144 >> owrt_frankenstein.bin

To verify, you can check that the file size is equal to the size of your original dump.

The resulting file can be written to the flash chip. This method has been successfully tested with a v3 device, although using a flash dump from v2.

Flash Layout

dev: size erasesize name mtd0: 00030000 00010000 "u-boot" mtd1: 007a0000 00010000 "firmware" mtd2: 00180000 00010000 "kernel" mtd3: 00620000 00010000 "rootfs" mtd4: 00360000 00010000 "rootfs_data" mtd5: 00020000 00010000 "tplink" mtd6: 00010000 00010000 "art"

Are these steps helpful to do what I´m looking for?