标签:iat i686 apt-get iad star img etc log 设备
已经安装过qemu-img的32位ubuntu
$ uname -a
Linux ubuntu-virtual-machine 3.13.0-46-generic #76-Ubuntu SMP Thu Feb 26 18:52:49 UTC 2015 i686 i686 i686 GNU/Linux
安装iscsi服务端
$sudo apt-get install iscsitarget iscsitarget-dkms
编辑配置文件
# vim /etc/iet/ietd.conf
Target iqn.2001-04.com.example:vdx
Lun 0 Path=/home/ubuntu/laboratory/data.qcow2,Type=fileio
# vim /etc/default/iscsitarget
ISCSITARGET_ENABLE=true
启动服务
# service iscsitarget restart
安装了libvirt的64位CentOS
$ uname -a
Linux centos 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
安装iscsi客户端
# yum install iscsi-initiator-utils.x86_64
寻找服务器发布的块设备
# iscsiadm -m discovery -t sendtargets -p 192.168.100.25
192.168.100.25:3260,1 iqn.2001-04.com.example:vdx
链接块设备
# iscsiadm -m node --targetname iqn.2001-04.com.example:vdx -p 192.168.100.25:3260 --login
查看并挂载块设备
# fdisk -l
# mount /dev/sdb ./data
mount: you must specify the filesystem type
# mkfs.ext3 /dev/sdb
# mount /dev/sdb ./data
# cd data/
# ls
lost+found
#
删除设备
# cd ..
# umount ./data
# iscsiadm -m node --targetname iqn.2001-04.com.example:vdx -p 192.168.100.25:3260 -u
回到服务器端使用qemu-img查看发布的qcow2文件,会发现文件以及转换为raw格式,所以iscsi不适用于远程访问qcow2文件
标签:iat i686 apt-get iad star img etc log 设备
原文地址:https://www.cnblogs.com/silvermagic/p/9087151.html