How to adjust the root partition size in OpenWrt?

To adjust the root partition size of OpenWrt, the following steps need to be taken:

  1. Accessing the console of OpenWrt allows you to log in via SSH or the web interface.
  2. Check the current disk usage on the root partition using the df -h command to determine if resizing the partition is necessary.
  3. Adjust the partition of the hard drive using the fdisk command. The specific command is as follows:
  4. Use the command fdisk -l to check the current partition situation of the hard drive and determine the partition number that needs to be adjusted.
  5. Enter partition editing mode using the command fdisk /dev/sda, replacing /dev/sda with the device file path of the target hard drive.
  6. Enter the command “p” to view the information of the partition table.
  7. Enter the command “d” to delete the partition that needs to be adjusted.
  8. Use the “n” command to create a new partition and adjust its size, while also taking into account preserving any existing data.
  9. Type the ‘w’ command to save and exit partition editing mode.
  10. Adjust the size of the file system using the resize2fs command. The specific command is as follows:
  11. Replace /dev/sdaX with the partition device file path you want to adjust using the resize2fs command.
  12. Once the command execution is complete, the file system size will be adjusted.

Please make sure to back up important data and fully understand the risks and limitations before making any changes to partitions and file systems.

bannerAds