project-machine / disko

Disk Operations API in Go
Apache License 2.0
13 stars 9 forks source link

Wipe luks2 headers after lvcreate #119

Closed smoser closed 2 years ago

smoser commented 2 years ago

Wipe luks2 headers after lvcreate.

Versions of libblkid, before 2.33 would not completely wipe luks 2 headers. After we create a thick LV, wipe any remaining headers ourselves.

This should not be that big of a problem, but when it was mixed with a liberal running of 'cryptsetup luksUUID' after LV creation things went awry. cryptsetup will automatically repair a broken header that it finds, and it would find such a header because lvm did not completely wipe it. To be clear, 'cryptsetup luksUUID' is not a read-only operation.

Also complicating things was the fact that we were creating luks 2 volumes and then running with an old LVM.

2 other changes snuck in here:

codecov[bot] commented 2 years ago

Codecov Report

Merging #119 (40dd47d) into master (3e70197) will decrease coverage by 0.27%. The diff coverage is 46.42%.

@@            Coverage Diff             @@
##           master     #119      +/-   ##
==========================================
- Coverage   67.32%   67.05%   -0.28%     
==========================================
  Files          16       16              
  Lines        2118     2146      +28     
==========================================
+ Hits         1426     1439      +13     
- Misses        505      513       +8     
- Partials      187      194       +7     
Impacted Files Coverage Δ
linux/lvm.go 61.18% <46.42%> (-1.50%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3e70197...40dd47d. Read the comment docs.