From: Alan J. Pippin Date: Sat, 22 Dec 2012 17:38:04 +0000 (-0700) Subject: Changes to support mounting backup pool under linux zfs X-Git-Url: http://git.pippins.net/embedvideo/.git/static/images/%7Bdone_action%7D?a=commitdiff_plain;h=ca396abc312461c5eb10134c34ec018f81009b9e;p=zfs-ubuntu%2F.git Changes to support mounting backup pool under linux zfs --- diff --git a/zfs-replicate-all b/zfs-replicate-all index c47b86f..0ed35f5 100755 --- a/zfs-replicate-all +++ b/zfs-replicate-all @@ -77,7 +77,7 @@ snapshot_age() { fi } -# Mount the local backup pool if needed and the option is given to do so, else error out +# Import the local backup pool if needed and the option is given to do so, else error out zpool list -H "$backup_pool" >/dev/null 2>&1 if [ $? != 0 ]; then if [[ $import_export_backup_pool == 1 ]]; then diff --git a/zfs-rm-all-snaps b/zfs-rm-all-snaps index c65c5ba..73c0746 100755 --- a/zfs-rm-all-snaps +++ b/zfs-rm-all-snaps @@ -28,7 +28,8 @@ echo -e "\n"; read for snap in `zfs list -t snapshot 2>/dev/null | grep "^$zfs_pool" | grep "$snap_pattern" | awk '{print $1}'`; do + echo " destroying snapshot: $snap" zfs destroy "$snap" 2>/dev/null done -echo "-> Snapshots removed" \ No newline at end of file +echo "-> Snapshots removed" diff --git a/zfs-scrub b/zfs-scrub index 462d979..c7d6297 100755 --- a/zfs-scrub +++ b/zfs-scrub @@ -23,6 +23,21 @@ fi for i in $pools do + # Import the local pool if needed and option was given to do so, else error out + zpool list -H "$i" >/dev/null 2>&1 + if [ $? != 0 ]; then + if [[ $import_export_backup_pool == 1 ]]; then + zpool import $i + if [ $? != 0 ]; then + echo "-E- unable to import the pool $i" + exit 1 + fi + else + echo "-E- The local pool, '$i' doesn't seem to exist." + exit 1 + fi + fi + # Check to see if any zfs filesystem has a scrub being performed on it now. # If it does, we cannot perform more than one scrub operation at a time. while true; do @@ -66,6 +81,17 @@ do zpool status $i | $mailx -s "zpool scrub $i found errors" $mailto fi -done + # Export the local pool if told to do so + if [[ $import_export_backup_pool == 1 ]]; then + zpool export $i + if [ $? != 0 ]; then + fatal_and_exit "-E- unable to export the local pool $i" + fi + fi + # Update NFS mounts + filesystems=`zfs list -t filesystem | grep "^$i" | grep -v "$i/$i" | grep -v "^$i " | awk '{ print $1 }' | tr '\n' ' '` + zfs set sharenfs=on $filesystems + +done