Identifying Corrupted Replicas
In the case that one of the disks used by Longhorn went bad, you might experience intermittent input/output errors when using a Longhorn volume.
For example, one file sometimes cannot be read, but later it can. In this scenario, it’s likely one of the disks went bad, resulting in one of the replicas returning incorrect data to the user.
To recover the volume, we can identify the corrupted replica and remove it from the volume:
Scale down the workload to detach the volume.
Find all the replicas’ locations by checking the Longhorn UI. The directories used by the replicas will be shown as a tooltip for each replica in the UI.
Log in to each node that contains a replica of the volume and get to the directory that contains the replica data.
For example, the replica might be stored at:
Run a checksum for every file under that directory.
# sha512sum /var/lib/longhorn/replicas/pvc-06b4a8a8-b51d-42c6-a8cc-d8c8d6bc65bc-d890efb2/*
Compare the output of each replica. One of them should fail or have different results compared to the others. This will be the one replica we need to remove from the volume.
Use the Longhorn UI to remove the identified replica from the volume.
Scale up the workload to make sure the error is gone.
© 2019-2020 Longhorn Authors | Documentation Distributed under CC-BY-4.0
© 2020 The Linux Foundation. All rights reserved. The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.