How to increase /dev/root with 22.03 (VM)?

Some information first..

I'm going to do some multiple test setup using OpenWRT running in VM. I used this for the image: generic-ext4-combined-efi.img.gz

I was able to increase the /dev/sda2 from 100mb to 2GB but here is the thing, the /dev/root is still using 100mb. It seems that the /tmp mounted folder (tempfs) was the one that increased in size. How do I re-allocate portion of the size (at least 1GB) to /dev/root? Is this even possible (without doing custom/manual
builds)?

Below are details of the partitions:

# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root               102.3M     61.1M     39.2M  61% /
tmpfs                     1.9G     84.0K      1.9G   0% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
# fdisk -l /dev/sda
Disk /dev/sda: 2 GiB, 2147991552 bytes, 4195296 sectors
Disk model: openwrt-22.03.2-
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: C120D9F5-D6F9-D15B-05A7-0D348F8A4B00

Device      Start     End Sectors  Size Type
/dev/sda1     512   33279   32768   16M Linux filesystem
/dev/sda2   33280 4195262 4161983    2G Linux filesystem
/dev/sda128    34     511     478  239K BIOS boot

Partition table entries are not in disk order.
# cat /etc/mtab
/dev/root / ext4 rw,noatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,noatime 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,noatime 0 0
cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate 0 0
tmpfs /tmp tmpfs rw,nosuid,nodev,noatime 0 0
tmpfs /dev tmpfs rw,nosuid,noexec,noatime,size=512k,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,noatime,mode=600,ptmxmode=000 0 0
debugfs /sys/kernel/debug debugfs rw,noatime 0 0
none /sys/fs/bpf bpf rw,nosuid,nodev,noexec,noatime,mode=700 0 0

/tmp is located in RAM.

The easiest approach is typically to resize the overlay partition immediately after writing the image to disk, before booting it for the first time (the overlayfs is initialized/ formatted during firstboot, taking all available space of the given partition). You can still do this afterwards, but then you have to resize the filesystem of the overlay as well (and not just the partition containing it).

There is no overlay partition as you can see in my post.

Ah, you've using the ext4 images, in that case you will have to resize the ext4 rootfs as well - resize2fs should cover that (and growing the fs can even be done on the mounted fs).

Ohhh thanks.. I just want to increase the partition of the / (/dev/root). I tried from here:https://openwrt.org/docs/guide-user/installation/openwrt_x86#resizing_partitions but nothing seems to work.

fire up gparted from an usb flash drive.

Uhmmm i need to check how to do that.. this is a Virtual Machine not an actual router or PC.

It is 'PC'. You can attach bootable iso-image, and boot from it.

Thanks I'll try to do that.. I just need a bootable linux distro..

Gparted is a bootable image.

Yup.. it's actually the one I used. thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.