I have to replace 1 of the 2 NVME disk which compose the ZFS RAID1 on my server. How should I recreate the array?
Thanks, I'll try. What abouttry
sgdisk --replicate=/dev/sdb /dev/sda
the size must be the same.
/boot
? Do I have to take care of it in some way?Thanks. What If the damaged drive is the bootable one and old one doesn't work anymore?Please see the official documentation.
sgdisk <healthy bootable device> -R <new device>
sgdisk -G <new device>
zpool replace -f <pool> <old zfs partition> <new zfs partition>
I'm using nvme (such asfor zfs raid boot device the coplet sequence :
Replace the physical failed/offline drive i.e. /dev/sdc with new i.e. /dev/sda
wipefs --all --force /dev/sda* (clean operation)
sgdisk --replicate=/dev/sdb /dev/sda (replicate operation)
grub-install /dev/sdc (only if bootable)
zpool replace mypool /dev/sdc /dev/sda
zpool scrub
nvme0n1
and nvme1n1
) and the drive I already replaced was the nvme0n1
. How can I run this?zpool replace mypool /dev/sdc /dev/sda
Thanks, but my question is what should I replace /dev/sdc with since the old faulty disk is no longer installed.you have to change /dev/sdc and /dev/sda with your drives. Find the exact path of you drive. The /dev/sdc and /dev/sda are only an exaples.
root@srv1:~# zpool status -v
pool: rpool
state: ONLINE
scan: resilvered 1.33G in 00:00:02 with 0 errors on Fri Jul 14 16:15:48 2023
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
nvme-eui.34333730526111070025384300000001-part3 ONLINE 0 0 0
errors: No known data errors
root@srv1:~# lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT
NAME FSTYPE SIZE MOUNTPOINT
sr0 1024M
nvme0n1 894.3G
nvme1n1 zfs_member 894.3G
├─nvme1n1p1 1007K
├─nvme1n1p2 vfat 1G
└─nvme1n1p3 zfs_member 893.3G
nvme0n1
to the rpool and recover the mirror.How should I create a new mirror preserving the existing disk?seem that right now you do not have a mirror.
You have to create a mirror from existing drive
prepare the new disk! And then something like
sudo zpool attach YourPool /path/to/your/existingdisk /path/to/your/newdisk
Like already told, first clone the partition table from nvme1n1 to nvme0n1, then sync the bootloader from nvme1n1p2 to nvme0n1p2 and then use the zpool attach command to add nvme0n1p3 to your existing pool so you get a mirror again.How should I create a new mirror preserving the existing disk?