Please help with expanding partition on x86 EFI

Hi All

I just got back to Openwrt with x86 system and I'm trying to expand the partition, I tried to follow some guides to do it with ssh commands, but failed a few times and had to reinstall. I also tried to use gparted live, but no luck. I found this guide, but I'm not sure what's the correct steps. Can someone please help me?

Do I copy and paste the instruction to the System > Startup > Local Startup then reboot the router?

There is a "Examples" section and "Automated" section on the guide. What do I do with those commands?

I'm done this step, opkg update && opkg install lsblk fdisk losetup f2fs-tools

Here is the build and image I'm using.
Model Generic x86/64
Platform x86/64
Version 23.05.3 (r23809-234f1a2efa)
Image: Combined-EFI (SQUASHFS)

System that I'm using has N200 and a 180GB SATA SSD.

Thank you in advance!

With that step done, you should be able to just run the Automated process from ssh.

Thanks for the reply. So I just need to ssh to the router and run this command and is it going to use all the unallocated space?
wget -U "" -O ""
. ./

Do I still need to copy and paste the configure startup script on Startup?

Thanks again!

No, the wget copies that entire Codeblock for you, and calls an script. You should see a couple of re-boots while the process runs.

There is a forum post here that may help [HOWTO] Resizing root partition on x86 (March 2023 edition)

Thank you very much! Will try it tonight.

Hi. One more thing. I ssh to the router and ran fdisk -l and i got a red message "GPT PMBR size mismatch (246303 != 351651887) will be corrected by write." Is this something I should fix before running the Automated command? If yes, how do I fix this? I've wiped the drive and reinstall openwrt a few times and each time I tried to use command to resize the partition, I got the same red message. Thanks!

Run parted -l on the drive and post the return.


could be tricky resize partition 2, when there's a partition 3.
perhaps if 3 gets moved to the far end of the drive ?

1 Like

I wiped the drive completely before installing the official openwrt image. Did the image created 3 partitions or the software I used to put the image on the drive (balenaEtcher)? Is there an easier way to expand the size on the image before installing opnewrt?

I usually don't use the EFI images, and can't tell what's in them.

you can always make a dd backup of the content of part 3, delete it,
resize part 2 but keep some space for part3, then recreate part 3,
and dd back the content.

another option is to fire up gparted from a flash drive, it can relocate
existing partitions on a drive.


I tried gparted live before, but it only show 2 partitions and an unallocated partition.

not sure I know what that means ...

you can always try the other method.

It’s using GUID Partition layout. Try gparted on the drive and remove all partitions then format the single partition to Ext4.

Now DD your image and re-run the resize.

if you dd the rootfs to a partition bigger than the rootfs' file system, you can usually do a resize2fs on the partition directly afterwards.

I'm sorry for being a noob, what's DD? Is it imagining the drive? What tool should I use after format the single partition to Ext4? Can I do it on Windows to image the drive? Also re-run the resize, do I use gparted or use ssh commands or the ssh Automated command? Thank you!

dd ? :slight_smile:

probably, but that's the long route ...

any of those, I'd imagine.

Sorry, I eschew Windows. I thought you were running the install on a Linux Live USB.

Yes, agreed.

I'm late to the party, but to give some examples parted output on BIOS v EFI boxes...

Here's an x86 with BIOS boot and its two partitions:

$ parted -l
Model: ATA DOGFISH SSD 64GB (scsi)
Disk /dev/sda: 64.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      262kB   17.0MB  16.8MB  primary  ext2         boot
 2      17.3MB  126MB   109MB   primary

Here's an x86 with EFI boot and its three partitions:

parted -l
Model: WDC WDS250G2B0C-00PXH0 (nvme)
Disk /dev/nvme0n1: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
128     17.4kB  262kB   245kB                      bios_grub
 1      262kB   17.0MB  16.8MB  fat16              legacy_boot
 2      17.0MB  285MB   268MB

Both drives were imaged with a simple dd if=some-openwrt.img of=xxx where the of= device name xxx was determined using lsblk.

1 Like