lvm2_hook 585 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/ash
  2. run_earlyhook() {
  3. mkdir /run/lvm
  4. lvmetad
  5. }
  6. # We are suffering a race condition in non-systemd initramfs: If lvmetad is
  7. # killed before pvscan processes finish we have stale processes and
  8. # uninitialized physical volumes. So wait for pvscan processes to finish.
  9. # Break after 10 seconds (50*0.2s) to avaid infinite loop.
  10. run_latehook() {
  11. local i=50
  12. while pgrep -f pvscan >/dev/null 2>/dev/null && [ $i -gt 0 ]; do
  13. sleep 0.2
  14. i=$((i - 1))
  15. done
  16. }
  17. run_cleanuphook() {
  18. kill $(cat /run/lvmetad.pid)
  19. }
  20. # vim: set ft=sh ts=4 sw=4 et: