ATA Over Ethernet配置(ubuntu下试验成功)

琴刚豪
2023-12-01

Prepare The Kernel
First check if your running kernel has AoE, the config option name is CONFIG_ATA_OVER_ETH, have a look at fig1, my kernel has AoE as a module:
host:/# grep ATA_OVER /boot/config-`uname -r`

CONFIG_ATA_OVER_ETH=m
host:/#

If not, configure your kernel and activate AoE in core or in module like you prefer:

Device Drivers -->
  |- Block Devices --->
      |-  <m> ATA over Ethernet support

Ok now you have a kernel with AoE, just load the aoe module:

host:/# modprobe aoe

You can check your syslog to be sure AoE is available:

host:/#tail /var/log/syslog

Oct 10 11:54:07 host kernel: aoe: aoe_init: AoE v47 initialised.
host:/#

Now we'll call the client 'client' and the server 'server', funny isn't it?
In SAN vocabulary we call the client 'initiator' and the server 'target', I prefer to continue using simplest terms.

The Server Side (Target)
First we need to install the vblade package:

server:/# apt-get install vblade

Reading package lists... Done
Building dependency tree... Done
The following NEW packages will be installed:
  vblade
[...]
Unpacking vblade (from .../archives/vblade_11-1_i386.deb) ...
Setting up vblade (11-1) ...
server:/#

On our server we'll export the /dev/sdd5 partition which has a size of 5GB, exporting a block device is easy to do:

server:/# ip link set eth0 up
server:/# vbladed 0 1 eth0 /dev/sdb   注:/dev/sdb是要挂在局域网共享的磁盘名
Some explanation about this command, each AoE device is identified by a couple Major/Minor, with major between 0-65535 and minor between 0-255. AoE is based just over Ethernet on the OSI models so we need to indicate which ethernet card we'll use.

In this example we export /dev/sdd5 with a major value of 0 and minor if 1 on the eth0 interface.

We are ready to use our partition on the network!

Client Side (Initiator)
The client needs the aoe kernel module too, so prepare your kernel as we saw.

The userland tools are present in the package aoetools:

client:/# apt-get install aoetools
client:/# ip link set eth0 up
client:/# modprobe aoe 注:optionally the list of interfaces can be specified while loading the module
client:/# modprobe aoe aoe_iflist="eth0 eth1" 注:This can automatically be performed at startup, by entering a line into the /etc/modules file
Create the 'etherd' directory
  (client)# mkdir /dev/etherd
  (client)# aoe-interfaces eth0
  (client)# aoe-discover

输入这条命令后我出现了:/dev/etherd does not exist or is not writeble,暂时别管它
  (client)# aoe-stat
      e0.1         8.0GB  
Create a filesystem:
  (client)# mkfs.ext3 /dev/etherd/e0.1 注:Create a mount point and mount the file system:
  (client)# mkdir /mnt/e0.1
  (client)# mount /dev/etherd/e0.1 /mnt/e0.1
注:This can be made to automatically mount on
reboot, by entering a configuration line in /etc/fstab (untested).
you can see all the files using following command:
client:/# ls -al /mnt/e0.1

total 4
drwxr-xr-x  2 root root     140 2007-10-10 13:30 .
drwxr-xr-x 16 root root   14660 2007-10-10 13:30 ..
c-w--w----  1 root disk 152,  3 2007-10-10 13:30 love.mp3
brw-rw----  1 root disk 152, 16 2007-10-10 13:30 lost+found
通过以上命令,可以从client访问server端共享磁盘的文件,也可以从client复制一个文件到/mnt/e0.1,不过复制的时候,我是用u盘作为共享设备,复制后要先从sever端卸载u盘,然后再挂载,才能看到复制后的文件。从server端复制文件到u盘时,复制后从client端看不到刚复制到u盘的内容,得重新重复上述过程,重新挂载设备才能看到。我认为是因为从client挂载的是前一时刻的u盘信息,后一时刻server端复制到u盘的文件因此看不到,这个问题有待解决?

 类似资料: