筆記:zfs 更換硬碟
2025-11-23
檢查哪個硬碟故障
root@pve7:~# zpool status rpool
rpool DEGRADED 0 0 0
raidz1-0 DEGRADED 0 0 0
ata-ST1000DM014-2UB10D_ZFL861C0-part3 ONLINE 0 0 0
ata-ST1000DM014-2UB10D_ZFL861C9-part3 ONLINE 0 0 0
ata-ST1000DM014-2UB10D_ZFL8619T-part3 FAULTED 725 831 0 too many errors
root@pve7:~# ls -l /dev/disk/by-id
total 0
lrwxrwxrwx 1 root root 9 Nov 20 16:13 ata-ST1000DM014-2UB10D_ZFL8619T -> ../../sdc
lrwxrwxrwx 1 root root 10 Nov 20 16:13 ata-ST1000DM014-2UB10D_ZFL8619T-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 10 Nov 20 16:13 ata-ST1000DM014-2UB10D_ZFL8619T-part2 -> ../../sdc2
lrwxrwxrwx 1 root root 10 Nov 20 16:13 ata-ST1000DM014-2UB10D_ZFL8619T-part3 -> ../../sdc3
lrwxrwxrwx 1 root root 9 Nov 20 16:13 ata-ST1000DM014-2UB10D_ZFL861C0 -> ../../sda
lrwxrwxrwx 1 root root 10 Nov 20 16:13 ata-ST1000DM014-2UB10D_ZFL861C0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Nov 20 16:13 ata-ST1000DM014-2UB10D_ZFL861C0-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Nov 20 16:13 ata-ST1000DM014-2UB10D_ZFL861C0-part3 -> ../../sda3
lrwxrwxrwx 1 root root 9 Nov 20 16:13 ata-ST1000DM014-2UB10D_ZFL861C9 -> ../../sdb
lrwxrwxrwx 1 root root 10 Nov 20 16:13 ata-ST1000DM014-2UB10D_ZFL861C9-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Nov 20 16:13 ata-ST1000DM014-2UB10D_ZFL861C9-part2 -> ../../sdb2
lrwxrwxrwx 1 root root 10 Nov 20 16:13 ata-ST1000DM014-2UB10D_ZFL861C9-part3 -> ../../sdb3
lrwxrwxrwx 1 root root 13 Nov 21 08:47 lvm-pv-uuid-0JCcgj-PgmW-XcgJ-hmlV-5Kor-Yayy-Kp9gEJ -> ../../zd240p2
lrwxrwxrwx 1 root root 9 Nov 20 16:13 wwn-0x5000c500e926dd50 -> ../../sda
lrwxrwxrwx 1 root root 10 Nov 20 16:13 wwn-0x5000c500e926dd50-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Nov 20 16:13 wwn-0x5000c500e926dd50-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Nov 20 16:13 wwn-0x5000c500e926dd50-part3 -> ../../sda3
lrwxrwxrwx 1 root root 9 Nov 20 16:13 wwn-0x5000c500e926df1c -> ../../sdb
lrwxrwxrwx 1 root root 10 Nov 20 16:13 wwn-0x5000c500e926df1c-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Nov 20 16:13 wwn-0x5000c500e926df1c-part2 -> ../../sdb2
lrwxrwxrwx 1 root root 10 Nov 20 16:13 wwn-0x5000c500e926df1c-part3 -> ../../sdb3
lrwxrwxrwx 1 root root 9 Nov 20 16:13 wwn-0x5000c500e926e122 -> ../../sdc
lrwxrwxrwx 1 root root 10 Nov 20 16:13 wwn-0x5000c500e926e122-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 10 Nov 20 16:13 wwn-0x5000c500e926e122-part2 -> ../../sdc2
lrwxrwxrwx 1 root root 10 Nov 20 16:13 wwn-0x5000c500e926e122-part3 -> ../../sdc3
找出壞掉的硬碟編號
確定壞掉的 sdc
編號:ata-ST1000DM014-2UB10D_ZFL8619T
關機、換上新的硬碟後...
重開機
root@pve7:~# ls -l /dev/disk/by-id
total 0
lrwxrwxrwx 1 root root 9 Nov 23 17:53 ata-ST1000DM014-2UB10D_ZFL861C0 -> ../../sda
lrwxrwxrwx 1 root root 10 Nov 23 17:53 ata-ST1000DM014-2UB10D_ZFL861C0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Nov 23 17:53 ata-ST1000DM014-2UB10D_ZFL861C0-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Nov 23 17:53 ata-ST1000DM014-2UB10D_ZFL861C0-part3 -> ../../sda3
lrwxrwxrwx 1 root root 9 Nov 23 17:53 ata-ST1000DM014-2UB10D_ZFL861C9 -> ../../sdb
lrwxrwxrwx 1 root root 10 Nov 23 17:53 ata-ST1000DM014-2UB10D_ZFL861C9-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Nov 23 17:53 ata-ST1000DM014-2UB10D_ZFL861C9-part2 -> ../../sdb2
lrwxrwxrwx 1 root root 10 Nov 23 17:53 ata-ST1000DM014-2UB10D_ZFL861C9-part3 -> ../../sdb3
lrwxrwxrwx 1 root root 9 Nov 23 17:53 ata-WDC_WD1003FBYX-01Y7B1_WD-WCAW33260201 -> ../../sdc
lrwxrwxrwx 1 root root 13 Nov 23 17:53 lvm-pv-uuid-0JCcgj-PgmW-XcgJ-hmlV-5Kor-Yayy-Kp9gEJ -> ../../zd240p2
lrwxrwxrwx 1 root root 9 Nov 23 17:53 wwn-0x5000c500e926dd50 -> ../../sda
lrwxrwxrwx 1 root root 10 Nov 23 17:53 wwn-0x5000c500e926dd50-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Nov 23 17:53 wwn-0x5000c500e926dd50-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Nov 23 17:53 wwn-0x5000c500e926dd50-part3 -> ../../sda3
lrwxrwxrwx 1 root root 9 Nov 23 17:53 wwn-0x5000c500e926df1c -> ../../sdb
lrwxrwxrwx 1 root root 10 Nov 23 17:53 wwn-0x5000c500e926df1c-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Nov 23 17:53 wwn-0x5000c500e926df1c-part2 -> ../../sdb2
lrwxrwxrwx 1 root root 10 Nov 23 17:53 wwn-0x5000c500e926df1c-part3 -> ../../sdb3
lrwxrwxrwx 1 root root 9 Nov 23 17:53 wwn-0x50014ee601de69c6 -> ../../sdc
這是新硬碟:
ata-WDC_WD1003FBYX-01Y7B1_WD-WCAW33260201
root@pve7:~# zpool status rpool
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: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-4J
scan: scrub repaired 0B in 01:24:46 with 0 errors on Sun Nov 9 01:48:47 2025
config:
NAME STATE READ WRITE CKSUM
rpool DEGRADED 0 0 0
raidz1-0 DEGRADED 0 0 0
ata-ST1000DM014-2UB10D_ZFL861C0-part3 ONLINE 0 0 0
ata-ST1000DM014-2UB10D_ZFL861C9-part3 ONLINE 0 0 0
4816738775992479170 UNAVAIL 0 0 0 was /dev/disk/by-id/ata-ST1000DM014-2UB10D_ZFL8619T-part3
errors: No known data errors
# 換上新硬碟的編號:
# ata-WDC_WD1003FBYX-01Y7B1_WD-WCAW33260201
命令是:
zpool replace rpool [舊硬碟編號] [新硬碟編號]
root@pve7:~# zpool replace rpool 4816738775992479170 ata-WDC_WD1003FBYX-01Y7B1_WD-WCAW33260201
確定是否重建中
root@pve7:~# zpool status rpool
pool: rpool
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 Sun Nov 23 17:35:59 2025
985G / 1.96T scanned at 2.29G/s, 41.2G / 1.94T issued at 98.0M/s
13.0G resilvered, 2.07% done, 05:38:49 to go
config:
NAME STATE READ WRITE CKSUM
rpool DEGRADED 0 0 0
raidz1-0 DEGRADED 0 0 0
ata-ST1000DM014-2UB10D_ZFL861C0-part3 ONLINE 0 0 0
ata-ST1000DM014-2UB10D_ZFL861C9-part3 ONLINE 0 0 0
replacing-2 DEGRADED 0 0 11
4816738775992479170 UNAVAIL 0 0 0 was /dev/disk/by-id/ata-ST1000DM014-2UB10D_ZFL8619T-part3
ata-WDC_WD1003FBYX-01Y7B1_WD-WCAW33260201 ONLINE 0 0 0 (resilvering)
errors: No known data errors
查看前目同步的狀況
root@pve7:~# zpool iostat -v rpool
capacity operations bandwidth
pool alloc free read write read write
--------------------------------------------- ----- ----- ----- ----- ----- -----
rpool 1.96T 777G 2.49K 848 75.6M 37.1M
raidz1-0 1.96T 777G 2.49K 848 75.6M 37.1M
ata-ST1000DM014-2UB10D_ZFL861C0-part3 - - 1.23K 18 37.8M 280K
ata-ST1000DM014-2UB10D_ZFL861C9-part3 - - 1.26K 18 37.8M 280K
replacing-2 - - 0 1.64K 3.25K 63.7M
5318363749333837818 - - 0 0 0 0
ata-WDC_WD1003FBYX-01Y7B1_WD-WCAW33260201 - - 0 1.64K 3.25K 63.7M
--------------------------------------------- ----- ----- ----- ----- ----- -----
(Resilvering 重建完成後)
root@pve7:~# zpool status rpool
pool: rpool
state: ONLINE
scan: resilvered 631G in 02:50:55 with 0 errors on Mon Nov 23 20:26:54 2025
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
ata-ST1000DM014-2UB10D_ZFL861C0-part3 ONLINE 0 0 0
ata-ST1000DM014-2UB10D_ZFL861C9-part3 ONLINE 0 0 0
ata-WDC_WD1003FBYX-01Y7B1_WD-WCAW33260201 ONLINE 0 0 0
errors: No known data errors
1T的新硬碟,花費 2小時50分 修復完畢
root@pve7:~# zpool iostat -v
capacity operations bandwidth
pool alloc free read write read write
--------------------------------------------- ----- ----- ----- ----- ----- -----
rpool 1.95T 787G 1.33K 450 40.5M 20.0M
raidz1-0 1.95T 787G 1.33K 450 40.5M 20.0M
ata-ST1000DM014-2UB10D_ZFL861C0-part3 - - 670 12 20.2M 172K
ata-ST1000DM014-2UB10D_ZFL861C9-part3 - - 696 12 20.2M 172K
ata-WDC_WD1003FBYX-01Y7B1_WD-WCAW33260201 - - 0 427 1017 19.8M
--------------------------------------------- ----- ----- ----- ----- ----- -----
Bandwidth 欄位含義
read/write 數值:顯示 "自 zpool 建立" 以來(或上次統計重置以來)的平均讀寫吞吐量
----------
每秒更新一次,顯示當下的速度
$ zpool iostat -v 1
root@pve7:~# zpool iostat -v 1
capacity operations bandwidth
pool alloc free read write read write
--------------------------------------------- ----- ----- ----- ----- ----- -----
rpool 2.28T 449G 89 80 3.96M 2.61M
raidz1-0 2.28T 449G 89 80 3.96M 2.61M
ata-ST1000DM014-2UB10D_ZFL861C0-part3 - - 43 19 1.69M 524K
ata-ST1000DM014-2UB10D_ZFL861C9-part3 - - 42 19 1.70M 523K
ata-WDC_WD1003FBYX-01Y7B1_WD-WCAW33260201 - - 4 42 592K 1.58M
--------------------------------------------- ----- ----- ----- ----- ----- -----
**註 上面第一筆資料,指從換完硬碟同步後 到現在的平均資料
** 如 第三顆硬碟 write=1.58M 指同步後 到現在的加總後平均值
capacity operations bandwidth
pool alloc free read write read write
--------------------------------------------- ----- ----- ----- ----- ----- -----
rpool 2.18T 449G 536 212 98.0M 3.40M
raidz1-0 2.18T 449G 536 212 98.0M 3.40M
ata-ST1000DM014-2UB10D_ZFL861C0-part3 - - 175 73 33.2M 1.14M
ata-ST1000DM014-2UB10D_ZFL861C9-part3 - - 178 69 32.2M 1.11M
ata-WDC_WD1003FBYX-01Y7B1_WD-WCAW33260201 - - 181 68 32.5M 1.14M
--------------------------------------------- ----- ----- ----- ----- ----- -----
capacity operations bandwidth
pool alloc free read write read write
--------------------------------------------- ----- ----- ----- ----- ----- -----
rpool 2.28T 449G 745 0 90.5M 0
raidz1-0 2.28T 449G 745 0 90.5M 0
ata-ST1000DM014-2UB10D_ZFL861C0-part3 - - 257 0 33.0M 0
ata-ST1000DM014-2UB10D_ZFL861C9-part3 - - 255 0 32.5M 0
ata-WDC_WD1003FBYX-01Y7B1_WD-WCAW33260201 - - 231 0 25.1M 0
--------------------------------------------- ----- ----- ----- ----- ----- -----
capacity operations bandwidth
pool alloc free read write read write
--------------------------------------------- ----- ----- ----- ----- ----- -----
rpool 2.28T 449G 471 14 52.6M 783K
raidz1-0 2.28T 449G 471 14 52.6M 783K
ata-ST1000DM014-2UB10D_ZFL861C0-part3 - - 142 4 14.0M 264K
ata-ST1000DM014-2UB10D_ZFL861C9-part3 - - 130 4 15.2M 260K
ata-WDC_WD1003FBYX-01Y7B1_WD-WCAW33260201 - - 197 4 23.4M 260K
--------------------------------------------- ----- ----- ----- ----- ----- -----
分類:Proxmox VE
92
留言
相關文章