我無法從 zfs 池中刪除“壞”磁碟

我無法從 zfs 池中刪除“壞”磁碟
  1. 池中有 2 個磁碟 /dev/sde /dev/sdf

  2. 磁碟 /dev/sde 已損壞,我將其從池中排除並用新磁碟替換。襲擊已經降級。

  3. 將新的 /dev/sde 磁碟新增至池後,我得到了以下配置:

 zpool status
  pool: rpool
 state: DEGRADED
status: One or more devices could not be used because the label is missing or
        invalid.  Sufficient replicas exist for the pool to continue
        functioning in a degraded state.
action: Replace the device using 'zpool replace'.
   see: http://zfsonlinux.org/msg/ZFS-8000-4J
  scan: scrub repaired 0B in 0h25m with 0 errors on Wed Sep  2 18:32:39 2020
config:

        NAME        STATE     READ WRITE CKSUM
        rpool       DEGRADED     0     0     0
          mirror-0  DEGRADED     0     0     0
            old     UNAVAIL      0     0     0
            sdf2    ONLINE       0     0     0
          sde2      ONLINE       0     0     0

替換、離線、刪除「舊」總是報錯:

zpool replace rpool old

cannot open 'old': no such device in /dev

must be a full path or shorthand device name

在檔案 /etc/zfs/zpool.cache 中我看到磁碟機 /dev/sde2/old

如何在不重新啟動伺服器和刪除陣列(陣列為/)的情況下移除舊磁碟?


root@v05:/# zpool replace rpool old sde2
invalid vdev specification
use '-f' to override the following errors:
/dev/sde2 is part of active pool 'rpool'

root@v05:/# zpool replace -f rpool old sde2
invalid vdev specification
the following errors must be manually repaired:
/dev/sde2 is part of active pool 'rpool'

sde 已經是 rpool 成員。

需要從池中刪除舊的(/dev/sde/old)磁碟。

新增磁碟時沒有錯誤,一切都完全按照您所寫的進行。

答案1

問題解決了。

茲資料庫

找到 /dev/sde/old 裝置的識別 15497986214547762579 並刪除:

zpool離線-f rpool 15497986214547762579

zpool 分離 rpool 15497986214547762579

答案2

新增磁碟時您可能犯了一個錯誤:您發出了zpool add rpool <newdisk>,但您必須代替發生故障的磁碟。換句話說,您必須:

  • zpool replace rpool <olddisk> <newdisk>
  • zpool detach rpool <olddisk>; zpool attach rpool sdfsdf是另一個鏡腿)。

請注意我是如何編寫的attach,而您可能add在 zpool 命令中使用過。

你如何解決這個問題?對於 ZFS 0.7.x,您就不走運了,因為新增資料 vdev 後無法刪除。和ZFS 0.8.x 你可以刪除它因此,如果您執行的是 ZFS 0.7.x,第一步需要更新到 0.8.x。然後您必須發出上述命令來更換故障磁碟。

答案3

我根據oracle文件進行了磁碟更換。我現在有以下命令輸出:

root@v05:/# zpool 取代 rpool 舊 sde2 無效的 vdev 規範使用 '-f' 覆寫下列錯誤:/dev/sde2 是活動池 'rpool' 的一部分

root@v05:/# zpool Replace -f rpool old sde2 invalid vdev 規範 必須手動修正下列錯誤:/dev/sde2 is part of active pool 'rpool'

相關內容