HowTo: Notes on ZFS configuration backup

Step-by-Step descriptions of how to do things.
Post Reply
User avatar
^rooker
Site Admin
Posts: 1482
Joined: Fri Aug 29, 2003 8:39 pm

HowTo: Notes on ZFS configuration backup

Post 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.
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
Post Reply