mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
zdb: add -B option to generate backup stream
This is more-or-less like `zfs send`, but specifying the snapshot by its objset id for situations where it can't be referenced any other way. Sponsored-By: Klara, Inc. Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de> Reviewed-by: WHR <msl0000023508@gmail.com> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes #14642
This commit is contained in:
committed by
Brian Behlendorf
parent
2b9f8ba673
commit
8653f1de48
@@ -128,7 +128,7 @@ tests = ['zdb_002_pos', 'zdb_003_pos', 'zdb_004_pos', 'zdb_005_pos',
|
||||
'zdb_block_size_histogram', 'zdb_checksum', 'zdb_decompress',
|
||||
'zdb_display_block', 'zdb_encrypted', 'zdb_label_checksum',
|
||||
'zdb_object_range_neg', 'zdb_object_range_pos', 'zdb_objset_id',
|
||||
'zdb_decompress_zstd', 'zdb_recover', 'zdb_recover_2']
|
||||
'zdb_decompress_zstd', 'zdb_recover', 'zdb_recover_2', 'zdb_backup']
|
||||
pre =
|
||||
post =
|
||||
tags = ['functional', 'cli_root', 'zdb']
|
||||
|
||||
@@ -572,6 +572,7 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \
|
||||
functional/cli_root/zdb/zdb_006_pos.ksh \
|
||||
functional/cli_root/zdb/zdb_args_neg.ksh \
|
||||
functional/cli_root/zdb/zdb_args_pos.ksh \
|
||||
functional/cli_root/zdb/zdb_backup.ksh \
|
||||
functional/cli_root/zdb/zdb_block_size_histogram.ksh \
|
||||
functional/cli_root/zdb/zdb_checksum.ksh \
|
||||
functional/cli_root/zdb/zdb_decompress.ksh \
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
#!/bin/ksh
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2023, Klara Inc.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
write_count=8
|
||||
blksize=131072
|
||||
|
||||
tmpfile=$TEST_BASE_DIR/tmpfile
|
||||
|
||||
function cleanup
|
||||
{
|
||||
datasetexists $TESTPOOL && destroy_pool $TESTPOOL
|
||||
rm $tmpfile.1 $tmpfile.2
|
||||
}
|
||||
|
||||
log_onexit cleanup
|
||||
|
||||
log_assert "Verify that zfs send and zdb -B produce the same stream"
|
||||
|
||||
verify_runnable "global"
|
||||
verify_disk_count "$DISKS" 2
|
||||
|
||||
default_mirror_setup_noexit $DISKS
|
||||
file_write -o create -w -f $TESTDIR/file -b $blksize -c $write_count
|
||||
|
||||
snap=$TESTPOOL/$TESTFS@snap
|
||||
log_must zfs snapshot $snap
|
||||
typeset -i objsetid=$(zfs get -Ho value objsetid $snap)
|
||||
|
||||
sync_pool $TESTPOOL
|
||||
|
||||
log_must eval "zfs send -ecL $snap > $tmpfile.1"
|
||||
log_must eval "zdb -B $TESTPOOL/$objsetid ecL > $tmpfile.2"
|
||||
|
||||
typeset sum1=$(cat $tmpfile.1 | md5sum)
|
||||
typeset sum2=$(cat $tmpfile.2 | md5sum)
|
||||
|
||||
log_must test "$sum1" = "$sum2"
|
||||
|
||||
log_pass "zfs send and zdb -B produce the same stream"
|
||||
Reference in New Issue
Block a user