mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
zpool import -d to specify device path
When we know which devices have the pool we are looking for, sometime
it's better if we can directly pass those device paths to zpool import
instead of letting it to search through all unrelated stuff, which might
take a lot of time if you have hundreds of disks.
This patch allows option -d <dev_path> to zpool import. You can have
multiple pairs of -d <dev_path>, and zpool import will only search
through those devices. For example:
zpool import -d /dev/sda -d /dev/sdb
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@nutanix.com>
Closes #7077
This commit is contained in:
committed by
Brian Behlendorf
parent
f55a8757a6
commit
522db29275
@@ -17,6 +17,7 @@ dist_pkgdata_SCRIPTS = \
|
||||
zpool_import_012_pos.ksh \
|
||||
zpool_import_013_neg.ksh \
|
||||
zpool_import_014_pos.ksh \
|
||||
zpool_import_015_pos.ksh \
|
||||
zpool_import_all_001_pos.ksh \
|
||||
zpool_import_features_001_pos.ksh \
|
||||
zpool_import_features_002_neg.ksh \
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
#!/bin/ksh -p
|
||||
#
|
||||
# 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) 2018 by Nutanix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
. $STF_SUITE/tests/functional/cli_root/zpool_import/zpool_import.cfg
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Make sure zpool import -d <device> works.
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Create test pool A.
|
||||
# 2. Export pool A.
|
||||
# 3. Verify 'import -d <device>' works
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
destroy_pool $TESTPOOL1
|
||||
|
||||
log_must rm $VDEV0 $VDEV1
|
||||
log_must truncate -s $FILE_SIZE $VDEV0 $VDEV1
|
||||
}
|
||||
|
||||
log_assert "Pool can be imported with '-d <device>'"
|
||||
log_onexit cleanup
|
||||
|
||||
log_must zpool create $TESTPOOL1 $VDEV0 $VDEV1
|
||||
log_must zpool export $TESTPOOL1
|
||||
|
||||
log_must zpool import -d $VDEV0 -d $VDEV1 $TESTPOOL1
|
||||
log_must zpool export $TESTPOOL1
|
||||
|
||||
# mix -d <dir> and -d <device>
|
||||
log_must mkdir $DEVICE_DIR/test_dir
|
||||
log_must ln -s $VDEV0 $DEVICE_DIR/test_dir/disk
|
||||
log_must zpool import -d $DEVICE_DIR/test_dir -d $VDEV1 $TESTPOOL1
|
||||
|
||||
log_pass "Pool can be imported with '-d <device>'"
|
||||
Reference in New Issue
Block a user