I want to occasionally attach a fast external drive to my pi5, export it over nfs, then mount it from my other pis to do incremental backups to image files.
The building blocks all seems to work, at least the drive automounts on the pi5, it can be manually mounted over nfs on the other pi (a zero 2 w), and I can see and read and write files to it from there, remotely. The problem is that the backup script on the other pi must be run under sudo, and when I do so it can't see the backup image. This can be demonstrated in the easiest possible way - I can't even "ls" the file under sudo. See below, once as myself, then under sudo:
I can't remember a case where something that works for a regular user fails under sudo (outside of path differences).
The building blocks all seems to work, at least the drive automounts on the pi5, it can be manually mounted over nfs on the other pi (a zero 2 w), and I can see and read and write files to it from there, remotely. The problem is that the backup script on the other pi must be run under sudo, and when I do so it can't see the backup image. This can be demonstrated in the easiest possible way - I can't even "ls" the file under sudo. See below, once as myself, then under sudo:
Code:
pi@piz2:/mnt/backup $ ls -al /mnt/backup/piz2-bookworm32.img-rw------- 1 pi pi 9617616896 Oct 19 15:54 /mnt/backup/piz2-bookworm32.imgpi@piz2:/mnt/backup $ sudo ls -al /mnt/backup/piz2-bookworm32.imgls: cannot access '/mnt/backup/piz2-bookworm32.img': Permission denied
Statistics: Posted by tinker2much — Wed Jan 01, 2025 4:32 pm — Replies 3 — Views 76