Expand CentOS Partition: Step-by-Step Guide
To expand the partition of a CentOS system, you can follow these steps:
- Add extra disk space on a virtual machine or physical machine.
- Use the command fdisk -l to view information about all disks and their partitions on the system.
- 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.
- 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.
- Use the command partprobe or restart the system to make the partition table take effect.
- To expand the file system, use the command “resize2fs /dev/sdX#” where X is the identifier of the partition and # is the partition number.
- 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.