You can also refer to Expanding the Root of Overlay for Insufficient Space in Software Routers
The purpose of this tutorial is to expand the overlay partition and Docker partition for OpenWrt software routers.
- If you need to expand the overlay, please make sure to read the entire article without conflicts (
/dev/sda3
). - If you only need to partition the NAS area, you only need to see the ##Mount section in the article and add it to 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 hard disks (unRaid), the disk path here may be different. Here, you only need to distinguish the size. The default 400M is the overlay partition.
This tutorial is best used with CatWrt, and 200M of idle hard disk space is reserved for firmware upgrades during partitioning.
Partitioning#
Enter cfdisk
in the terminal to enter cfdisk disk management.
Scroll down to Free space
and you will see [ New ]
in the bottom bar. Press Enter.
The Partition size: prompt appears, allowing you to set the partition size.
Here, I set it to 1G for Docker; just enter 1G
and press Enter.
You will see /dev/sda3 added, and the rest can be used as an external overlay or as a NAS using Samba.
Scroll down to Free space
, select [ New ]
, and press Enter.
The default here is the maximum storage space, you can choose according to your needs. I will choose the largest one here and press Enter.
Let us choose whether it is a primary partition or an extended partition. The default is [ primary]
.
Then press the right arrow key to select [ Write ]
to save.
Then it will ask if you are sure you want to write the partition table to disk.
Are you sure you want to write the partition table to disk? _
Enter yes
here and press Enter.
Press the left arrow key to select [ Quit ]
to exit cfdisk.
root@CatWrt:~# cfdisk
Syncing disks.
If you see this, it means that the synchronization is successful.
Formatting#
Change the partition format of sda3 to ext4. Enter mkfs.ext4 /dev/sda3
in the terminal.
Change the partition format of sda4 to ext4. Enter mkfs.ext4 /dev/sda4
in the terminal.
After pressing Enter, the following "done" will be displayed, indicating 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 haven't encountered it, please skip it!
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 following content will be output:
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.
Okay, let's continue.
The same goes for 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
in the terminal.
After executing the mount command, go to System-Mount Points and click Generate Config
to update the page. Find the mount point /mnt/sda3 and compare the capacity.
Then go to overlay and check cd /overlay && ls
to see how many folders are displayed.
upper work
Copy Overlay#
Copy the overlay to sda3
cp -r /overlay/* /mnt/sda3
In the OpenWrt backend, click Generate Config
in System-Mount Points.
After generating the configuration, the page will be updated. Find the mount point /mnt/sda3 and click Modify
.
You can ignore the UUID and focus on the partition address in parentheses. Here, select the sda3 partition.
8083786b-7f9dff8e-58c38dac-11451419 (/dev/sda3, 114514 MB)
Select Use as an external overlay (/overlay)
for the mount point.
Finally, check Enable this mount point and click Save and Apply
. Restart the OpenWrt system and log in. You can see the expanded capacity in System-Software Packages.
In fact, OpenWrt partitioning is not difficult. Remember that data is priceless.
This article is synchronized and updated to xLog by Mix Space
The original link is https://www.miaoer.xyz/posts/network/openwrt-overlay