From c37ac6aeacfde76758e0436317b954a83708973e Mon Sep 17 00:00:00 2001 From: kneutron <50146127+kneutron@users.noreply.github.com> Date: Wed, 19 Jun 2024 10:26:15 -0600 Subject: [PATCH] bring file-backed rpool mirror over sshfs/samba up/down --- proxmox/zpo.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 proxmox/zpo.sh diff --git a/proxmox/zpo.sh b/proxmox/zpo.sh new file mode 100644 index 0000000..cc29fcb --- /dev/null +++ b/proxmox/zpo.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Bring a zfs file-backed mirror file online/offline to refresh/resilver the backup +# 2024.Jun kneutron + +logf=~/rpool-online-offline-mirdisk.log + +# change online/offline state of sshfs mirror disk for STABILITY and resilver updating +mirdisk=$(zpool status -v |grep rpool-mirror-.*zfs-efi.disk |awk '{print $1}') + +if [ "$1" = "1" ]; then +# TODO add if-mounted test here + echo "$(date) - Onlining rpool $mirdisk" |tee -a $logf + (set -x; time zpool online rpool $mirdisk) + zfs-watchresilver-boojum.sh +else + echo "$(date) - Offlining rpool $mirdisk" |tee -a $logf + (set -x; time zpool offline rpool $mirdisk) +fi + +zpool status rpool -v |awk 'NF>0'