]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/cli_root/zfs_copies/zfs_copies_002_pos.ksh
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
28 .
$STF_SUITE/include
/libtest.shlib
29 .
$STF_SUITE/tests
/functional
/cli_root
/zfs_copies
/zfs_copies.kshlib
33 # Verify that the space used by multiple copies is charged correctly
36 # 1. Create filesystems with copies set as 2,3 respectively;
37 # 2. Copy specified size data into each filesystem;
38 # 3. Verify that the space is charged as expected with zfs list, ls -s, df(1m),
42 verify_runnable
"both"
49 if datasetexists
$TESTPOOL/fs_
$val; then
50 log_must
$ZFS destroy
$TESTPOOL/fs_
$val
55 log_assert
"Verify that the space used by multiple copies is charged correctly."
59 log_must
$ZFS create
-o copies
=$val $TESTPOOL/fs_
$val
61 log_must
$MKFILE $FILESIZE /$TESTPOOL/fs_
$val/$FILE
65 # Sync up the filesystem
70 # Verify 'zfs list' can correctly list the space charged
72 log_note
"Verify 'zfs list' can correctly list the space charged."
73 fsize
=${FILESIZE%[m|M]}
75 used
=$
(get_used_prop
$TESTPOOL/fs_
$val)
79 log_note
"Verify 'ls -s' can correctly list the space charged."
81 blks
=`$LS -ls /$TESTPOOL/fs_$val/$FILE | $AWK '{print $1}'`
82 (( used
= blks
* 512 / (1024 * 1024) ))
86 log_note
"Verify df(1M) can corectly display the space charged."
88 used
=`$DF -F zfs -h /$TESTPOOL/fs_$val/$FILE | $GREP $TESTPOOL/fs_$val \
93 log_note
"Verify du(1) can correctly display the space charged."
95 used
=`$DU -h /$TESTPOOL/fs_$val/$FILE | $AWK '{print $1}'`
99 log_pass
"The space used by multiple copies is charged correctly as expected. "