Setting up an Ubuntu Installation to work with AOE

(Tested on Ubuntu Lucid 10.04 and Ubuntu Maverick 10.10)

First make sure you have a server with some aoe server software installed. If you use Linux as a server, get and install the “vblade” package.

On the client side, install a standard Ubuntu Desktop on a physical or virtual machine. If you use a virtual machine, make the sure disk image is in 'raw' format, meaning no headers or such on the image. If it is a valid raw image, you should be able to see the partition table with, for example “fdisk -l disk.img” or even the “disktype” command, like so:

$ disktype disk.img 

--- disk.img
Regular file, size 6 GiB (6442450944 bytes)
DOS/MBR partition map
Partition 1: 5.858 GiB (6290407424 bytes, 12285952 sectors from 2048, bootable)
  Type 0x83 (Linux)
  Ext3 file system
    UUID 745D45C4-38FA-4B7C-85A3-71D37AE23AF3 (DCE, v4)
    Volume size 5.858 GiB (6290407424 bytes, 1535744 blocks of 4 KiB)
Partition 2: 144 MiB (150994944 bytes, 294912 sectors from 12288000)
  Type 0x82 (Linux swap / Solaris)
  Linux swap, version 2, subversion 1, 4 KiB pages, little-endian
    Swap size 144.0 MiB (150986752 bytes, 36862 pages of 4 KiB)

Use the following steps to make the Ubuntu client aoe capable:

First, start the client and login, then start a terminal and become root: Applications → Accessories → Terminal

Paste the following code into a new file called /etc/initramfs-tools/scripts/local-top/aoe
#!/bin/sh

sleep 1                       # Wait for network driver to load
ip link set eth0 up           # Activate the network interface
sleep 3                       # Wait for the network interface to become active
echo 1 >/dev/etherd/discover  # Start looking for aoe devices on the net

Then do these commands at the terminal:

sudo -s                                               # Become root, if it asks for password, use the users password
chmod +x /etc/initramfs-tools/scripts/local-top/aoe   # Make your script executable
apt-get install aoetools                              # Make sure you have the aoe tools installed
echo aoe >>/etc/initramfs-tools/modules               # Add the aoe module to the modules list of initramfs
update-initramfs -u                                   # Update initramfs with your changes, 
                                                      # the changes will also take effect even with upgrades
Optional: Do the following if you want your eth0 interface to have the same name even if the image is booted on different machines
sudo -s                                                   # Change to root access
rm /etc/udev/rules.d/70-persistent-net.rules              # Get rid of this rule so that your current eth0 interface doesn't get changed
rm /lib/udev/rules.d/75-persistent-net-generator.rules    # This re-creates the above, so get rid of it too

Note: I don't know if the above steps are the best way to make eth0 name static, but this is what works for me.

You are now finished with editing the client. Shutdown the client now.

Last step: Transfer the image to the server

You could just copy the image as is, but it is even smarter to make a sparse file. That way only actual data is copied and not the empty sectors. You can do this under linux with the cp command:

cp --sparse=always disk.img /media/server-data/disk-images/disk.img

If you installed to a physical machine, boot up the machine with a live linux cd, become root and do this command:

cp --sparse=always /dev/sda /media/server-data/disk-images/disk.img

Random Notes

  • If you don't install any proprietary video drivers, then what you got here is an image that will boot from either AOE, USB, or any internal/external disk on any machine.
  • Since Ubuntu is Debian based, these steps should work with Debian too but I haven't tried it myself
  • You cannot create sparse images if you copy to a windows or samba network share, use nfs/ssh/nc (netcat) instead. Here is an example with nc (netcat):

Client side:

cat /dev/sda | nc -l -p 1234

Server side:

nc <client-ip> 1234 | cp --sparse=always /dev/stdin disk.img

Created by — Quinn Plattel 2010/09/17 07:33


QR Code
QR Code sanboot:ubuntu_aoe (generated for current page)