|
Thursday, 13. February 2014 | Week 06 |
|
|
|
.: Moving a KVM guest to another machine
- Properly shutdown the guest:
guest# poweroff
- Create an LVM volume of the same size on the new machine:
newmachine# lvcreate -L 120G -n myguest myvolgroup
- Copy the disk from the old machine over to the new one:
oldmachine# dd if=/dev/vg_foo/lv_bar | ssh newmachine dd of=/dev/volgroup/myguest
- Wait for the transfer to complete (on a 100Mbit/s connection it took about 3.5 hours to transfer the 120GB).
- Copy /etc/libvirt/qemu/myguest.xml from the old machine over to the new machine and adapt the LVM path for the disk.
- Reload the libvirt configuration:
newmachine# /etc/init.d/libvirt-bin reload
- Start up the guest on the new machine:
newmachine# virsh start myguest
|
|
20:02 | Linux | Permalink |
|
.: Shrinking a LVM root partition
- Boot from a helper system and get a root shell (I used the rescue mode of the Debian installer)
- Check the filesystem of the partition to resize:
e2fsck -f /dev/vg_foo/lv_bar
- Resize the filesystem (make it a bit smaller than the target size, to have a safety margin when resizing the logical volume):
resize2fs /dev/vg_foo/lv_bar 180G
- Reduce size of the logical volume:
lvreduce -L 190G /dev/vg_foo/lv_bar
- Grow the filesystem to the new size of the logical volume:
resize2fs /dev/vg_foo/lv_bar
- For good measure run another filesystem check:
e2fsck -f /dev/vg_foo/lv_bar
|
|
19:02 | Linux | Permalink |
|
|
Navigation
Blogs
Topics
|