2013-12-10 73 views
7

我的某個vdevs將zpool的狀態設置爲降級: root @ mediaserver:〜#zpool狀態 pool:zfsraid state:DEGRADEDzpool替換錯誤,但不包含EFI標籤,但它可能包含分區

所以我開始採取措施更換驅動器。

這是舊盤的ID:WWN-0x5000cca225f459d5 這是更換磁盤的ID:WWN-0x5000c5006e38bc61

1)離線舊盤:

zpool offline zfsraid wwn-0x5000cca225f459d5 

2 )用新磁盤物理替換舊磁盤

3)發佈替換命令:

zpool replace -o ashift=12 zfsraid wwn-0x5000cca225f459d5 wwn-0x5000c5006e38bc61 

替換命令失敗:

[email protected]:~# zpool replace -o ashift=12 zfsraid wwn-0x5000cca225f459d5 wwn-0x5000c5006e38bc61 
**invalid vdev specification 
use '-f' to override the following errors: 
/dev/disk/by-id/wwn-0x5000c5006e38bc61 does not contain an EFI label but it may contain partition 
information in the MBR.** 

我似乎無法找到任何信息,以幫助。幾個論壇說使用-f選項,但似乎粗略。新驅動器上沒有列出分區

[email protected]:~# fdisk -l /dev/disk/by-id/wwn-0x5000c5006e38bc61 

Disk /dev/disk/by-id/wwn-0x5000c5006e38bc61: 3000.6 GB, 3000592982016 bytes 
255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 sectors 
Units = sectors of 1 * 512 = 512 bytes 
Sector size (logical/physical): 512 bytes/4096 bytes 
I/O size (minimum/optimal): 4096 bytes/4096 bytes 
Disk identifier: 0x00000000 

Disk /dev/disk/by-id/wwn-0x5000c5006e38bc61 doesn't contain a valid partition table 
[email protected]:~# 

我是否必須運行一些命令擦除新驅動器?

這些都是在dmesg的有關驅動器的最後幾行:

[420274.400024] scsi 11:0:8:0: Direct-Access  ATA  ST3000DM001-1CH1 CC29 PQ: 0 ANSI: 6 
[420274.400036] scsi 11:0:8:0: SATA: handle(0x000f), sas_addr(0x4433221107000000), phy(7), device_name(0x0000000000000000) 
[420274.400039] scsi 11:0:8:0: SATA: enclosure_logical_id(0x5000000080000000), slot(4) 
[420274.400130] scsi 11:0:8:0: atapi(n), ncq(y), asyn_notify(n), smart(y), fua(y), sw_preserve(y) 
[420274.400134] scsi 11:0:8:0: qdepth(32), tagged(1), simple(0), ordered(0), scsi_level(7), cmd_que(1) 
[420274.400502] sd 11:0:8:0: Attached scsi generic sg17 type 0 
[420274.401375] sd 11:0:8:0: [sdr] 5860533168 512-byte logical blocks: (3.00 TB/2.72 TiB) 
[420274.401377] sd 11:0:8:0: [sdr] 4096-byte physical blocks 
[420274.475163] sd 11:0:8:0: [sdr] Write Protect is off 
[420274.475166] sd 11:0:8:0: [sdr] Mode Sense: 7f 00 10 08 
[420274.475966] sd 11:0:8:0: [sdr] Write cache: enabled, read cache: enabled, supports DPO and FUA 
[420274.554649] sdr: unknown partition table 
[420274.646245] sd 11:0:8:0: [sdr] Attached SCSI disk 

這是Ubuntu的版本我跑:

Ubuntu 12.04.3 LTS \n \l 

根@媒體服務器:〜#UNAME - a

Linux mediaserver 3.5.0-44-generiC#67~precise1-Ubuntu SMP Wed Nov 13 16:16:57 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux 

回答

2

首先,重要的是要知道,通過發行

# zdb | grep ashift 

如果ashift = 9,那麼你將不得不使用-o ashift更換硬盤= 9:

zpool replace -o ashift=9 zfsraid wwn-0x5000cca225f459d5 wwn-0x5000c5006e38bc61 

不過,若你有你的池設置爲ashift = 12,則您輸入的命令應該是正確的。確保至少在Linux v0.6.2上有zfs,它應該能夠處理shift選項。

+0

