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?
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.
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).
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.
The below steps extended my partition from 12G to 26GB on a VMWare EXSi 5.5 running Centos 6 EXT4 VPS.
1) Identify the device name, which is by default /dev/sda, and confirm the new size by running the command:
2) Get list of partitions for /dev/sda device:
3) Create new primary partition
4) Reboot Centos 6.X then log back in with root privileges
5) Check the new partition is ready and type '8e':
6) Create physical volume:
7) Find out volume group name:
8) Extend the physical volume:
9) Extend the existing volume group to the new physical volume (+100%FREE can be altered to desired size). Since we are extending root partition hence pointing to lv_root in vg_app1 volume group.
10) Resize logical root volume:
Note: Use ext2online instead of resize2fs if it is a Red Hat virtual machine.
11) Check available space:
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