mirror of
https://github.com/kneutron/ansitest.git
synced 2025-01-16 04:42:55 +08:00
moar descriptive
This commit is contained in:
parent
64d0377167
commit
5fa6ab3382
@ -1,15 +1,23 @@
|
|||||||
#!/bin/bash
|
#!/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
|
# Mod for RAID10 test (replace 4TB with 6TB HGST) == OK
|
||||||
# REF: https://www.reddit.com/r/zfs/comments/fwv7ky/help_expanding_zfs_mirror/
|
# 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
|
# 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
|
logfile=~/zpool-resizeup-mirror.log
|
||||||
|
|
||||||
cd /Users/dave
|
cd /Users/dave
|
||||||
|
# xxx TODO EDITME, primary user and this is where the disks will be created
|
||||||
|
|
||||||
zp=ztestpool
|
zp=ztestpool
|
||||||
|
|
||||||
@ -35,15 +43,16 @@ function mkdisks () {
|
|||||||
ls -alh
|
ls -alh
|
||||||
|
|
||||||
# only if not exist
|
# 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 \
|
time zpool create -o ashift=12 -o autoexpand=on -O atime=off -O compression=lz4 $zp \
|
||||||
mirror $PWD/$disk1 $PWD/$disk2 \
|
mirror $PWD/$disk1 $PWD/$disk2 \
|
||||||
mirror $PWD/$disk3 $PWD/$disk4 \
|
mirror $PWD/$disk3 $PWD/$disk4 \
|
||||||
|| failexit 101 "Cant create zpool $zp"
|
|| failexit 101 "Cant create zpool $zp"
|
||||||
|
|
||||||
|
# xxx TODO EDITME
|
||||||
echo "Populating $zp with data"
|
echo "Populating $zp with data"
|
||||||
time cp -v /Volumes/zsgtera2B/shrcompr-zsgt2B/ISO/bl-Helium_i386_cdsized+build2.iso /Volumes/$zp \
|
time cp -v /Volumes/zsgtera4/shrcompr-zsgt2B/ISO/bl-Helium_i386_cdsized+build2.iso /Volumes/$zp \
|
||||||
|| failexit 102 "Copy file to pool $zp fail"
|
|| failexit 102 "Copy file to pool $zp failed"
|
||||||
} #END FUNC
|
} #END FUNC
|
||||||
|
|
||||||
function zps () {
|
function zps () {
|
||||||
@ -53,6 +62,26 @@ function zps () {
|
|||||||
|
|
||||||
mkdisks # comment me if nec
|
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
|
zps |tee -a $logfile
|
||||||
|
|
||||||
echo "PK to attach larger disks ONE AT A TIME to 1st mirror-0"
|
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
|
# 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"
|
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"
|
time zpool attach $zp $PWD/$disk2 $PWD/$disk6 || failexit 104 "zpool attach disk6 fail"
|
||||||
zfs-watchresilver-boojum.sh
|
wait4resilver
|
||||||
|
|
||||||
zps |tee -a $logfile
|
zps |tee -a $logfile
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user