How to extend a ext4 disk on CentOS 6.5

General support questions
Post Reply
Rich-H
Posts: 3
Joined: 2017/05/06 13:16:13

How to extend a ext4 disk on CentOS 6.5

Post by Rich-H » 2017/05/06 13:30:22

Hi,

I need to extend an ext4 disk on CentOS 6.5. It's on a VMware VM. I extended the disk in vSphere.

When I try to run parted I get an error saying that parted is not supported.

I tried deleting the partition and creating a new partition, then running resize2fs, but I got an error saying that thgere were bad superblocks.

I tried different superblocks without any luck. All data was lost. Fortunately I'm doing this on a test system.

Is there anyway to extend an ext4 disk in CentOS 6.5?

I've tried installing an additional disk and moving the data, but ran into additional issues:
The first time the new disk became unmounted in the middle of the data copy (I don't know why), data was copied to a subdirectory under / which caused sda1 (LVM) to fill up - it was a real mess to recover. The second time VM swap file filled up and the VM crashed. So that's not working well).

I'd rather extend the disk and ext4 file system. Any idea how I can do this?

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to extend a ext4 disk on CentOS 6.5

Post by TrevorH » 2017/05/06 17:16:35

Is there anyway to extend an ext4 disk in CentOS 6.5?
Yes, of course. Though really you shouldn't run 6.5 at all since it's massively out of date, full of bugs and security vulnerabilities. CentOS 6.9 is current and you should yum update to it ASAP.

If you delete and redefine the partition the filesystem resides on then you need to make sure it is redefined to start on the exact same sector number that it was on before. Do to do this, put fdisk into sector mode using the 'u' command and then print out the current partitions before you delete it. Then when you recreate it, make sure the starting sector number is identical.

Also, you don't say how you have your system set up so all this may not be necessary - if you use LVM for example you can just resize LVs.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Rich-H
Posts: 3
Joined: 2017/05/06 13:16:13

Re: How to extend a ext4 disk on CentOS 6.5

Post by Rich-H » 2017/05/07 13:22:29

Thanks for the reply!

Is parted supported on CentOS 6.9?

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to extend a ext4 disk on CentOS 6.5

Post by TrevorH » 2017/05/07 14:32:22

You can find parted in the CentOS base/updates repos ready to be yum installed. It doesn't work with LVM though so the point about providing your system info still stands.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply