I recently spent some time investigating this with my good colleague Andy Grimm. I had some initial issues in creating a RHEL6 image for KVM which would boot from EBS. Boot from EBS (sometimes referred to as bfEBS) is a new feature in Eucalyptus 3.X which allows a cloud administrator to back an instance with an EBS volume, thus giving persistence in the VM. This feature is present in AWS.
Below are some of my steps I used to create a RHEL6 guest image as a bfEBS volume. Note that I was using RHEL6 + KVM as the hypervisor:
1) Stop eucalyptus-nc on a designated host (or use another KVM host somewhere)
2) On the designated host, use qemu-img create to create a disk image:
qemu-img create -f raw rhel6_bfebs.img 2G
3) Set the disk label using parted: parted rhel6_bfebs.img mklabel msdos
4) Use virt-install to kick off a from-scratch installation:
virt-install --name rhel6-bfebs2 --ram 1024 --os-type linux --os-variant rhel6 \ -l http://192.168.7.65/rhel/releases/6.1/6Server/--disk \ path=/tmp/rhel6_bfebs.img,bus=virtio --vnc -x "lang=en_US keymap=us"
In your kickstart .cfg :
clearpart --all --drives=vda --initlabel part / --size=512 --grow --fstype ext3 --ondisk=vda
Tweak as required
5) Complete the install then using virt-manager or other libvirt tool, start up the guest again (since finishing the install process is sometimes likely to shut it down, rather than reboot due to power mgmt).
6) Inside the guest:
- In /boot/grub/menu.lst also remove quiet option from kernel params and the grub menu splash image
- Edit /etc/sysconfig/network and add NOZEROCONF=yes (disable the zeroconf route, which can mess up access to metadata service)
- Edit /etc/udev/rules.d/70-persistent-net.rules and remove the entry for existing NIC completely
7) On the instance, you can always mount the volume and check stuff:
hdparm -z /dev/vdX (re-read partition table) mount /dev/vdX /mnt/test
8) Make sure you unmount the EBS volume, if attached. Then detach the volume from the instance:
9) Now snapshot the volume:
10) Register the snapshot (after it has completed):
euca-register -n "MyRHEL6bfEBS" -s <volumeID>
Done! Run your EBS-backed instance. Make sure that when you want to stop/start that you use the following commands:
Otherwise, unless you’re using image attributes you’ll end up with the underlying volume being destroyed when you use euca-terminate-instances. There goes your persistence