Ubuntu Virtualisation

Rescue Partitions in LVM

Using hypervisors is great. However, you will end up in whole “disks” with partitions in an LVM logical volume. And “from the outside” (e.g. when you are trying to rescue data on that damn disk) is not that easy.

pvscan will give you the lvs. But there inside is nothing you can mount directly.

Solution: kpartx

kpartx -av /dev/mapper/yourvg–yourlv

add map yourvg–yourlvp1 (253:26): 0 2048 linear 253:21 2048
add map yourvg–yourlvp2 (253:27): 0 67102720 linear 253:21 4096

This will read the partition table of the lv and add additional endpoints to the /dev/mapper to mount them.

mount -oro /dev/mapper/yourvg–yourlvp1 /mnt


Ubuntu Virtualisation

Thinlinc on Ubuntu 16.04

Ubuntu 16.04 Xenial is not yet officially supported by Thinlinc 4.6. However, with just some additional dependencies, it is working.

Additional packages needed:
apt-get install lsb-core python python2 python-gtk2 python-apt

Check if /var/lib/lsb exists. If not, create this directory as root.

Install Thinlinc as usual.

To have MATE as desktop environment available, use the following meta package:
apt-get install mate-desktop

In my scenario, I use a single Master server built from a freshly installed Xenial Desktop (Unity), let Unity greeter still exist and have Mate as additional Desktop to choose. Like this, my VDI is accessible on small bandwith connections and with a Raspberry Pi 2 as Thin Client using RPiTC.

Geeky Virtualisation

Move a KVM VirtualMachines LVM Volume to another Server

On the target Server, open Firewall for netcat port:

iptables -A ext-in-allow -p tcp -s --dport 19000:19000 -j ACCEPT

Start nc on the target server to read on the port above:

nc -l 19000|dd bs=16M of=/dev/mapper/myTargetLVMDisk

On the source server, dump LV with nc to the target server:

dd bs=16M if=/dev/mapper/sourceLV | nc targetserver 19000

Only for Windows Guests, be sure the disk controller is using IDE instead of VirtIO:

      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
Ubuntu Virtualisation

ubuntu-vm-builder and Tasksel tasks

To add tasksel tasks while using ubuntu-vm-builder, just add a ^ at the end of the tasksel task while using the option –addpkg. E.g.

ubuntu-vm-builder kvm precise --addpkg lamp-server^


KVM Packet List Ubuntu

As a shortcut and extended brain for me, here is the packet list to install KVM on a Ubuntu Server:

  • apt-get install qemu-kvm libvirt-bin virtinst

Tools for the graphical management console:

  • apt-get install virt-managervirt-viewer