working with kvm images

| No Comments | No TrackBacks

A collection of short recipies on how to

  • enlarge
  • mount

kvm images.

How to enlarge a kvm image

  1. Stop the kvm maschine.
  2. Convert the kvm image to raw format if necessary.

    qemu-img convert -O raw original.img raw.img

  3. Make a backup copy of the image.

  4. Enlarge the raw image.

    dd if=/dev/zero of=raw.img bs=1 count=0 seek=[size in]GB

  5. Attach the enlarged image to a loop device.

    losetup /dev/loop0 raw.img

  6. Use

    fdisk /dev/loop0

    to create a new partition or enlarge an existing one to accomodate the additional disk capacity.

  7. Boot the machine using the new image.

  8. Log in to the machine and start up lvm. Either add the new partition as a new physical volume (pvcreate) and add it to a volume group (vgextend) or in case an existing partition was enlarges use

    lvm> pvresize /dev/vda2

    and add the newly available space to logical volumes

    lvm> lvresize -L +511.02G /dev/philipp/home

  9. Enlarge the filesystem (ext2/3).

    resize2fs /dev/philipp/home

No TrackBacks

TrackBack URL: http://edelblog.ch/cgi-bin/movabletype/mt-tb.cgi/4

Leave a comment

About this Entry

This page contains a single entry by hp published on October 9, 2009 10:12 PM.

git step by step was the previous entry in this blog.

Solaris 10 authentication against openldap is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.