centos 6.3 increase disk size on /

13,352

I've never done this with parted, however I've done it with fdisk/resize2fs. Here's a link on how to do it:

http://geekpeek.net/resize-filesystem-fdisk-resize2fs/

Basically the jist of it is:

  1. Unmount the filesystem that you're resizing
  2. Delete the partition, and create a larger partition with the same first sector (All you're doing is deleting the reference in the partition table, not the actual partition, so it'll find the file system in the new larger partition)
  3. Extend the filesystem to fill the larger partition
  4. Remount the resized filesystem.
Share:
13,352
woter324
Author by

woter324

Updated on September 18, 2022

Comments

  • woter324
    woter324 over 1 year

    I have a VM running CentOS 6.3. LVM is not installed. From the VM side, I have increased the underlying disk from 15GB to 40GB, so I now need to expand the partition and file system.

    I've managed to boot into "Rescue Mode" so no file systems are mounted. My problem occurres when trying to use parted's resize command.

    [root@livedvd ~]# parted
    (parted) print
    Model: VMware Virtual disk (scsi)
    Disk /dev/sda: 42.9GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos
    
    Number    Start    End     Size    Type     File system    Flags
     1        1049kB   269MB   268MB   primary  ext3           boot
     2        269MB    1880MB  1880MB  primary  linux-swap(v1) 
     3        1880MB   17.2GB  15.3GB  primary  ext4
    
    (parted)
    

    So I now try and expand the partition with:

    (parted) resize 3 4366MB 35GB
    WARNING: you are attempting to use parted to operate on (resize) a file system...
    ...
    No Implmentation: Support for opening ext4 file systems is not implemented yet.
    (parted)
    

    Great! Is 6.3 that old! I have done a yum update, but it made no difference. The warning message goes on to say I should be using e2fsprogs. I tried resize2fs /dev/sda3, however, it states that "the filesystem is already 3735296 blocks long. Nothing to do". My understanding is this is for the file system. I have to expand the partition first.

    I have also increase the memory from 1GB to 4GB so I am also trying to increase the linux-swap, hence the 4366MB value.

    I found this site, referencing the "no implementation error" and suggesting I use cfdisk /dev/sda3. The post goes on to say this will delete the partition. I should then recreate it with resize2fs /dev/sda3. Not sure I like the sound of deleting partitions.

    If anyone could point me in the right direction, I'd be post grateful for any pointers.

    • jscott
      jscott over 9 years
    • JamesRyan
      JamesRyan over 9 years
      you use parted to remove and remake the partition THEN you can use resize2fs to make the filesystem fill it all.
    • MadHatter
      MadHatter over 9 years
      C6.3 is out of support; do you have an extremely good reason for not going to 6.6?
    • MadHatter
      MadHatter over 9 years
      Woter, please stop putting your salutations back in. jscott has already given you a clear pointer to the local etiquette: not only do we find their lack to be acceptable, we find an aggressive attempt to include them quite the opposite.
    • woter324
      woter324 over 9 years
      So basic manners, courteous and respectful behaviour is frowned upon here. Seems the way of the world these days!!!
  • austinian
    austinian over 8 years
    The question specifically states that LVM is not being used. If you want to answer a different question, first ask it then post the answer, but first check to see if the question has already been asked.