restic version
:
restic 0.17.3 compiled with go1.23.3 on darwin/arm64
On MacOS 13.6.3, restic installed via homebrew
I run a brief restic script via MacOS launchd services every hour (the plist is at bottom, if it’s relevant). The script is simple:
/Users/hgv/.local/scripts/backup-restic.sh:
#!/usr/bin/env bash
if [[ -d /Volumes/vqz-restic ]]; then
restic --password-command="security find-generic-password -a hgv -s restic.vqz-restic -w /Users/hgv/Library/Keychains/login.keychain-db" --verbose -r /Volumes/vqz-restic backup /Users/hgv --exclude=/Users/hgv/Library/CloudStorage/Dropbox/online-only --exclude="/Users/hgv/Library/CloudStorage/Dropbox/Camera Uploads"
restic --password-command="security find-generic-password -a hgv -s restic.vqz-restic -w /Users/hgv/Library/Keychains/login.keychain-db" --verbose -r /Volumes/vqz-restic forget --keep-hourly 12 --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --keep-yearly unlimited
fi
This will work for a couple of days. But eventually I always receive the following error.
Fatal: unable to open repository at /Volumes/vqz-restic: ReadDir: Readdir: lstat /Volumes/vqz-restic/keys/08b02545cde79ea4b16f385d94d721ed3640a5ce9a70e82c8b4f4048e2f3c901: input/output error
Once I unmount and physically disconnect the drive and then reconnect and remount it, the script runs fine again.
I don’t think this is a restic issue necessarily. Instead, I think it’s something about keeping my external drive attached and regularly backing up to it. I had similar issues with TimeMachine, which prompted me to switch to restic. But maybe someone in the community has an idea. I’ve been able to avoid this error if I shut down the computer every evening; but I’d rather not do that. I’ve tried unmounting the drive after running the script (and then mounting before running it) but that didn’t work.
Any ideas from the community are appreciated.
hgv.restic-bak.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/opt/homebrew/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin</string>
</dict>
<key>Label</key>
<string>hgv.restic-bak</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/fdautil</string>
<string>exec</string>
<string>/Users/hgv/.local/scripts/backup-restic.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/launchd/restic-bak-launchd.log</string>
<key>StandardOutPath</key>
<string>/tmp/launchd/restic-bak-launchd.log</string>
<key>StartCalendarInterval</key>
<dict>
<key>Minute</key>
<integer>0</integer>
</dict>
</dict>
</plist>