You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
1.1 KiB

  1. #!/bin/sh
  2. # Copyright (C) 2019 Harrie Rooijackers
  3. # The make proecess copies this file to the /lib/preinit/80_lvm2
  4. # As a result it is executed just before 80_mount_root and makes lvm
  5. # entities available during the mount_root process that handles any
  6. # overlays. This allows overlays to be lvm2 partitions.
  7. # Note that /lib/preinit/80_lvm2 needs to be on the initial "lower"
  8. # partition for this to work.
  9. do_startlvm() {
  10. echo "Starting lvm2 during preinit" > /dev/kmsg
  11. # The following 3 lines are copied from from the start function
  12. # in /etc/rc.d/S15lvm2 which is copyright by Stefan Monnier
  13. mkdir -p /tmp/lvm/cache
  14. /sbin/lvm vgscan --ignorelockingfailure --mknodes > /dev/kmsg || :
  15. /sbin/lvm vgchange -aly --ignorelockingfailure > /dev/kmsg || return 2
  16. }
  17. # Perform the function only if lvm2 is enabled by the user
  18. # Not sure if the test is that useful since it tests the existance
  19. # of /etc/rc.d/S15lvm2 on the initial "lower" partition only so
  20. # changes made after the overlay is created are not taken into account
  21. [ -f /etc/rc.d/S15lvm2 ] && boot_hook_add preinit_main do_startlvm