Zfs

從鏡像子導入 ZFS 池

  • September 5, 2019

我從兩個磁碟創建了一個 ZFS 鏡像。然後,在不導出創建的池的情況下,我將其中一個磁碟移動到另一個系統。如何從不同系統上的鏡像子節點取回數據?

我使用 zdb 命令來獲取有關池的資訊,這裡是輸出:

zdb -l sde

------------------------------------
LABEL 0
------------------------------------
   version: 5000
   name: 'mypool'
   state: 2
   txg: 121
   pool_guid: 12279094248801560314
   errata: 0
   hostname: 'dse1051'
   top_guid: 5698356755932484628
   guid: 8107190423262889178
   vdev_children: 1
   vdev_tree:
       type: 'mirror'
       id: 0
       guid: 5698356755932484628
       metaslab_array: 256
       metaslab_shift: 27
       ashift: 9
       asize: 26828341248
       is_log: 0
       create_txg: 4
       children[0]:
           type: 'disk'
           id: 0
           guid: 12590988309290499730
           path: '/dev/sde1'
           whole_disk: 1
           create_txg: 4
       children[1]:
           type: 'disk'
           id: 1
           guid: 8107190423262889178
           path: '/dev/sdf1'
           whole_disk: 1
           create_txg: 4
   features_for_read:
       com.delphix:hole_birth
       com.delphix:embedded_data
   labels = 0 1 2 3 

我使用了命令

zpool import mypool 

我也使用了泳池指南,但我總是得到:no such pool available

state: 2意味著池是DEGRADED,使用命令後zpool import -D我得到以下輸出:

  pool: mypool
    id: 12279094248801560314
 state: DEGRADED (DESTROYED)
status: One or more devices contains corrupted data.
action: The pool can be imported despite missing or damaged devices.  The
   fault tolerance of the pool may be compromised if imported.
  see: http://zfsonlinux.org/msg/ZFS-8000-4J
config:

   mypool      DEGRADED
     mirror-0  DEGRADED
       sde     FAULTED  corrupted data
       sde     ONLINE

不幸的是,我仍然無法導入池。

缺少的技巧是:使用後zpool import -D 我們不應該zpool import -D mypool只使用zpool import mypool

引用自:https://serverfault.com/questions/982048