[CentOS] Live CD boot for KVM guest. How?

Wed Oct 19 20:12:55 UTC 2011
Theo Band <theo.band at greenpeak.com>

On 10/19/2011 08:15 PM, John R Pierce wrote:
> On 10/19/11 9:34 AM, Müfit Eribol wrote:
>> My host and guest are CentOS 6. The guest is going to be a web server in
>> production. I am trying to resize (extend) of the base partition of my
>> guest.  But I can of course start the installation of CentOS 6 guest all
>> over again with a larger image size. However, just for the sake of
>> better understanding I an trying to solve things not to be end up in a
>> dead end after some years.
> rather than resizing the system 'drive', I woudl have simply created 
> ANOTHER logical drive mapped to the guest, and create a new file system 
> on it, moving the stuff thats filling up your base disk (/home ?  
> /var/www ?) to it, then remounting it as the 'new' /home or /var/www or 
> whatever....
But if your system disk is now bigger, you can also create a new
partition (even while the system is live) and use this new partition.
And I would still use LVM for this new partition. This does not really
add much complexity. It does add a lot of flexibility. The steps are:

parted /dev/sda
mkpart p ext2 <start> <stop>

pvcreate /dev/sda2 (your new second new partition?)
vgcreate vg /dev/sda2
lvcreate vg -n test -L 10G
mkfs.ext4 /dev/vg/test

The volume group does not need to be assigned completely and leaves some
room to carve new partitions in the future. Also the snapshot feature
allows to create consistent backups if needed.

I even think you can used parted to change you system partition. Simply
delete the partition and recreate with the exact same starting sector.
One mistake and you will loose a lot though, so why would you even try?