1#!/bin/ksh
2
3#
4# This file and its contents are supplied under the terms of the
5# Common Development and Distribution License ("CDDL"), version 1.0.
6# You may only use this file in accordance with the terms of version
7# 1.0 of the CDDL.
8#
9
10#
11# Description:
12#
13# Test whether zhack label repair can recover a device of varied size with
14# corrupted checksums and which has been detached (in one command).
15#
16# Strategy:
17#
18# 1. Create pool on a loopback device with some test data
19# 2. Detach either device from the mirror
20# 3. Export the pool
21# 4. Remove the non-detached device and its backing file
22# 5. Corrupt all label checksums on the remaining device
23# 6. Verify that the remaining detached device cannot be imported
24# 7. Use zhack label repair -cu on device to attempt to fix checksums and
25#    undetach the device in a single operation.
26# 8. Verify that the detached device can be imported and that data is intact
27
28. "$STF_SUITE"/tests/functional/cli_root/zhack/library.kshlib
29
30run_test_four "$(get_devsize)"
31