Azimout's Linux weblog

Archive for the ‘Reference’ Category


leave a comment »

I’d say the 4 main virtualization technologies for Linux are the following:

  1. KVM (RedHat)
  2. VMWare (EMC)
  3. VirtualBox (Oracle)
  4. Xen (Citrix)

The thing is, VMWare is proprietary, VirtualBox is proprietary if you want USB or RDP, and Xen requires a special kernel (rather than a kernel module, like KVM). So to me, the choice is easy…


  1. First, check if your CPU supports virtualization, and if it’s enabled in the BIOS (run egrep '(vmx|svm)' /proc/cpuinfo --colour, vmx means Intel VT-x, svm means AMD-V).
  2. Then, install some packages: sudo aptitude install qemu-kvm libvirt-bin virt-manager
  3. Regarding disk storage, you have storage pools and storage volumes. I use a directory-based pool and qcow2 volumes.
  4. The xml configuration files for each VM will either be under ~/.libvirt/qemu or under /etc/libvirt/qemu
  5. You really want to use virtio for better disk and network I/O performance
  6. To get a screen resolution > 800×600, change the video device from “cirrus” to “vga”
  7. To avoid filling up your main partition, create a virtual link for the directory countaining the virtual machine images: sudo ln -s -d path_to_folder /var/lib/libvirt/images

Virtio in Windows XP

  1. download the driver while in the VM
  2. shut down the VM
  3. add a (dummy) virtio storage volume to the VM
  4. run the VM
  5. it will ask you to install the driver; provide the driver downloaded in step 1
  6. shut down the VM
  7. remove the dummy volume, remove the actual IDE volume of the VM
  8. add a virtio volume pointing to the same file
  9. run the VM

Editing an image

To mount the guest image volume (.img) from the host (as long as the guest is NOT running), do the following:

  1. sudo losetup /dev/loop0 path_to_img_file
  2. sudo kpartx -av /dev/loop0
  3. sudo mount /dev/mapper/loop0p1 mount_point
  4. do whatever you want to do
  5. sudo umount mount_point
  6. sudo kpartx -dv /dev/loop0
  7. sudo losetup -d /dev/loop0

Resizing an image

Resizing (growing) an existing qemu machine image is trivial:

  1. Convert from qcow2 to raw format:
    qemu-img convert -f qcow qcow2_image -O raw raw_image
  2. Create an empty qemu image of the size that is the amount you want to grow your image:
    qemu-img create -f raw temp_image 10G
  3. Concatenate the two images to a new one:
    cat raw_image temp_image > new_image
  4. Convert the new image from raw back to qcow2
    qemu-img convert -f raw new_image -O qcow final_image
  5. Boot your virtual machine with the new image. Use (format) the empty disk space at will.


  • If you’re using raw images instead of qcow2, you can obviously skip steps 1 and 4.
  • I saw some people suggesting using the dd command to replace steps 2 and 3, but others are saying it’s slower. Haven’t tried it myself.
  • If you want to grow the root partition’s filesystem rather than create a new partition in the image, you can add the image to an existing Linux virtual machine and use gparted. Some are suggesting downloading the gparted livecd and booting a VM with that as a CD and your image as an HDD, then doing the resizing, shutting down and booting back into your normal VM.

Renaming a VM

  • Edit the corresponding .xml file under /etc/libvirt/qemu
  • sudo service libvirt-bin restart


Written by azimout

20/05/2010 at 19:06

Posted in Reference

case in email addresses

leave a comment »

The domain part (the part after @) is case-INSENSITIVE; the local mailbox part (the part before @) is case-SENSITIVE.

Written by azimout

07/04/2010 at 09:18

Posted in Reference

ext3 to ext4

leave a comment »

To convert a partition from ext3 to ext4, do the following:

  • enable ext4 features by running tune2fs -O extents,uninit_bg,dir_index /dev/DEV
  • have fsck repair some inconsistencies that are created by the previous command e2fsck -fDC0 /dev/DEV
  • (optional) mount the partition and force the kernel to rewrite all files by a command like this find /home -xdev -type f -print0 | xargs -0 chattr +e

Reminder: grub (v1) doesn’t support ext4, so if you upgrade your root (or /boot) partition, you need to chroot into your system and upgrade to grub2

Reminder2: if you can’t chroot (you get the error “cannot execute /bin/bash: exec format error”), it’s because you’re using a 32-bit livecd and are trying to chroot into a 64-bit system


Written by azimout

02/04/2010 at 21:20

Posted in Reference

OO.o performance project

leave a comment »

There’s a project trying to improve the performance of

I found this while trying to find the cause of an issue I have: with OpenOffice 3.2, everytime I open a spreadsheet, after the splash screen completes, it waits for approx. 20 seconds doing nothing (no cpu or disk activity) and then opens the file. That happens even after closing and reopening the same file.

Opening just Calc (w/o a file) is very fast (~1 sec). If I then tell it to open a file, it hangs for 20 seconds like before. Removing the ~/ folder doesn’t help. Disabling Java in OO.o doesn’t help. Whether the file is .xls or .ods makes no difference. The same issue is present for .doc files

Using strace I found that it seems the call that make OO.o hang is the call to /bin/domainname

Written by azimout

02/04/2010 at 12:07

Posted in Reference


leave a comment »

Had some fun today locating myself on various GeoIP sites:

Most are correct, only one thinks I’m in Berlin (

Written by azimout

15/03/2010 at 19:37

Posted in Reference


leave a comment » (not of much help)

Three types of fonts:

  1. (.otf) (Microsoft, Adobe) (ISO/IEC 14496-22)
  2. (.ttf) (Apple)
  3. (a.k.a Type1 fonts) (.afm/.pfb/.pfm) (Adobe)

x11 fonts???

your fonts are under /usr/share/fonts

Written by azimout

12/03/2010 at 11:29

Posted in Reference


leave a comment »

Written by azimout

12/03/2010 at 11:21

Posted in Reference


leave a comment »

If you have a gateway and multiple Ubuntu machines, it might make sense to save bandwidth by using it (also) as an proxy server for apt. Here’s some useful links:

Written by azimout

12/03/2010 at 11:18

Posted in Reference

openoffice bibliography database

with one comment

Every user has a bibliography database, located under ~/

There’s a bug where if you don’t have OO.o Base installed and click on Tools->Bibliography Database, OpenOffice will crash (didn’t anyone test this before release?).

Another issue could be that the “Title” field has a max. length of 75 characters, which is too short for some papers.

Written by azimout

05/03/2010 at 23:03

Posted in Reference


leave a comment »

To install/remove packages (or modify in general) on a Linux system that is unbootable, you can boot with a LiveCD, mount the underlying system’s root partition and then chroot to that mount point. After that, any commands will be run on the underlying system, rather than on the LiveCD…

Some actions (e.g. installing grub) require also the devfs, procfs and sysfs filesystems, so before chrooting, remember to also:

  • sudo mount -o bind /dev /mnt/dev
  • sudo mount -t proc none /mnt/proc
  • sudo mount -t sysfs none /mnt/sys

(I assume here that the root partition was mounted under /mnt)

Update 01.10.2010: if you’re using dhcp, networking will not work because /etc/resolv.conf will be empty. Add “nameserver″ to that file

Written by azimout

23/02/2010 at 11:21

Posted in Reference


Get every new post delivered to your Inbox.