How to Change the Partition Size in CentOS

Written by chris hoffman Google
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Change the Partition Size in CentOS
(Stockbyte/Stockbyte/Getty Images)

CentOS is a free and open-source Linux operating system based on the source code from Red Hat's commercial Red Hat Enterprise Linux product. CentOS includes a variety of command-line tools for performing a variety of system functions, including creating, deleting and resizing partitions. The "parted" command can resize existing partitions on the system, but if you want to resize the root partition, you'll need to boot off the CentOS CD first, since CentOS can't resize a partition that is in use. Always have backups of your important data before modifying partitions, as data loss can occur.

Skill level:
Moderately Challenging


  1. 1

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

  2. 2

    Click "Applications," "Accessories" and "Terminal" at the CentOS desktop.

  3. 3

    Type "su" into the terminal and press "Enter."

  4. 4

    Type your root password at the password prompt and press "Enter."

  5. 5

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

  6. 6

    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.

  7. 7

    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.

  8. 8

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

  9. 9

    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.

Tips and warnings

  • 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.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.