Re: ZFS replace a mirrored disk
- Reply: Christos Chatzaras : "Re: ZFS replace a mirrored disk"
- In reply to: Christos Chatzaras : "Re: ZFS replace a mirrored disk"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 12 May 2022 00:06:58 UTC
On 5/11/22 03:22, Christos Chatzaras wrote: > When a disk fails and want to replace it with a NEW disk ... > On 5/11/22 05:14, Julien Cigar wrote: >> please paste output of: >> >> $> gpart show nvd1 >> >> also, is it an UEFI system or classicla BIOS with GPT? What FreeBSD >> version? > It's legacy BIOS with GPT. Please post: $ freebsd-version ; uname -a > $> gpart show > => 40 7501476448 nvd0 GPT (3.5T) > 40 1024 1 freebsd-boot (512K) > 1064 984 - free - (492K) > 2048 33554432 2 freebsd-swap (16G) > 33556480 7467919360 3 freebsd-zfs (3.5T) > 7501475840 648 - free - (324K) > > => 40 7501476448 nvd1 GPT (3.5T) > 40 1024 1 freebsd-boot (512K) > 1064 984 - free - (492K) > 2048 33554432 2 freebsd-swap (16G) > 33556480 7467919360 3 freebsd-zfs (3.5T) > 7501475840 648 - free - (324K) > > > $> zpool status > pool: zroot > state: ONLINE > config: > > NAME STATE READ WRITE CKSUM > zroot ONLINE 0 0 0 > mirror-0 ONLINE 0 0 0 > nvd0p3 ONLINE 0 0 0 > nvd1p3 ONLINE 0 0 0 > > errors: No known data errors Thank you for posting facts. So, your OS is on two 4 TB NVMe drives with ZFS mirror boot, geom(8) mirror swap, and ZFS mirror root (?). Was this arrangement created by the FreeBSD installer? > Then I boot with mfsBSD and run this command to "simulate" a disk failure: > > $> gpart destroy -F nvd0 > Then I backup / restore the partitions: > > $> gpart backup nvd1 | gpart restore -F nvd0 Your "disk fails" simulation destroys (zeros?) the partition table on drive /dev/nvd0, but leaves the rest of the disk contents intact; including ZFS metadata, swap metadata, and data. Also, drive permanent metadata is unchanged. (Does ZFS use drive metadata?) Your "replace it with a NEW disk" simulation dumps the partition table of nvd1 and restores it onto nvd0. AIUI the net result is the same as re-imaging nvd0 from a pre-failure image. I assume ZFS and geom are designed to detect and recover from this condition, so it just works. If you do not have another 4 TB drive to play with, I would zero-fill or secure erase nvd0 to simulate "disk fails". Figuring out how to recover from that is a better simulation of "When a disk fails and want to replace it with a NEW disk". David