Tuesday, October 05, 2010

Creating a debian iscsi shared raid for backup of vmware esx systems

I usually keep a backup image on one of my test boxes for the production
systems, so I can have a easy way of recoverying in event of disaster.
This previous was a openfiler but found it managed to lose its disk.
So I decided to setup a equivlent system using debian. So using
the minimal network install, I setup a base debian, then added software raid, and finally iscsi target support. Note this is all running as a VM on top of esxi, with raw disks mapped to local sata drives.

First, map your raw disk using vmkfstools

vmkfstools -r /vmfs/devices/disks/vml.0100000000202020202020202020202020395653334e595335535433313530 disk1.vmdk

Next you need to go into the vm, and add the raw vmdk into the vm's config

Now in debian, you will see the raw devices at boot

Next install mdadm

apt-get install mdadm

and you need to install the iscsi target kernel modules

apt-get install iscsitarget-modules-2.6.26-2-686

Now setup the raid
mdadm --create /dev/md0 --level=5 --raid-devices=5 /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf

To check the status:
mdadm --detail /dev/md0

Now add the disk into the /etc/ietd.conf


Change the following:
#Assuming you want some security, a chap password on incoming user is useful
IncomingUser sinadmin xxyyzz



Target iqn.2001-04.com.rutledge:storage.disk0.sys1.md0
        # Fixup the security  
         IncomingUser sinadmin xxyyzz
        # Block devices, regular files, LVM, and RAID can be offered
        # to the initiators as a block device.
        Lun 0 Path=/dev/md0,Type=fileio


And finally:
invoke-rc.d iscsitarget restart

The get everything using our new config.

Surprisingly I found this no worse than using openfiler, and I know what is happening
behind the covers.

0 comments: