Sunday, August 19, 2007

CD/DVD eject - disable lock


#sudo echo "dev.cdrom.lock=0" >> /etc/sysctl.conf

Saturday, May 26, 2007

kqemu - backport from 'feisty' to 'dapper'


Edit apt sources:

#sudo vi /etc/apt/sources.list

--8<--
## Ubuntu source packages for backporting to older releases
deb-src http://mirrors.easynews.com/linux/ubuntu feisty main restricted universe
-->8--


Update, build dependencies and install:

#sudo aptitude update
#sudo apt-get build-dep kqemu
#sudo apt-get source --build kqemu
#sudo dpkg -i *.deb
#sudo module-assistant prepare kqemu
#sudo module-assistant auto-install kqemu


Edit udev rules:

#sudo vi /etc/udev/rules.d/60-kqemu.rules

--8<--
KERNEL=="kqemu", NAME="%k", MODE="0660", GROUP="kqemu"
-->8--


Edit 'kqemu' modprobe.d options:

#sudo vi /etc/modprobe.d/kqemu

--8<--
options kqemu major=0
-->8--


Add user and group:

#sudo addgroup --system kqemu
#sudo adduser your_username kqemu


Load 'kqemu' kernel module:

#sudo modprobe kqemu

Monday, May 21, 2007

qemu


Create a virtual HDD:

#qemu-img create hda.img 5G


Set 512MB of virtual memory, allow access to a virtual HDD and boot from a virtual CD using an ISO file:

#qemu -m 512 -hda hda.img -cdrom ubuntu-7.04-desktop-i386.iso -boot d

-boot a, c, d = floppy drive, hard drive, optical drive respectively
-no-kqemu = if kqemu kernel module not present


Boot from a virtual HDD:

#qemu -m 512 -hda hda.img


Convert a "RAW" HDD image to a "QCOW" compressed image:

#qemu-img convert -c hda.img -O qcow harddiskimage.img


Check image type:

#qemu-img info hda.img

image: hda.img
file format: raw
virtual size: 5.0G (5368709120 bytes)
disk size: 2.3G



#qemu-img info harddiskimage.img

image: harddiskimage.img
file format: qcow
virtual size: 5.0G (5368709120 bytes)
disk size: 891M



CTRL+ALT+2 = qemu console

Save virtual memory state:

(qemu) savevm dump.img

Load virtual memory state:

(qemu) loadvm dump.img


CTRL+ALT+1 = qemu main screen

Start qemu using a hard drive image and restore saved memory state:

#qemu -m 512 -hda hda.img -loadvm dump.img