OpenWrt Forum Archive

Topic: Resize Rootfs

The content of this topic has been archived on 6 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello guys!

Is there any way to resize the root partition on boot?

Thank you in advance!

The likely answer is no.

* The root partition contains kernel and the other files contained in the flashed firmware image. That part is read-only squashfs partition. And it can bee seen as /rom in a live router.
* The remaining free flash space is used for "/overlay" jffs2 partition that will contain all your personal settings, edited files, packages installed later etc.
* overlayfs then places /overlay on top of /rom, to be the actual / in a live router. Net effect is that the files from /overlay override the files in the original /rom.  (e.g. there is /etc/abc in /rom and you edit it. The edited files is actually placed to /overlay, while the original one in /rom stays intact.)

E.g. in my router, the rootfs is 5120 kB and the /overlay is some 9600 kB.

root@OpenWrt:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 5120      5120         0 100% /rom
tmpfs                    62884      1112     61772   2% /tmp
/dev/mtdblock5            9600       460      9140   5% /overlay
overlayfs:/overlay        9600       460      9140   5% /
tmpfs                      512         0       512   0% /dev

What are you attempting to do?

(Last edited by hnyman on 9 Oct 2015, 12:13)

hnyman wrote:

The likely answer is no.

* The root partition contains kernel and the other files contained in the flashed firmware image. That part is read-only squashfs partition. And it can bee seen as /rom in a live router.
* The remaining free flash space is used for "/overlay" jffs2 partition that will contain all your personal settings, edited files, packages installed later etc.
* overlayfs then places /overlay on top of /rom, to be the actual / in a live router. Net effect is that the files from /overlay override the files in the original /rom.  (e.g. there is /etc/abc in /rom and you edit it. The edited files is actually placed to /overlay, while the original one in /rom stays intact.)

E.g. in my router, the rootfs is 5120 kB and the /overlay is some 9600 kB.

root@OpenWrt:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 5120      5120         0 100% /rom
tmpfs                    62884      1112     61772   2% /tmp
/dev/mtdblock5            9600       460      9140   5% /overlay
overlayfs:/overlay        9600       460      9140   5% /
tmpfs                      512         0       512   0% /dev

What are you attempting to do?

I have 500 Mb available in my disk and rootfs has only 50 Mb so I'm trying to expand in order to use that free space.

luisf wrote:

I have 500 Mb available in my disk and rootfs has only 50 Mb so I'm trying to expand in order to use that free space.

What type of filesystem is used? Please login into your device as root, run mount, and provide its output here.

mazilo wrote:
luisf wrote:

I have 500 Mb available in my disk and rootfs has only 50 Mb so I'm trying to expand in order to use that free space.

What type of filesystem is used? Please login into your device as root, run mount, and provide its output here.

If I type fdisk

Device         Boot Start    End Sectors Size Id Type
/dev/mmcblk0p1 *     8192  49151   40960  20M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      57344 155647   98304  48M 83 Linux


If I type df

Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                   47636      8096     38560  17% /
/dev/root                47636      8096     38560  17% /
tmpfs                   476532      1056    475476   0% /tmp
tmpfs                      512         0       512   0% /dev

The discussion might have continued from here.