Expanding KVM guest disk

General support questions
Post Reply
easycoder
Posts: 14
Joined: 2010/11/16 15:45:40

Expanding KVM guest disk

Post by easycoder » 2014/04/20 22:37:06

Hi

As per attachment I expanded /dev/sda1 on a Centos 6.5 guest VM but I am having no luck using the extra space.
Should I be using fdisk? I am not sure how to preserve the original 11GB or so while expanding the usable space.

vmcentos01:/root>df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_mydomain-lv_root
7877776 6291192 1186408 85% / <----- still shows as original
tmpfs 1961468 84 1961384 1% /dev/shm
/dev/sda1 495844 82290 387954 18% /boot
/dev/sdb1 16603376 176060 15583908 2% /mnt/hdfs/1
/dev/sdb2 16603408 176060 15583936 2% /mnt/hdfs/2
/dev/sdb3 15022052 168332 14090636 2% /mnt/hdfs/3
/dev/sdb4 17821004 176060 16739684 2% /mnt/hdfs/4
vmcentos01:/root>
vmcentos01:/root>vgdisplay
--- Volume group ---
VG Name vg_mydomain
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 41.51 GiB
PE Size 4.00 MiB
Total PE 10626
Alloc PE / Size 2946 / 11.51 GiB
Free PE / Size 7680 / 30.00 GiB
VG UUID jDB51q-OZT9-GVOt-p4f9-tzS9-FCl3-L92lHz

vmcentos01:/root>



Thanks

Chris
Attachments
Screenshot-vmcentos01 Virtual Machine.png
Screenshot-vmcentos01 Virtual Machine.png (179.26 KiB) Viewed 926 times

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

Re: Expanding KVM guest disk

Post by TrevorH » 2014/04/21 00:16:48

You have 30GB free in your volume group but your existing logical volume that contains your / filesystem is only 11.5GB. If you want to add more freespace to that then you need to run lvresize to make the logical volume larger. If you read the manpage it has a switch to also resize the filesystem at the same time which you will otherwise need to do manually using resize2fs if you don't.
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

scottro
Forum Moderator
Posts: 2556
Joined: 2007/09/03 21:18:09
Location: NYC
Contact:

Re: Expanding KVM guest disk

Post by scottro » 2014/04/21 02:10:13

For what it's worth, I have a page on LVM that a few folks have found helpful, that goes through the procedure of adding space.

http://home.roadrunner.com/~computertaijutsu/lvm.html
New users should check the FAQ and Read Me First pages

easycoder
Posts: 14
Joined: 2010/11/16 15:45:40

Re: Expanding KVM guest disk

Post by easycoder » 2014/04/21 20:35:38

Thanks - just what i needed

Post Reply