aboutsummaryrefslogtreecommitdiffstats
path: root/setup/copy_to_new_pool.sh
diff options
context:
space:
mode:
Diffstat (limited to 'setup/copy_to_new_pool.sh')
-rw-r--r--setup/copy_to_new_pool.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/setup/copy_to_new_pool.sh b/setup/copy_to_new_pool.sh
new file mode 100644
index 0000000..6e2f45a
--- /dev/null
+++ b/setup/copy_to_new_pool.sh
@@ -0,0 +1,30 @@
+export ROOTFS_DIR="/mnt"
+export POOL1=tpool
+export POOL2=tpool2
+export SNAPNAME=transfer
+
+zfs snapshot -r $POOL1@$SNAPNAME
+zfs send -R $POOL1@$SNAPNAME | zfs receive -Fduv $POOL2
+
+zfs destroy -r $POOL1@$SNAPNAME
+zfs destroy -r $POOL2@$SNAPNAME
+
+# now re-import on $ROOTFS_DIR w/ mounting
+zpool export $POOL2
+zpool import -R $ROOTFS_DIR $POOL
+
+# Maintenance
+echo
+echo "$POOL2 mountpoints"
+zfs get -r mountpoint $POOL2
+
+echo
+echo "$POOL2 compression"
+zfs get -r compression $POOL2
+
+echo
+echo "$POOL2 snapshots"
+zfs list -r -t snapshot $POOL2
+
+# follow
+# - ../rescue/chroot_zfs.sh to update grub on new pool