Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Cloning

 

Image result for page under construction

Boot a Cento 7 Live DVD

 

Install ZFS
yum -y install http://download.zfsonlinux.org/epel/zfs-release.el7_3.noarch.rpm
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:

vdev_id.conf for Supermicro 5028A-TN4
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
 

 

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

 

Create rpool

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:

URL="ftp://ftp.nrg.wustl.edu/pub/XNAT_relay/relay-server_rpool-to-clone_2017-02-07.zfs.gz"
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 for 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 /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-install /dev/disk/by-vdev/ssd1
grub2-install /dev/disk/by-vdev/ssd2
 
 

 

Prepare the relaypool

 
 
 

TODO:

Setup Nagios Monitoring:

http://www.admin-magazine.com/Archive/2014/22/Nagios-Passive-Checks 

  • No labels