Wednesday, March 28, 2018

Replacement Disk Raid1 Proxmox

Check disk raid error

root@pv1:~# zpool status -v
  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: http://zfsonlinux.org/msg/ZFS-8000-4J
  scan: resilvered 360G in 6h3m with 0 errors on Wed Mar 28 17:18:04 2018
config:

        NAME                      STATE     READ WRITE CKSUM
        rpool                     DEGRADED     0     0     0
          mirror-0                DEGRADED     0     0     0
            sdb2                  ONLINE       0     0     0

            14808991325071265949  UNAVAIL      0     0     0  was /dev/sda2


Check new disk mapping ls /dev/sd*

 Where is new location path?
 I've found in /dev/sda

 Copy partition of new disk from healthy disk.

# Use these variables to make sure you have this the right way around newDisk='/dev/sda' healthyDisk='/dev/sdb' sgdisk -R "$newDisk" "$healthyDisk" sgdisk -G "$newDisk


or

root@pve:~# sgdisk --replicate=/dev/sda /dev/sdb
then sgdisk --randomize-guids /dev/sda


 Copy boot partition
# Use these variables to make sure you have this the right way around newDiskBootPartition='/dev/sda1' healthyDiskBootPartition='/dev/sdb1' dd if="$healthyDiskBootPartition" of="$newDiskBootPartition" bs=512


or


grub-install /dev/sda


Now we are going to add the new disk to the zpool and replace the failed one

newDiskZFSPartition='/dev/sda2`
#Put your failed disk ID here - as reported in `zpool status -v` - eg 14456048953908038050 failedDiskPartitionID='' zpool replace rpool "$failedDiskPartitionID" "$newDiskZFSPartition"


or
zpool replace rpool /dev/sda2

Make sure to wait until resilver is done before rebooting.

root@pv1:~# zpool status -v
  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: http://zfsonlinux.org/msg/ZFS-8000-9P
  scan: resilvered 360G in 6h3m with 0 errors on Wed Mar 28 17:18:04 2018
config:

        NAME        STATE     READ WRITE CKSUM
        rpool       ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            sda2    ONLINE       0     0 4.55K
            sdb2    ONLINE       0     0     0

errors: No known data errors
 After Reboot, result

root@pv1:~# zpool status -v
  pool: rpool
 state: ONLINE
  scan: resilvered 360G in 6h3m with 0 errors on Wed Mar 28 17:18:04 2018
config:

        NAME        STATE     READ WRITE CKSUM
        rpool       ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            sda2    ONLINE       0     0     0
            sdb2    ONLINE       0     0     0

errors: No known data errors

Hopefully these steps usefull

No comments:

Post a Comment