[SOLVED] An Help with wrong partitioning after replacing ZFS drive

silvered.dragon

Renowned Member
Nov 4, 2015
125
5
83
Dear all,
Can someone help me to fix my partition table? it looks like the attached one now, you will notice the difference in /dev/sdb that is the replaced disk missing the BIOS and EFI partitions. I didn't followed the right instructions provided here https://pve.proxmox.com/wiki/ZFS_on_Linux#sysadmin_zfs_change_failed_dev when I replaced the disk so now I'm stucked in this way.

I tried to fix stuffs but I cannot figure it out and the pool looks degraded now


Bash:
root@node6:~# zpool status
  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 1.48G in 00:00:42 with 0 errors on Tue Dec 31 13:04:13 2024
config:

        NAME                                     STATE     READ WRITE CKSUM
        rpool                                    ONLINE       0     0     0
          raidz2-0                               ONLINE       0     0     0
            ata-TOSHIBA_HDWD130_988YYD3AS-part3  ONLINE       0     0     0
            ata-ST4000NT001-3JC101_WX10SCWQ      ONLINE       0     0     2
            ata-TOSHIBA_HDWD130_988Z646AS-part3  ONLINE       0     0     0
            ata-TOSHIBA_HDWD130_988Z671AS-part3  ONLINE       0     0     0
            ata-TOSHIBA_HDWD130_988Z2S3AS-part3  ONLINE       0     0     0
            ata-TOSHIBA_HDWD130_92FGENLAS-part3  ONLINE       0     0     0

errors: No known data errors

please if someone can provide to me how to start again from scratch.

many thank
 

Attachments

  • Immagine 2025-01-02 093813.png
    Immagine 2025-01-02 093813.png
    73.9 KB · Views: 1
Last edited:
So this time chatgpt helped me a lot, the steps for fixing this were

First we destroy the partition table of the disk
Bash:
sgdisk --zap-all /dev/sdb
we need to reboot to get the new partition table, after this the zpool status will report the disk as 10387678568864950468
Bash:
reboot
we copy the partition table from one good disk /dev/sda to the bad one
Bash:
sgdisk -R /dev/sdb /dev/sda
we create a new GUID for the disk
Bash:
sgdisk -G /dev/sdb
we format the EFI partition
Bash:
mkfs.vfat -F32 /dev/sdb2
we need to get the id of the disk
Bash:
gdisk -l /dev/sdb
we replace the zapped disk with the id of the replaced disk
Bash:
zpool replace -f rpool 10387678568864950468 /dev/disk/by-id/ata-ST4000NT001-3JC101_WX10SCWQ-part3
you will see now correct partitions and disk that is resilvering.

we need also to make the disk bootable after resilvering is complete

reinstall systemd to make the disk bootable
Bash:
proxmox-boot-tool format /dev/sdb2 --force
proxmox-boot-tool init /dev/sdb2
check that everything is ok
Bash:
proxmox-boot-tool status

normaly I suppose I just need to follow the instructions provided here https://pve.proxmox.com/wiki/ZFS_on_Linux#sysadmin_zfs_change_failed_dev but this way I fixed everything.
 
Last edited:
  • Like
Reactions: Kingneutron