부트디스크 S.M.A.R.T 에러 검출
어느 날, 메일함에 친절하게 섬뜩한 메일이 날아옵니다.


Proxmox – 개별 node – Disks – Show S.M.A.R.T values로 S.M.A.R.T 정보를 보면

보류중인 섹터(Current_Pending_Sector)와 오프라인 수정 불가 값(Offline_Uncorrectable)이 증가 되어있습니다.
해당 값들은 아직 배드섹터가 생겼음을 알려주는 지표는 아니지만, 조만간 디스크 상태가 안 좋아질 수 있음을 알 수 있게 해주는 정도의 지표들입니다.
불량디스크 찾기
제 boot-pool은 500기가 하드디스크 2장을 raid1(ZFS)로 구성되어 있습니다.
이 중, 상태가 안 좋은 하드디스크 이름을 찾습니다.

메일 알람내용을 보면 /dev/sdag인 것을 알 수 있습니다.
동일한 WD Blue 500GB를 두 장 사용하고 있기 때문에 시리얼도 확보를 해 놓습니다.

이후 서버의 전원을 내리고
새로 가져온(이라고 쓰고 중고라고 읽는) 500기가 하드를 끼워넣고 다시 부팅해줍니다.

정리하면,
교체당해야 할 디스크는 sdag, 새로 투입될 디스크는 sdah입니다.
부트디스크 파티션 복사
Proxmox의 부팅디스크 파티션은 아래와 같이 구성되어 있습니다.
- BIOS
- EFI
- ZFS
기존 사용중이던 디스크의 파티션 정보를 그대로 옮겨주기 위해 쉘에 아래와 같이 입력합니다.
sgdisk /dev/sdag -R /dev/sdah
sgdisk -G /dev/sdah
sgdisk -R 옵션으로 파티션 정보를 복제하고
sgdisk -G 옵션으로 GUID를 랜덤으로 변경하여 다른 디스크임을 알 수 있게 해주는 과정입니다.
부트디스크 교체
zpool status -v rpool
pool: rpool
state: ONLINE
status: Some supported and requested features are not enabled on the pool.
The pool can still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(7) for details.
scan: scrub repaired 1M in 00:19:12 with 0 errors on Sun Jan 14 00:43:15 2024
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
ata-WDC_WD5000AAKX-001CA0_WD-WMAYUC792798-part3 ONLINE 0 0 0
ata-WDC_WD5000AAKS-75V0A0_WD-WCAWF6419321-part3 ONLINE 0 0 0
boot-pool을 구성하는 디스크는 disk-id로 구성되어 있기 때문에, id를 따와야 합니다.
아래 명령어를 복붙합니다.
lsblk |awk 'NR==1{print $0" DEVICE-ID(S)"}NR>1{dev=$1;printf $0" ";system("find /dev/disk/by-id -lname \\"*"dev"\\" -printf \\" %p\\"");print "";}'|grep -v -E 'part|lvm'
그러면 이런식으로 결과를 얻을 수 있습니다.
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS DEVICE-ID(S)
sdae 65:224 0 3.6T 0 disk /dev/disk/by-id/wwn-0x5000c50078dd7cd8 /dev/disk/by-id/ata-ST4000DM000-1F2168_Z30232CD
sdaf 65:240 0 3.6T 0 disk /dev/disk/by-id/ata-ST4000DM000-1F2168_Z3030KNV /dev/disk/by-id/wwn-0x5000c5007a2bca6e
sdag 66:0 1 465.8G 0 disk /dev/disk/by-id/wwn-0x50014ee1583ca345 /dev/disk/by-id/ata-WDC_WD5000AAKS-75V0A0_WD-WCAWF6419321
sdah 66:16 1 465.8G 0 disk /dev/disk/by-id/ata-SAMSUNG_HD502HJ_S28NJ9AB101185 /dev/disk/by-id/wwn-0x50024e92043ea00d
sdah쪽에 보면 새로 꽃은 삼성 하드의 id를 확인할 수가 있습니다.
그 중에서, 가장 뒤쪽의 /dev/disk/by-id/wwn-0x50024e92043ea00d를 복사한 후
zpool replace -f rpool ata-WDC_WD5000AAKS-75V0A0_WD-WCAWF6419321-part3 /dev/disk/by-id/wwn-0x50024e92043ea00d-part3
이렇게 입력해줍니다.
앞의 ata-WDC_WD5000AAKS-75V0A0_WD-WCAWF6419321-part3는 불량 디스크,
뒤쪽의 /dev/disk/by-id/wwn-0x50024e92043ea00d-part3은 아까 복사해놓은 신규 디스크입니다.
불량 디스크의 id는 위에 zpool status -v rpool에서 따올 수 있습니다.
이제 다시 zpool status를 살펴 봅시다.
zpool status -v rpool
pool: rpool
state: ONLINE
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 Mon Feb 5 22:54:00 2024
75.6G / 75.6G scanned, 74.0G / 75.6G issued at 92.5M/s
74.2G resilvered, 97.96% done, 00:00:17 to go
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
ata-WDC_WD5000AAKX-001CA0_WD-WMAYUC792798-part3 ONLINE 0 0 0
replacing-1 ONLINE 2 0 0
ata-WDC_WD5000AAKS-75V0A0_WD-WCAWF6419321-part3 ONLINE 3 0 2 (resilvering)
wwn-0x50024e92043ea00d-part3 ONLINE 0 0 4 (resilvering)
이런 식으로 리실버링이 진행되는 것을 확인할 수 있습니다.
다 완료되면 아래와 같이 메일로 알람을 받을 수 있습니다.

pool: rpool
state: ONLINE
status: One or more devices has experienced an unrecoverable error. An
attempt was made to correct the error. Applications are unaffected.
action: Determine if the device needs to be replaced, and clear the errors
using 'zpool clear' or replace the device with 'zpool replace'.
see: <https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-9P>
scan: resilvered 75.8G in 00:14:20 with 0 errors on Mon Feb 5 23:08:20 2024
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
ata-WDC_WD5000AAKX-001CA0_WD-WMAYUC792798-part3 ONLINE 0 0 0
wwn-0x50024e92043ea00d-part3 ONLINE 0 0 4
요런 식으로 결과를 확인할 수 있는데, 체크섬 에러가 왜 났는지는 모르겠네요..
일단 zpool clear rpool로 날려줍니다.
부트 환경 재구성
리실버링이 완료되었다면, 아래의 명령어를 차례로 입력해 부팅 환경을 재구성해줍니다.
proxmox-boot-tool format /dev/sdah2
proxmox-boot-tool init /dev/sdah2
proxmox-boot-tool refresh
전원을 내린 후 불량 디스크를 제거하고
부팅 후 rpool의 상태를 확인합니다.
pool: rpool
state: ONLINE
status: Some supported and requested features are not enabled on the pool.
The pool can still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(7) for details.
scan: resilvered 75.8G in 00:14:20 with 0 errors on Mon Feb 5 23:08:20 2024
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
ata-WDC_WD5000AAKX-001CA0_WD-WMAYUC792798-part3 ONLINE 0 0 0
wwn-0x50024e92043ea00d-part3 ONLINE 0 0 0
errors: No known data errors
휴 이제 발 뻗고 자도 됩니다.