10 STEPS to add 10GB to LVM
***for example let's add 10GB to filesystem*** REBOOT Guest after adding.(If needed)
2.Check if you got free space on physical disk.
[root@localhost ~]# sfdisk -s
/dev/sda: 20031488
3. Space need to be assigned to /dev/sda check whick sda partitions you already have and create a new one:
[root@localhost ~]# ls -al /dev/sda*
brw-rw---- 1 root disk 8, 0 Apr 1 2013 /dev/sda
brw-rw---- 1 root disk 8, 1 Apr 1 2013 /dev/sda1
brw-rw---- 1 root disk 8, 2 Apr 1 2013 /dev/sda2
We create new partition /dev/sda3:
[root@localhost ~]# fdisk /dev/sda
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (1306-1697, default 1306): Enter
Using default value 1306
Last cylinder or +size or +sizeM or +sizeK (1306-1697, default 1697): Enter
Using default value 1697
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
***REBOOT***
4. Check if new partition exists:
[root@localhost ~]# ls -al /dev/sda*
brw-rw---- 1 root disk 8, 0 Apr 1 2013 /dev/sda
brw-rw---- 1 root disk 8, 1 Apr 1 2013 /dev/sda1
brw-rw---- 1 root disk 8, 2 Apr 1 2013 /dev/sda2
brw-rw---- 1 root disk 8, 2 Apr 1 2013 /dev/sda3
5. Create a physical volume for LVM:
[root@localhost ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
6. Assign the physical volume to the Volume Group:
[root@localhost ~]# vgextend VolGroup00 /dev/sda3
Volume group "VolGroup00" successfully extended
7. Check if you got free space on Volume Group:
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 10.88 GB
PE Size 32.00 MB
Total PE 956
Alloc PE / Size 956 / 10.88 GB
Free PE / Size 97 / 10.1 GB
VG UUID a8rsVw-ACdV-K5aP-uG7l-Nfvq-Wn9i-E36JE5
8. Extend volume:
[root@localhost /]# lvextend -L+10G /dev/VolGroup00/LogVol00
Rounding up size to full physical extent 10 GB
Extending logical volume LogVol00 to 20.88 GB
Logical volume LogVol00 successfully resized
9.Resize FileSystem:
[root@localhost ~]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.35 (28-Feb-2004)
/dev/VolGroup00/LogVol00 is mounted; can't resize a mounted filesystem!
Cannot use resize2fs as it is online. Use ext2online instead.
[root@localhost ~]# ext2online /dev/VolGroup00/LogVol00
ext2online v1.1.18 - 2001/03/18 for EXT2FS 0.5b
10. Check if you resize success:
[root@localhost ~]# df -hl
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
21G 10.2G 9.6G 57% /
/dev/sda1 99M 13M 81M 14% /boot
tmpfs 1006M 0 1006M 0% /dev/shm
That's All. :)