How to Extend the partition after extending it from VMware / SAN

06. March 2015 SysAdmin 0

Issue

  • CentOS 6/7, RHEL6/7 with XFS file system
  • My / Filesystem is full
  • I have extended the size from VMware datastore or SAN LUN

Note

  • Reboot is necessary (6/7) if it is an OS parition ie /.
  • Makesure you have a backup / snapshot of the `sda` disk

Solution

In this example, we are asuming that the disk is /dev/sda and the partition is /dev/sda3 mounted on /.

  • Rescan the disk after extending the disk from VMware or SAN. `echo 1 > /sys/block/sda/device/rescan`
  • Now `fisk -l /dev/sda` will show the disks new size.
  • Now we have to extend the partition, for that run fdisk on the disk and re-create the parition. `fdisk /dev/sda`
  • Press `p` to print the partion table, and note your partion id for / (In our case its 3)
  • press `d` to delete the partition
  • Enter the number `3` and your partion is deleted.
  • Now press `c` to create a new partion and select `3` again, then just presss `ENTER` and `ENTER` when it as for starting and ending cylindar number.
  • Press `p` again to see the parion list and press `w` to write the partition table.
  • Now reboot your system
  • After rebooting, run `xfsgrow /`
  • Now run `df -h` and your partion will be extdended.

Please Comment and share if found helpful 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *