Using ATA Over Ethernet (AoE) On Debian Squeeze (Initiator And Target) - Page 2
This tutorial exists for these OS versions
- Debian 8 (Jessie)
- Debian 6 (Squeeze)
- Debian 5 (Lenny)
On this page
4 Setting Up The Initiator (server1)
server1:
On server1, we install the initiator:
apt-get install aoetools
Now we check what AoE storage devices are available:
aoe-discover
The command
aoe-stat
should now show the storage devices:
root@server1:~# aoe-stat
e0.1 21.474GB eth0 up
root@server1:~#
At this point we have a new block device available on the client box named /dev/etherd/e0.1. If we have a look at the /dev tree a new node appears:
ls -la /dev/etherd/
root@server1:~# ls -la /dev/etherd/
total 0
drwxr-xr-x 2 root root 160 Mar 16 13:34 .
drwxr-xr-x 14 root root 3000 Mar 16 13:33 ..
c-w--w---- 1 root disk 152, 3 Mar 16 13:33 discover
brw-rw---- 1 root disk 152, 16 Mar 16 13:34 e0.1
cr--r----- 1 root disk 152, 2 Mar 16 13:33 err
c-w--w---- 1 root disk 152, 6 Mar 16 13:33 flush
c-w--w---- 1 root disk 152, 4 Mar 16 13:33 interfaces
c-w--w---- 1 root disk 152, 5 Mar 16 13:33 revalidate
root@server1:~#
In the output of
fdisk -l
you should now also find the new hard drive:
root@server1:~# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00029d5c
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3793 30461952 83 Linux
/dev/sda2 3793 3917 992257 5 Extended
/dev/sda5 3793 3917 992256 82 Linux swap / Solaris
Disk /dev/etherd/e0.1: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/etherd/e0.1 doesn't contain a valid partition table
root@server1:~#
To use that device, we must format it:
fdisk /dev/etherd/e0.1
root@server1:~# fdisk /dev/etherd/e0.1
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xa00b110d.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): <-- n
Command action
e extended
p primary partition (1-4)
<-- p
Partition number (1-4): <-- 1
First cylinder (1-2610, default 1): <-- ENTER
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610): <-- ENTER
Using default value 2610
Command (m for help): <-- t
Selected partition 1
Hex code (type L to list codes): <-- 83
Command (m for help): <-- w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
root@server1:~#
Afterwards, the output of
fdisk -l
should look as follows:
root@server1:~# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00029d5c
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3793 30461952 83 Linux
/dev/sda2 3793 3917 992257 5 Extended
/dev/sda5 3793 3917 992256 82 Linux swap / Solaris
Disk /dev/etherd/e0.1: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0cf58b15
Device Boot Start End Blocks Id System
/dev/etherd/e0.1p1 1 2610 20964793+ 83 Linux
root@server1:~#
Now we create a filesystem on /dev/etherd/e0.1p1...
mkfs.ext4 /dev/etherd/e0.1p1
... and mount it for test purposes:
mount /dev/etherd/e0.1p1 /mnt
You should now see the new device in the outputs of...
mount
root@server1:~# mount
/dev/sda1 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
/dev/etherd/e0.1p1 on /mnt type ext4 (rw)
root@server1:~#
... and
df -h
root@server1:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 29G 806M 27G 3% /
tmpfs 249M 0 249M 0% /lib/init/rw
udev 244M 108K 244M 1% /dev
tmpfs 249M 0 249M 0% /dev/shm
/dev/etherd/e0.1p1 20G 172M 19G 1% /mnt
root@server1:~#
You can unmount it like this:
umount /mnt
To have the device mounted automatically at boot time, e.g. in the directory /storage, we create that directory...
mkdir /storage
... and add the following line to /etc/fstab:
vi /etc/fstab
[...] /dev/etherd/e0.1p1 /storage ext4 defaults,auto,_netdev 0 0 |
This alone isn't enough to have the device mounted at boot time because the AoE stuff gets loaded after /etc/fstab is read. Therefore we open /etc/rc.local...
vi /etc/rc.local
... and add the following lines to it (before the exit 0 line):
[...] aoe-discover sleep 5 mount -a [...] |
For test purposes, you can now reboot the system:
reboot
After the reboot, the device should be mounted:
mount
root@server1:~# mount
/dev/sda1 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
/dev/etherd/e0.1p1 on /storage type ext4 (rw,_netdev)
root@server1:~#
df -h
root@server1:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 29G 806M 27G 3% /
tmpfs 249M 0 249M 0% /lib/init/rw
udev 244M 108K 244M 1% /dev
tmpfs 249M 0 249M 0% /dev/shm
/dev/etherd/e0.1p1 20G 172M 19G 1% /storage
root@server1:~#
5 Links
- AoE Protocol Definition: http://www.coraid.com/RESOURCES/AoE-Protocol-Definition
- Debian: http://www.debian.org/