Expand CentOS Partition: Step-by-Step Guide

To expand the partition of a CentOS system, you can follow these steps:

  1. Add extra disk space on a virtual machine or physical machine.
  2. Use the command fdisk -l to view information about all disks and their partitions on the system.
  3. Edit the partition that needs to be expanded using the command fdisk /dev/sdX, where X is the identifier of the partition that needs to be expanded.
  4. Delete the partition that needs to be expanded, and then create a larger partition, making sure that the new partition starts at the same sector as the old one.
  5. Use the command partprobe or restart the system to make the partition table take effect.
  6. To expand the file system, use the command “resize2fs /dev/sdX#” where X is the identifier of the partition and # is the partition number.
  7. Use the command df -h to check if the partition has been successfully expanded.

Please backup important data before resizing partitions to prevent unexpected data loss.

bannerAds