Expand disk size on centos VM?
I have a VM with only 10GB of disk size avaliable.
I have expanded the disk size to 120GB from the VM tools, however, I only see 10GB of space from within Linux. I have everything already installed on this VM as I need it and would like ot expand the logical volume to the entire 120GB that's now avaliable to it without losing everything on the disk. Do I need to use the 'lvextend' tool as described on this page? |
Maybe yes, maybe no. We need to figure out your config first.
Run the following commands as root or via sudo and give us the output: Code:
fdisk -l |
Code:
[root@system ~]# fdisk -l |
Your good to go, you will need to create a new partition, /dev/sda3, use pvcreate to make it a physical volume, use vgextend to extend your volume group, then use lvextend to extend your logical volume.
http://www.howtoforge.com/logical-vo...a-volume-group http://linuxconfig.org/Linux_lvm_-_L...ate-partitions MAKE SURE YOU SET THE PARTITION TYPE TO "8e" WHEN CREATING IT! If you have specific questions about any of the commands or the syntax just let me know and I'll give you some examples |
Before I dive off into this, I'm getting the following notification:
Code:
[root@system~]# fdisk /dev/sda Thanks agian. |
Not a big deal on that warning, just follow the steps.
Code:
fdisk /dev/sda Code:
pvcreate /dev/sda3 Code:
Finally, extend your current logical volume. Code:
lvextend -L +100G /dev/VolGroup00/LogVol01 Code:
resize2fs /dev/VolGroup00/LogVol01 |
Quote:
Code:
Command (m for help): p 2) No Partition 3...I don't think I missed a step, did I? Or, should the order be? Code:
fdisk /dev/sda |
Yes, I usually use cfdisk so the commands were a bit out of order. The cylinder boundary error you can ignore as well. Plenty of info on google about it that explains why that happens.
So fdisk /dev/sda n -- Create new partition p -- make it a primary partition(you would want to make it an extended one if this was your 4th partition so you don't limit yourself) 3 - Set the partition number Enter through to get the default sizes which should take up all the free space. t - modify type 3 - select partition three 8e - make it a linux lvm type partition w - write the partition |
OK, done, and I get the following:
Code:
Command (m for help): w Code:
[root@system ~]# resize2fs /dev/VolGroup00/LogVol01 Code:
[root@system ~]# pvdisplay |
Wait a second! We extended the wrong lv here...
Do the following: Code:
lvremove /dev/VolGroup00/LogVol01 |
I think this was my fault as I told you do the lvextend on your 01 lv and not the 00 lv which doesnt appear to be in use or have a filesystem on it, it's was only 256MB before you added the other 100GB.
|
Quote:
Code:
Can't remove open logical volume "LogVol01" Quote:
|
Try running lvremove with the -f option, you're not going to break anything here..
lvremove -f /dev/VolGroup00/LogVol01 If that doesn't work, add the -vvvv option and give us the output. |
Quote:
Code:
Can't remove open logical volume "LogVol01" Quote:
Code:
lvremove -f /dev/VolGroup00/LogVol01 -vvvv Is there a particular part that you are looking for? |
Try doing:
Code:
lsof | grep -i LogVol01 |
All times are GMT -5. The time now is 02:56 AM. |