I have a CentOS 5 virtual machine and I added 20GB more to disk size. How do I initialize and extend the available space?
I'm new to Linux, so what should I do?
I tried loading GParted as well, but the drive is locked; how do I unlock it?
Download the Gparted live CD ISO. Then attach the ISO to CentOS and boot from live cd (go to the virtual machine settings, select “CD/DVD” and select “Use ISO” from the right-side panel). Then select the partition you want to resize. Click on the partition menu (top menu bar) then click on “Resize”. Then select “Apply all operations” from “Edit” menu.
You're not going to be able to use GParted because the filesystem is on LVM and GParted does not support that.
First, TAKE A BACKUP OF THE VM. Then perform the following as "root" from a command line.
|show 1 more comment|
Easy. Go into your VM as root. Type "fdisk -l" - if you already see the new disk size - good.
If not - try
Now your VG VolGroup00 has 20 GB more space. Do whatever you like with it. Just as you would do on a physical system (resize LVs, then resize the FS for example).
Here I am taking a sample partition to expand the disk from 5GB to 7GB with out losing Data. You can change according to your free space available.
Before increasing the disk, I have taken the following details from the Linux VM:
Shut the VM down now.
Now I am going to increase the existing virtual disk (
Go to the location of virtual disk location.
Now it will grow the virtual disk to 7Gb
Now you need to power on the VM. Log into the VM using PuTTY or the console as the root user.
It still shows the old size. Unmount the partition which you are going to increase.
Run the file system repair on the disk
Now were are goig to remove the journal from the disk to make it into an ext2 filesystem.
Now start partitioning
I am removing the existing
Now restart the Linux machine to take effect of the partition (we can also use
Now once again check the extended file system, if you skip this step,
Now resize the file system.
Now check the file system.
Now recreate the partition with the ext3 format.
Restart the Linux machine once to effectively use the ext3 filesystem.
Once again you login to Linux box using root previleges. Now you can find the partition increased to 7 GB.
I just did this, in VMware, with CentOS 6.4. Answer number 1 is correct, but is missing one step, that I discovered.
In Gparted, mine also had the lock icon.
On the row with the partition, that has the lock icon, right-click and select "de-activate". That makes the lock go away.
Then you can right-click and change the partition size.
Then apply the change.
Then right-click and select "activate".
You can make steps 5 and 6 to be one by adding the