12似乎是默認設置,至少在去年我開始在家中使用ZFS時是這樣。 – MikeP

0

您需要在更換之前在驅動器上創建一個GPT分區表。

+4

請考慮在答案中增加更多細節;例如通過指定如何創建GPT分區表。 – Matt

12

@Matt,這裏有更多的細節。

TL; DR:

要使用新的驅動器來替換故障之一,使用分手

mklabel GPT 

擴展舞蹈混音版本:

我有這個確切的問題,並在今晚解決它。我在Linux(0.6.0-1)和3個1TB驅動器上使用zfs,使用Debian Squeeze(6.0.10)。

[email protected]:~# zpool status 
    pool: dead_pool 
state: DEGRADED 
status: One or more devices are faulted in response to persistent errors. 
    Sufficient replicas exist for the pool to continue functioning in a 
    degraded state. 
action: Replace the faulted device, or use 'zpool clear' to mark the device 
    repaired. 
scan: resilvered 6.09G in 3h10m with 0 errors on Tue Sep 1 11:15:24 2015 
config: 

NAME         STATE  READ WRITE CKSUM 
dead_pool        DEGRADED  0  0  0 
    raidz1-0        DEGRADED  0  0  0 
    scsi-SATA_<orig_device_1>   ONLINE  0  0  0 
    scsi-SATA_<orig_device_2>   ONLINE  0  0  0 
    scsi-SATA_<orig_device_3>   FAULTED  0  3  0 too many errors 

Y。我今天下午出去買了一個相同尺寸(不同型號/型號)的新驅動器,關閉電源並將其與三個現有zfs驅動器一起安裝。再次通電,當系統啓動時,我看到舊驅動器上的I/O錯誤氾濫。可怕的東西。

要在ZFS與新替換舊:

  • 舊磁盤ID:1784233895253655477
  • 新的磁盤設備(使用 'ZDB' 中)是:/ dev /磁盤/副ID/SCSI -SATA_

    [email protected]:~# zpool offline dead_pool 1784233895253655477 
    [email protected]:~# zpool replace dead_pool 1784233895253655477 /dev/disk/by-id/scsi-SATA_<new_device_id> 
    invalid vdev specification 
    use '-f' to override the following errors: 
    /dev/disk/by-id/scsi-SATA_<new_device_id> does not contain an EFI label but it may contain partition 
    information in the MBR. 
    

這是@馬特的問題也發揮了作用。使用parted來建立一個GPT(感謝systutorials.com):

[email protected]:~# parted /dev/disk/by-id/scsi-SATA_<new_device_id> 
GNU Parted 2.3 
Using /dev/sde 
Welcome to GNU Parted! Type 'help' to view a list of commands. 
(parted) mklabel GPT              
(parted) q                 
Information: You may need to update /etc/fstab. 

嘗試再次更換:

[email protected]:~# zpool replace dead_pool 1784233895253655477 /dev/disk/by-id/scsi-SATA_<new_device_id> 
[email protected]:~# 

大它成功返回。現在再次檢查zpool:

[email protected]:~# zpool status 
    pool: dead_pool 
state: DEGRADED 
status: One or more devices is currently being resilvered. The pool will 
    continue to function, possibly in a degraded state. 
action: Wait for the resilver to complete. 
scan: resilver in progress since Thu Sep 3 22:31:25 2015 
    23.8G scanned out of 690G at 19.7M/s, 9h35m to go 
    7.93G resilvered, 3.45% done 
config: 

    NAME         STATE  READ WRITE CKSUM 
    dead_pool        DEGRADED  0  0  0 
     raidz1-0        DEGRADED  0  0  0 
     scsi-SATA_<orig_device_1>   ONLINE  0  0  0 
     scsi-SATA_<orig_device_2>   ONLINE  0  0  0 
     replacing-2       OFFLINE  0  0  0 
      scsi-SATA_<orig_device_3>   OFFLINE  0  0  0 
      scsi-SATA_<new_device_id>   ONLINE  0  0  0 (resilvering) 

希望這有助於。

+0

嗚!你搖滾。當然很高興我從RAID5切換到ZFS鏡像。過去需要花費幾天時間來更換一個死亡的驅動器,然後有一天它完全震動了牀,我失去了一切。看起來這一次只需要一個多小時的時間來「恢復」。 – mpen

相關問題