Tag Archives: mirror

iscsi + mdadm mirror creation

Create a file based LUN:
root@hcst001:/NAS/iscsi# dd if=/dev/zero of=./lun3.img bs=1024k count=10240
root@hcst002:/NAS/iscsi# dd if=/dev/zero of=./lun3.img bs=1024k count=10240

Add lun to /etc/iet/initiators.allow:
iqn.2010-12.side.lan.hcst001:iscsi.lun3 10.1.1.200
iqn.2010-12.side.lan.hcst002:iscsi.lun3 10.1.1.200

Add lun to /etc/iet/ietd.conf:
Target iqn.2011-12.side.lan.hcst001:iscsi.lun3
Lun 3 Path=/NAS/iscsi/lun3.img,Type=fileio
Target iqn.2010-12.side.lan.hcst002:iscsi.lun3
Lun 3 Path=/NAS/iscsi/lun3.img,Type=fileio

Restart iscsitarget:
/etc/init.d/iscsitarget restart

Discover the new luns:
root@hcvm001:~# /usr/bin/iscsiadm -m discovery -t st -p 10.1.1.101
10.1.1.101:3260,1 iqn.2010-12.side.lan.hcst002:iscsi.lun3
10.1.1.101:3260,1 iqn.2010-12.side.lan.hcst002:iscsi.lun2

root@hcvm001:~# /usr/bin/iscsiadm -m discovery -t st -p 10.1.1.104
10.1.1.104:3260,1 iqn.2011-12.side.lan.hcst001:iscsi.lun3
10.1.1.104:3260,1 iqn.2011-12.side.lan.hcst001:iscsi.lun2

Login to the new luns:
/usr/bin/iscsiadm -m node –targetname “iqn.2011-12.side.lan.hcst001:iscsi.lun3” –portal “10.1.1.104:3260” –login
/usr/bin/iscsiadm -m node –targetname “iqn.2010-12.side.lan.hcst002:iscsi.lun3” –portal “10.1.1.101:3260” –login

Create physical volume:
root@hcvm001:~# pvcreate /dev/sdd
Physical volume “/dev/sdd” successfully created
root@hcvm001:~# pvcreate /dev/sde
Physical volume “/dev/sde” successfully created

Create the mirror:
mdadm –create –verbose /dev/md1 –level=1 –raid-devices=2 /dev/sdd /dev/sde
mdadm –readwrite /dev/md1

Quick Solaris Disk Mirror

# format
Searching for disks…done

AVAILABLE DISK SELECTIONS:
0. c1t1d0
/pci@1,0/pci103c,60b0@5/sd@1,0
1. c1t4d0
/pci@1,0/pci103c,60b0@5/sd@4,0

bash-3.00# prtvtoc /dev/rdsk/c1t1d0s2 | fmthard -s – /dev/rdsk/c1t4d0s2
fmthard: New volume table of contents now in place.

bash-3.00# metadb -a -f -c2 /dev/dsk/c1t1d0s7 /dev/dsk/c1t4d0s7

/dev/dsk/c1t1d0s1 – – swap – no –
/dev/dsk/c1t1d0s0 /dev/rdsk/c1t1d0s0 / ufs 1
no –
/dev/dsk/c1t1d0s3 /dev/rdsk/c1t1d0s3 /var ufs 1
no –
/dev/dsk/c1t1d0s4 /dev/rdsk/c1t1d0s4 /export ufs 2
yes

bash-3.00# metainit -f d10 1 1 c1t1d0s0
d10: Concat/Stripe is setup
bash-3.00# metainit d20 1 1 c1t4d0s0
d20: Concat/Stripe is setup
bash-3.00# metainit d30 -m d10
d30: Mirror is setup

bash-3.00# metaroot d30

bash-3.00# metainit -f d11 1 1 c1t1d0s1
d11: Concat/Stripe is setup
bash-3.00# metainit d21 1 1 c1t4d0s1
d21: Concat/Stripe is setup
bash-3.00# metainit d31 -m d11
d31: Mirror is setup

bash-3.00# metainit -f d13 1 1 c1t1d0s3
d13: Concat/Stripe is setup
bash-3.00# metainit d23 1 1 c1t4d0s3
d23: Concat/Stripe is setup
bash-3.00# metainit d33 -m d13
d33: Mirror is setup

bash-3.00# metainit -f d14 1 1 c1t1d0s4
d14: Concat/Stripe is setup
bash-3.00# metainit d24 1 1 c1t4d0s4
d24: Concat/Stripe is setup
bash-3.00# metainit d34 -m d14
d34: Mirror is setup

vi /etc/vfstab

bash-3.00# metainit hsp001
hsp001: Hotspare pool is setup

bash-3.00# lockfs -fa
bash-3.00# init 6

# metattach d30 d20
d30: submirror d20 is attached
# metattach d31 d21
d31: submirror d21 is attached
# metattach d33 d23
d33: submirror d23 is attached
# metattach d34 d24
d34: submirror d24 is attached

# metastat

If you fat finger something, you can use metaclear to remove it:

# metaclear d34