Posts Tagged ‘ubuntu’

Enabling UFS r/w support in Ubuntu 12.04 LTS

No Comments »

Continuing my work with servers running Ubuntu, I’ve come across the issue of needing the ability to write to UFS filesystems via libguestfs. I was doing a lot of head-banding against various walls, until I came across this post (thanks a lot Oz Nahum!).

R/W support is *experimental*, you’ve been warned.

First create the build directory and download the source for your kernel:

sudo su -
apt-get build-dep --no-install-recommends linux-image-$(uname -r)
mkdir /usr/local/src/ufs_rw
cd /usr/local/src/ufs_rw
apt-get source linux-image-$(uname -r)
cd linux-3.x.y-z
cp -v /usr/src/linux-headers-3.x.y-z/Module.symvers .
cp -v /boot/config-3.x.y-z .
make EXTRAVERSION=-4 O=/usr/local/src/ufs_rw  oldconfig
sed -i 's/# CONFIG_UFS_FS_WRITE is not set/CONFIG_UFS_FS_WRITE=y/' /usr/local/src/ufs_rw/.config

Continue compiling:

make EXTRAVERSION=-4 O=~/ufs_rw prepare
make EXTRAVERSION=-4 O=~/ufs_rw outputmakefile
make EXTRAVERSION=-4 O=~/ufs_rw archprepare
make EXTRAVERSION=-4 O=~/ufs_rw modules SUBDIRS=scripts
make EXTRAVERSION=-4 O=~/ufs_rw modules SUBDIRS=fs/ufs

You’ll find your module here: /usr/local/src/ufs_rw/linux-[version]/fs/ufs/ufs.ko. From there, you can just copy the file to /lib/modules/3.x.y-z/kernel/fs/ufs — I preferred to rename the original to ‘ufs.ko.ro’ vs. overwriting it.

Now with a modprobe ufs you’ll have UFS support loaded with r/w support!


Ubuntu 12.04, apparmor and libvirt live external snapshots

No Comments »

So I was running into an issue where our Ubuntu machines would not allow live external snapshots via libvirt virsh snapshot-create-as "" --diskspec vda,file= --disk-only. *Note the lack of the “–atomic” option, which is certainly recommended in a mission-critical environment, as it ensures the snapshot completely correctly and dies if it does not — this is due to running an older version of libvirt (0.9.8) because we’re using Precise Pangolin.

agoree@computing-node-3:/var/lib/libvirt/images$ virsh snapshot-create-as fedora-guest2 snap1-fedora-guest2 "1st virsh snap of fedora-guest2" --diskspec vda,file=/var/lib/libvirt/images/snap2-fedora-guest2.img --disk-only
error: internal error unable to execute QEMU command 'blockdev-snapshot-sync': An undefined error has ocurred

The error lead me to this bug report, along with these helpful blog posts.

I ended up simply creating this file:

agoree@computing-node-3:~$ cat /etc/apparmor.d/local/abstraction-libvirt-storage 
"/var/lib/libvirt/images/*" rw,

Then added an include for it in /etc/apparmor.d/libvirt/TEMPLATE, like so:

agoree@computing-node-3:~$ cat /etc/apparmor.d/libvirt/TEMPLATE 
#
# This profile is for the domain whose UUID matches this file.
#

#include <tunables/global>

profile LIBVIRT_TEMPLATE {
  #include <abstractions/libvirt-qemu>
  #include <local/abstraction-libvirt-storage>
}

After a reboot, all worked fine. Next up, using a newer libvirt version on Precise Pangolin for better live snapshot support (namely, “–atomic” option and “virsh blockpull” command to consolidate imgs/snaps).


Installing snap-guest on Ubuntu 12.04

No Comments »

At my current workplace we use libvirt and qemu/kvm running on the latest Ubuntu LTS release for our cloud platform. Recently, I wanted to use the awesome tool to simplify the provisioning of guest images. The configuration is for Fedora, but it can easily be done on Ubuntu.

First install the prerequisite packages:

apt-get install bash sed qemu-img virtinst cloud-utils util-linux genisoimage python-guestfs perl libguestfs-tools libguestfs-perl cloud-utils openssl util-linux

Then clone the git repo:

cd /opt
sudo git clone git://github.com/lzap/snap-guest.git
sudo ln -s /opt/snap-guest/snap-guest /usr/local/bin/snap-guest

You’re now good to go! From the snap-guest link (https://github.com/lzap/snap-guest):
“It’s recommended to use “base” string in the guest name (e.g. fedora-10-base or rhel4-base) to differentiate those files (snap-guest lists them using -l option), but it is not mandatory (option -a lists them all).”

I’d done this previously anyways, so was very easy in my case.

./snap-guest --list
./snap-guest -p /mnt/data/images --list-all

Visit the aforementioned link for further details.