Debirf Image on KVM guest

debirf is a minimal debian installation that runs entirely in RAM, allowing you to have full access to any underlying disks (among other benefits).

To boot a KVM guest to debirf, first ensure that you have a debirf .iso file in /usr/local/share/ISOs on the host (if not, you can download a pre-built one.

Then, create a symlink from /home/<guest>/vms/<guest>/cd.iso to this downloaded file and shutdown the guest.

You can access the debirf image via the kvm console (ssh <guest>@<host> screen -x).

Login as root (with no password).

Root password

If you are planning on turning on networking, it's a good idea to set a root password first:



You can setup networking with the following commands:

ip= gateway= && \
 ip addr add "$ip" dev eth0 && \
 ip link set dev eth0 up && \
 ip route add default via "$gateway" dev eth0
echo "nameserver" > /etc/resolv.conf

Installing packages

You can install any debian package, but remember to run:

apt-get update

The apt cache is not populated already.

Creating filesystems

If you are creating filesystems from a block device, these commands will do the trick (some modification will be needed to meet your needs):

parted /dev/vda -- mklabel msdos 
parted /dev/vda -- unit s mkpart primary 2048 499711 
parted /dev/vda -- unit s mkpart primary 499712 -1 

pvcreate /dev/vda2
vgcreate vg_jones0 /dev/vda2
lvcreate --name root --size 5GB vg_jones0
lvcreate --name var --size 5GB vg_jones0
lvcreate --name var+lib+mysql --size 25GB vg_jones0
lvcreate --name tmp --size 3GB vg_jones0
lvcreate --name swap --size 1GB vg_jones0
lvcreate --name home --size 75GB vg_jones0

mkfs -t ext3 /dev/vda1
mkfs -t ext3 /dev/mapper/vg_jones0-root
mkfs -t ext3 /dev/mapper/vg_jones0-var
mkfs -t ext3 /dev/mapper/vg_jones0-var+lib+mysql
mkfs -t ext3 /dev/mapper/vg_jones0-tmp
mkfs -t ext3 /dev/mapper/vg_jones0-home

mount /dev/mapper/vg_jones0-root /mnt
mkdir -p /mnt/{boot,var,var,home,tmp,proc,sys,dev}

Mounting filesystems

debirf should discover all logical volumes, so mounting a logicaly volume can be accomplished with:

mount /dev/mapper/path-to-volume /mnt

For example:

mount /dev/mapper/vg_leslie0-root /mnt
mount /dev/mapper/vg_leslie0-var /mnt/var
mount /dev/mapper/vg_leslie0-tmp /mnt/tmp
mount /dev/mapper/vg_leslie0-srv /mnt/srv
mount /dev/vda1 /mnt/boot


If you want to operate in a chroot environment, you will also need to mount some special filesystems:

for fs in dev proc sys; do mount -o bind /$fs /mnt/$fs; done


chroot /mnt
Last modified 10 years ago Last modified on Jun 1, 2012, 8:41:17 PM