How to resize Partitions in CentOS

Posted on October 13, 2011 by admin

Boot from a CentOS disc by inserting it into your server and restarting the system if you want to change the partition size of a partition that is in use.

Click “Applications,” “Accessories” and “Terminal” at the CentOS desktop.

Type “su” into the terminal and press “Enter.”

Type your root password at the password prompt and press “Enter.”

Type “mount” to see a list of mounted partitions with their device names.

Unmount the partition by typing “umount /dev/sda1,” replacing “/dev/sda1” with its device name, and pressing “Enter.” If the partition is a swap partition, type “swapoff /dev/sda1” instead. You can’t unmount the “/” partition, or other important partitions.

If you booted from the CentOS disc, the partitions will already be unmounted.

Type “parted /dev/sda” and press “Enter” to run parted on the first hard drive. If you want to resize a partition on the second hard drive, type “/dev/sdb” instead, and so on.

Type “print” and press “Enter” to see a list of partitions on the hard drive.

Change the partition size with the resize command. For example, type “resize 3 1024 2048” to change the third partition’s size to start at 1024MB on the hard drive and end at 2048MB.

Note : If there’s no room on the hard drive, you’ll have to resize another partition to be smaller first, or delete a partition. You can delete a partition by typing “rm 3” at the parted prompt, replacing “3” with the partition’s number. Deleting a partition permanently deletes all the files on it.