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) 2019 by Tim Chase. All rights reserved.
19 # Copyright (c) 2019 Lawrence Livermore National Security, LLC.
22 . $STF_SUITE/include/libtest.shlib
23 . $STF_SUITE/tests/functional/cli_root/zpool_trim/zpool_trim.kshlib
27 # Verify 'zpool trim -d' secure trim.
30 # 1. Create a pool on a single file vdev.
31 # 2. Run 'zpool trim -d' to securely TRIM allocated space maps.
32 # 3. Verify it fails when using a file vdev.
34 # NOTE: Currently secure discard cannot be verified using file vdevs,
35 # loopback, or scsi_debug devices. None of which support the feature.
36 # It can only be tested using real SSDs which provide support.
41 if poolexists $TESTPOOL; then
42 destroy_pool $TESTPOOL
45 if [[ -d "$TESTDIR" ]]; then
51 LARGESIZE=$((MINVDEVSIZE * 4))
52 LARGEFILE="$TESTDIR/largefile"
54 log_must mkdir "$TESTDIR"
55 log_must truncate -s $LARGESIZE "$LARGEFILE"
56 log_must zpool create $TESTPOOL "$LARGEFILE"
57 log_mustnot zpool trim -d $TESTPOOL
59 log_pass "Manual 'zpool trim -d' failed as expected for file vdevs"