Mount encrypted drives for use with snapraid/mergerfs after boot.
Find a file
James Coleman be8f6ecf55 fix(mount): wait for helper mounts to appear before verifying
- bindfs and other FUSE helpers return before their mount is visible in /proc/mounts, so the single post-mount check raced them and aborted with "unable to mount" even though the mount succeeded, leaving configured services unstarted.
- Post-mount verification now polls the mount table for up to 2 seconds before declaring failure.
- Mount table entries are matched against both the symlink-resolved and literal target, so a target whose path cannot be resolved still matches a live mount instead of being mounted a second time.
- Octal escapes in /proc/mounts are decoded, so mountpoints containing spaces are recognized as mounted.
- Failure to read /proc/mounts is returned as an error and closes any LUKS volume opened for that entry, instead of exiting the process mid-run from a mount goroutine.
2026-10-16 13:42:44 -05:00
.gitignore First commit 2021-11-28 09:43:26 -06:00
config.example.json First commit 2021-11-28 09:43:26 -06:00
config.go Improve goroutine safety, error handling, and correctness 2026-02-20 12:47:02 -06:00
flags.go Improve goroutine safety, error handling, and correctness 2026-02-20 12:47:02 -06:00
go.mod First commit 2021-11-28 09:43:26 -06:00
go.sum First commit 2021-11-28 09:43:26 -06:00
License.txt First commit 2021-11-28 09:43:26 -06:00
main.go fix(mount): wait for helper mounts to appear before verifying 2026-10-16 13:42:44 -05:00
raidtab.example Improve goroutine safety, error handling, and correctness 2026-02-20 12:47:02 -06:00
README.md First commit 2021-11-28 09:43:26 -06:00

Raid Mount

This tool was designed to make it easy to mount encrypted hard drives for a snapraid/mergerfs configuration after a boot of a system. This allows your boot drive to be unencrypted so it can boot without intervention, which you can then finish the boot process via ssh remotely to mount encrypted drives and start services that use them. This does not fully protect your system against physical attack, but it is a compromise I am willing to work with on my system to allow me to finish a boot process if I were to be unable to access the system physically.

Raid Mountpoint Table Format

The format of the raidtab file is similar to the fstab format, but instead of having dump/pass options, there is a CryptName option to specify the name of the device once unencrypted. The CryptName field must be unique per each encrypted drive, and cannot match any existing /dev/mapper/ device name. If the CryptName is none, raid-mount will treat it as an unencrypted mount. There is an example file provided to make this concept easier to understand.

Raid Mount Configuration

Simply create a directory as /etc/raid-mount/ and place a config.json and raidtab file within this directory. Configuration options for config.json can be viewed in the config.go file and the config.example.json file.