]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/rsend/send-wDR_encrypted_zvol.ksh
5 # This file and its contents are supplied under the terms of the
6 # Common Development and Distribution License ("CDDL"), version 1.0.
7 # You may only use this file in accordance with the terms of version
10 # A full copy of the text of the CDDL should have accompanied this
11 # source. A copy of the CDDL is also available via the Internet at
12 # http://www.illumos.org/license/CDDL.
18 # Copyright (c) 2018 by Datto Inc. All rights reserved.
21 .
$STF_SUITE/tests
/functional
/rsend
/rsend.kshlib
25 # Verify that zvols with dedup=on and encryption=on can be sent and received
26 # with a deduplicated raw send stream.
29 # 1. Create a zvol with dedup and encryption on and put a filesystem on it
30 # 2. Copy a file into the zvol a few times and take a snapshot
31 # 3. Repeat step 2 a few times to create more snapshots
32 # 4. Send all snapshots in a recursive, raw, deduplicated send stream
33 # 5. Mount the received zvol and verify that all of the data there is correct
36 verify_runnable
"both"
40 ismounted
$recvmnt ext4
&& log_must umount
$recvmnt
41 ismounted
$mntpnt ext4
&& log_must umount
$mntpnt
42 [[ -d $recvmnt ]] && log_must
rm -rf $keyfile
43 [[ -d $mntpnt ]] && log_must
rm -rf $keyfile
44 destroy_dataset
$TESTPOOL/recv
"-r"
45 destroy_dataset
$TESTPOOL/$TESTVOL "-r"
46 [[ -f $keyfile ]] && log_must
rm $keyfile
47 [[ -f $sendfile ]] && log_must
rm $sendfile
51 log_assert
"Verify zfs can receive raw, recursive, and deduplicated send streams"
53 typeset keyfile
=/$TESTPOOL/pkey
55 typeset zdev
=$ZVOL_DEVDIR/$TESTPOOL/$TESTVOL
56 typeset mntpnt
=$TESTDIR/$TESTVOL
57 typeset recvdev
=$ZVOL_DEVDIR/$TESTPOOL/recv
58 typeset recvmnt
=$TESTDIR/recvmnt
59 typeset sendfile
=$TESTDIR/sendfile
61 log_must
eval "echo 'password' > $keyfile"
63 log_must zfs create
-o dedup
=on
-o encryption
=on
-o keyformat
=passphrase \
64 -o keylocation
=file://$keyfile -V 128M
$TESTPOOL/$TESTVOL
68 # ext4 only supported on Linux
69 log_must new_fs
-t ext4
$zdev
73 log_must mkdir
-p $mntpnt
74 log_must mkdir
-p $recvmnt
75 log_must mount
$zdev $mntpnt
77 for ((i
= 1; i
<= $snap_count; i
++)); do
78 log_must
dd if=/dev
/urandom of
=$mntpnt/file bs
=1M count
=1
79 for ((j
= 0; j
< 10; j
++)); do
80 log_must
cp $mntpnt/file $mntpnt/file$j
84 log_must zfs snap
$TESTPOOL/$TESTVOL@snap
$i
87 log_must
eval "zfs send -wDR $TESTPOOL/$TESTVOL@snap$snap_count > $sendfile"
88 log_must
eval "zfs recv $TESTPOOL/recv < $sendfile"
89 log_must zfs load-key
$TESTPOOL/recv
92 log_must mount
$recvdev $recvmnt
94 md5_1
=$
(cat $mntpnt/* | md5digest
)
95 md5_2
=$
(cat $recvmnt/* | md5digest
)
96 [[ "$md5_1" == "$md5_2" ]] || log_fail
"md5 mismatch: $md5_1 != $md5_2"
98 log_pass
"zfs can receive raw, recursive, and deduplicated send streams"