Skip to content

Instantly share code, notes, and snippets.

@jdmedeiros
Created March 22, 2024 23:34
Show Gist options
  • Save jdmedeiros/e40d09c5649d9c4b7888d4e808bd0cb7 to your computer and use it in GitHub Desktop.
Save jdmedeiros/e40d09c5649d9c4b7888d4e808bd0cb7 to your computer and use it in GitHub Desktop.
Open-Mount and Unmount-Close LVM LUKS RAID6 Volume
[Unit]
Description=Open-Mount and Unmount-Close LVM LUKS RAID6 Volume
After=local-fs-pre.targe
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=-/bin/mkdir -p /mnt/raid6LVM
ExecStartPre=-/bin/umount /mnt/raid6LVM
ExecStart=/usr/lib/systemd/systemd-cryptsetup attach lv1_crypt /dev/vg1/lv1
ExecStart=/bin/mount /dev/mapper/lv1_crypt /mnt/raid6LVM
ExecStop=/bin/umount /mnt/raid6LVM
ExecStopPost=-/usr/lib/systemd/systemd-cryptsetup detach lv1_crypt
# Omitting [Install] section to keep the service manual-start only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment