diff --git a/_posts/sysadm/2023-09-15-lvm-cheat-sheet.tl b/_posts/sysadm/2023-09-15-lvm-cheat-sheet.tl index cfb125d..40903ac 100644 --- a/_posts/sysadm/2023-09-15-lvm-cheat-sheet.tl +++ b/_posts/sysadm/2023-09-15-lvm-cheat-sheet.tl @@ -21,6 +21,33 @@ List currently used devices and sync status: {% endhighlight %} +h3. Fix RAID inconsistency due to hardware errors + +Run scrubbing - a full scan of RAID LV, which verifies RAID metadata, LV data and +parity blocks: + +{% highlight bash %} +# lvchange --syncaction check /dev/vgdev/backup +{% endhighlight %} + +If problems are found, this is denoted by @m@ on 9th bit of attributes displayed +by @lvs@: + +{% highlight bash %} +$ cat /tmp/lvs +LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert +backup vgdev rwi-aor-m- 4.00g 100.00 +{% endhighlight %} + +In such case repair ir required. As of LVM tools 2.03.21(2) (2023-04-21) +@lvchange --syncaction repair@ is unable to deduce which data is correct. The +only safe choice is to rebuild PV on the failed device: + +{% highlight bash %} +# lvchange --rebuild /dev/sdb1 /dev/vgdev/backup +{% endhighlight %} + + h3. Rebuild RAID1 LV with integrity layer As of LVM tools 2.03.21(2) (2023-04-21) @man lvmraid@ says: