Cloning the XNAT Relays



Image result for page under construction

Configure BIOS

Use "Building the XNAT Relays" as a reference

Boot a Cento 7 Live DVD


yum -y install
sed -i -e '/\[zfs\]/,/^\[/s/enabled=1/enabled=0/' /etc/yum.repos.d/zfs.repo
sed -i -e '/\[zfs-kmod\]/,/^\[/s/enabled=0/enabled=1/' /etc/yum.repos.d/zfs.repo
yum -y install zfs zfs-dracut pigz 
modprobe zfs

Create /etc/zfs/vdev_id.conf

with the following contents:

alias   disk1   pci-0000:00:17.0-ata-1.0
alias   disk2   pci-0000:00:17.0-ata-2.0
alias   disk3   pci-0000:00:17.0-ata-3.0
alias   disk4   pci-0000:00:17.0-ata-4.0
alias   ssd1    pci-0000:00:18.0-ata-1.0
alias   ssd2    pci-0000:00:18.0-ata-2.0
alias   ssd1    pci-0000:00:17.0-ata-3.0
wget -qO- "" > /etc/zfs/vdev_id.conf
udevadm trigger
ls -l /dev/disk/by-vdev/


Activate vdevs

udevadm trigger


Partition the SSDs

sgdisk -a1 -n2:34:2047  -t2:EF02 /dev/disk/by-vdev/ssd1
sgdisk     -n9:-8M:0    -t9:BF07 /dev/disk/by-vdev/ssd1
# rpool
sgdisk     -n1:0:40G    -t1:BF01 /dev/disk/by-vdev/ssd1
# cache
sgdisk     -n3:0:+40G   -t3:BF01 /dev/disk/by-vdev/ssd1
# swap
sgdisk     -n4:0:+8G    -t4:8200 /dev/disk/by-vdev/ssd1
sgdisk -a1 -n2:34:2047  -t2:EF02 /dev/disk/by-vdev/ssd2
sgdisk     -n9:-8M:0    -t9:BF07 /dev/disk/by-vdev/ssd2
# rpool
sgdisk     -n1:0:40G    -t1:BF01 /dev/disk/by-vdev/ssd2
# cache
sgdisk     -n3:0:+40G   -t3:BF01 /dev/disk/by-vdev/ssd2
# swap
sgdisk     -n4:0:+8G    -t4:8200 /dev/disk/by-vdev/ssd2
mkswap /dev/disk/by-vdev/ssd1-part4
mkswap /dev/disk/by-vdev/ssd2-part4
sgdisk -a1 -n2:34:2047  -t2:EF02 /dev/disk/by-vdev/ssd1
sgdisk     -n9:-8M:0    -t9:BF07 /dev/disk/by-vdev/ssd1
# rpool
sgdisk     -n1:0:40G    -t1:BF01 /dev/disk/by-vdev/ssd1
# relaypool
sgdisk     -n3:0:+400G   -t3:BF01 /dev/disk/by-vdev/ssd1
# swap
sgdisk     -n4:0:+8G    -t4:8200 /dev/disk/by-vdev/ssd1
mkswap /dev/disk/by-vdev/ssd1-part4


Create rpool

zpool create -f -d \
	-o feature@async_destroy=enabled \
	-o feature@empty_bpobj=enabled \
    -o feature@lz4_compress=enabled \
	-o ashift=12 \
	-O compression=lz4 \
	-O canmount=off \
    -O mountpoint=/ \
    -R /mnt/rpool \
	rpool \
    mirror /dev/disk/by-vdev/ssd1-part1 /dev/disk/by-vdev/ssd2-part1

Populate rpool from image

Substitute URL as necessary:

wget -qO- "$URL" | unpigz | zfs receive -vF rpool

Remount in proper order

zfs umount -a && rm -rf /mnt/rpool
zfs mount rpool/ROOT/centos
zfs mount -a

Prepare rpool to boot on new host

for dir in proc sys dev;do mount --rbind /$dir /mnt/rpool/$dir;done
chroot /mnt/rpool /bin/bash --login
cd /dev;ln -s /dev/disk/by-vdev/* .;cd
rm -f /etc/zfs/zpool.cache
zpool set cachefile=/etc/zfs/zpool.cache rpool
version=`rpm -qa kernel|sort|tail -1|cut -c 8-`
dracut -f -v /boot/initramfs-${version}.img ${version}
grub2-mkconfig -o /boot/grub2/grub.cfg
grep ROOT /boot/grub2/grub.cfg
grub2-set-default 0
grub2-install /dev/disk/by-vdev/ssd1
grub2-install /dev/disk/by-vdev/ssd2 

Set the hostname

Adjust as necessary

echo $hostname > /etc/hostname

Prepare the relaypool

zpool create -f relaypool raidz2 disk1 disk2 disk3 disk4
zfs set compression=lz4 relaypool
zfs set sync=disabled relaypool
zfs set quota=7T relaypool
zfs set edu.wustl.nrg:quotareports=2 relaypool
zfs set edu.wustl.nrg:quotareport:1="2T|warning||2d" relaypool
zfs set edu.wustl.nrg:quotareport:2="512G|critical||12h" relaypool
zpool add relaypool cache ssd1-part3
zpool add relaypool cache ssd2-part3

Populate the relaypool

Substitute URL as necessary:

wget -qO- "$URL" | unpigz | zfs receive -vF relaypool

Clean Up

snaps=`zfs list -H -o name -t snapshot -r|grep clone`;for snap in $snaps ;do echo $snap; zfs destroy $snap;done
rm -rf /tmp/* 

Leave chroot and Copy vdev_id.conf

cp /etc/zfs/vdev_id.conf /mnt/rpool/etc/zfs/vdev_id.conf

Reboot via hard reset

A proper reboot is not possible with mapped /dev.  ZFS does not care.


System will get IP via DHCP

Continue to Post Clone Configuration


Setup Nagios Monitoring: