banner
miaoer

miaoer

喵二の小博客 https://www.miaoer.net xLog 分站
tg_channel
telegram
bilibili

OpenWrt Expansion Overlay Partition Tutorial

You can also refer to Is there not enough space for the soft router? Expand the root of overlay

The purpose of this tutorial is to expand the overlay partition and Docker partition for the soft router OpenWrt.

  • If you need to expand the overlay, please make sure to read everything without conflicts (/dev/sda3)
  • If you only need to partition for NAS, you only need to see the section ##Mount in the blog post to add it in OpenWrt Network Storage - Network Sharing (/dev/sda4)

Therefore, this article is based on the installation method of most physical machines. If you are using NVME or virtual disks (unRaid), the disk paths here may be different. You only need to distinguish the size; the default 400M is the overlay partition.

This tutorial works better with CatWrt, and keep 200M of idle disk space during partitioning for future firmware upgrades.

Partitioning#

Enter cfdisk in the terminal to enter cfdisk disk management.

Use the keyboard to go down to Free space, and you will see the bottom bar change, allowing you to select [ New ] and press Enter.

This will show Partition size: allowing you to set the partition size.

image

I will set 1G for Docker; just type 1G and press Enter.

You will see an additional /dev/sda3; the remaining space can be used for external overlay or for using samba as NAS.

Use the keyboard to go down to Free space, select [ New ], and press Enter.

Here, the default is the maximum storage space; you can choose according to your needs, I will select the largest and press Enter.

Let’s choose between a primary partition or an extended partition; the default here is [ primary].

Then use the keyboard to move right and select [ Write ] to save.

Then it will ask you to confirm the modification.

Are you sure you want to write the partition table to disk? _

Here, just type yes and press Enter.

Use the keyboard to move left to [ Quit ] to exit cfdisk.

root@CatWrt:~# cfdisk

Syncing disks.

If it displays like this, it means the save synchronization was successful.

Formatting#

Change the partition format of sda3 to ext4 by entering mkfs.ext4 /dev/sda3 in the terminal.

Change the partition format of sda4 to ext4 by entering mkfs.ext4 /dev/sda4 in the terminal.

After pressing Enter, the output below done indicates completion.

root@CatWrt:~# mkfs.ext4 /dev/sda3
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 512000 1k blocks and 128016 inodes
Filesystem UUID: 08b438da-ee76-4c98-8bd8-f8e31f32fabd
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409

Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done


If you encounter the following content, it is because the partition has been created before; just enter y and press Enter. If you do not encounter it, please skip!

root@CatWrt:~# mkfs.ext4 /dev/sda3
mke2fs 1.46.5 (30-Dec-2021)
/dev/sda3 contains a ext4 file system
        last mounted on /mnt/sda3 on Tue Aug 16 15:31:27 2022
Proceed anyway? (y,N) _

The output will be as follows:

Discarding device blocks: done                            
Creating filesystem with 262144 4k blocks and 65536 inodes
Filesystem UUID: 4e68fde1-d16a-428e-8f45-f00919090f0c
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

The prompt done indicates completion.


Alright, let’s continue.

The same applies to sda4 (Docker partition).

root@CatWrt:~# mkfs.ext4 /dev/sda4
mke2fs 1.46.5 (30-Dec-2021)
Discarding device blocks: done                            
Creating filesystem with 58261504 4k blocks and 14593824 inodes
Filesystem UUID: 0ba60339-25d5-44fa-8079-605a5b9e7674
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done    

Mounting#

Mount sda3 by entering mount /dev/sda3 /mnt/sda3 in the terminal.

Mount sda4 by entering mount /dev/sda4 /mnt/sda4.

【CatWrt.v24.9 version does not need to do this step】 After executing the mount command, go to System - Mount Points and click Generate Configuration, find /mnt/sda3 and compare the capacity, which should be the same.

Then check the overlay by cd /overlay && ls, which should display several folders.

upper  work

Copy Overlay#

Copy the overlay to sda3.

cp -r /overlay/* /mnt/sda3

In the OpenWrt backend, go to System - Mount Points and click Generate Configuration.

After generating the configuration, the page will refresh. Find the mount point /mnt/sda3 and click Modify.

image

You can ignore the UUID; mainly look at the partition address in parentheses, here select the sda3 partition.

8083786b-7f9dff8e-58c38dac-11451419 (/dev/sda3, 114514 MB)

For the mount point, select Use as external overlay (/overlay).

Finally, check Enable this mount point and click Save and Apply. Restart the OpenWrt system and log in; you will see the expanded capacity in System - Packages.


Actually, partitioning in OpenWrt is not difficult; just be careful with the operations as data is invaluable.

This article is synchronized and updated to xLog by Mix Space. The original link is https://www.miaoer.net/posts/network/openwrt-overlay

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.