Page 1 of 1

HowTo: Notes on ZFS configuration backup

Posted: Mon Apr 19, 2021 12:58 am
by ^rooker
Shellscript sketchpad for documenting the configuration of a ZFS storage constellation:

Code: Select all

#!/bin/bash

TIMESTAMP="$(date +%Y%m%d-%H%M )"
INFOFILE="zfs-avrd_microcosm-$TIMESTAMP.info"

function run_cmd
{
    CMD="$1"

    echo "$CMD"
    eval "$CMD" | tee -a $INFOFILE
}

function log_line
{
    MSG="$1"
    echo ""
    echo ""
    echo "==========================================="
    echo "$MSG"
    echo ""
}


log_line "ZFS Configuration - [$TIMESTAMP]"

run_cmd 'zpool list'
run_cmd 'zpool status tank4'
run_cmd 'zfs list tank4'
run_cmd 'zfs get all tank4'
Creates a textfile with all information considered relevant, or at least easily gatherable running ZFS on GNU/Linux.