moar descriptive

This commit is contained in:
kneutron 2021-04-12 18:28:03 -05:00 committed by GitHub
parent 64d0377167
commit 5fa6ab3382
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,15 +1,23 @@
#!/bin/bash
# OSX - gdd
# OSX version - use gdd and gdf from brew/macports
# Proof of concept with file-backed pool
# Mod for RAID10 test (replace 4TB with 6TB HGST) == OK
# REF: https://www.reddit.com/r/zfs/comments/fwv7ky/help_expanding_zfs_mirror/
# make sure mirror is not degraded when replacing disks with larger sizes
source ~/bin/failexit.mrg
#source ~/bin/failexit.mrg
# failexit.mrg
function failexit () {
echo '! Something failed! Code: '"$1 $2" # code # (and optional description)
exit $1
}
logfile=~/zpool-resizeup-mirror.log
cd /Users/dave
# xxx TODO EDITME, primary user and this is where the disks will be created
zp=ztestpool
@ -35,15 +43,16 @@ function mkdisks () {
ls -alh
# only if not exist
[ `echo $(zpool list|grep -c $zp)` -ge 1 ] || \
[ $(zpool list|grep -c $zp) -ge 1 ] || \
time zpool create -o ashift=12 -o autoexpand=on -O atime=off -O compression=lz4 $zp \
mirror $PWD/$disk1 $PWD/$disk2 \
mirror $PWD/$disk3 $PWD/$disk4 \
|| failexit 101 "Cant create zpool $zp"
# xxx TODO EDITME
echo "Populating $zp with data"
time cp -v /Volumes/zsgtera2B/shrcompr-zsgt2B/ISO/bl-Helium_i386_cdsized+build2.iso /Volumes/$zp \
|| failexit 102 "Copy file to pool $zp fail"
time cp -v /Volumes/zsgtera4/shrcompr-zsgt2B/ISO/bl-Helium_i386_cdsized+build2.iso /Volumes/$zp \
|| failexit 102 "Copy file to pool $zp failed"
} #END FUNC
function zps () {
@ -53,6 +62,26 @@ function zps () {
mkdisks # comment me if nec
# wait4resilver.mrg
function wait4resilver () {
sdate=$(date)
# do forever
while :; do
clear
echo "Pool: $1 - NOW: $(date) -- Watchresilver started: $sdate"
zpool status $1 |grep -A 2 'resilver in progress' || break 2
zpool iostat -v -y $1 2 3 &
sleep 9
date
done
ndate=$(date)
zpool status -v $1
echo "o Resilver watch $1 start: $sdate // Completed: $ndate"
}
zps |tee -a $logfile
echo "PK to attach larger disks ONE AT A TIME to 1st mirror-0"
@ -61,10 +90,11 @@ read -n 1
# REF: https://docs.oracle.com/cd/E19253-01/819-5461/gcfhe/index.html
time zpool attach $zp $PWD/$disk1 $PWD/$disk5 || failexit 103 "zpool attach disk5 fail"
zfs-watchresilver-boojum.sh
#zfs-watchresilver-boojum.sh
wait4resilver
time zpool attach $zp $PWD/$disk2 $PWD/$disk6 || failexit 104 "zpool attach disk6 fail"
zfs-watchresilver-boojum.sh
wait4resilver
zps |tee -a $logfile