Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Also useful: "mountpoint" can tell you if a path is mounted.

https://linux.die.net/man/1/mountpoint

E.g.

  mountpoint -q /mnt/backup || exit 1


What if it gets unmounted right after the mountpoint call :)


What if it gets mounted just before you run chattr +i :)

I agree setting the flag is the superior option.


You miss the point of making a directory immutable which doubles as a mountpoint.

Mounting something just creates a new filsystem namespace over a path. It doesn't touch the existing directory.

So you can safely leave the directory in question immutable, you never remove the flag, and it will only prevent writes to the directory when it is not overlaid by a mount.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: