Thursday, March 26, 2009

Commands needed for EBS operations

I found that the scripts for creating, attach and detach volumes in our Nimbus EBS test bed are not totally correct, so I looked up all the relevant documents and got the following steps for doing all these stuff:

1) create a new volume on the volume server::
lvcreate -n gxmVol01 -L32M /dev/vg

2) export a new iscsi target:
ietadm --op new --tid=2 --params Name=iqn.2009-03.edu.iu.cgl:cglch.lun0
ietadm --op new --tid=2 --lun=0 --params Path=/dev/vg/gxmVol01

3) discover and login the new iscsi target from a Xen dom0:
ssh root@cglc5 iscsiadm --mode discovery --type sendtargets --portal 192.168.1.254:3260
ssh root@cglc5 iscsiadm --mode node --targetname iqn.2009-03.edu.iu.cgl:cglch.lun0 --portal 192.168.1.254:3260 --login

4) do block-attach in Xen dom0 to attach the iscsi block device to a domU:
ssh root@cglc5 xm block-attach ttylinux phy:/dev/disk/by-path/ip-192.168.1.254:3260-iscsi-iqn.2009-03.edu.iu.cgl:cglch.lun0-lun-0 /dev/sdb w

After step 4), you will be able to create new partitions and file systems on the front end device /dev/sdb, and mount that file system to some directory. Note that the iscsi target should be attached to a scsi device symbol.

5) to detach a volume from a domU, do xm block-detach in dom0:
ssh root@cglc5 xm block-detach ttylinux /dev/sdb

And of course, if you have a mounted file system on this device, you need to umount it first before doing this.

6) logout from the iscsi target in dom0:
ssh root@cglc5 iscsiadm --mode node --targetname
iqn.2009-03.edu.iu.cgl:cglch.lun0 --portal 192.168.1.254:3260 --logout

Next I'll try to wrap these commands with web services and build a prototype of EBS.

No comments: