I'm not sure if this will make sense but I'm having a problem.

I have an external hard disk drive that I'm using for my torrent files. It is mounted using fstab.

Now here's a problem, some times maybe because of power interruptions, my HDD is unmounted and (rarely) failed to remount. When this failure of remount happens, the torrent downloads are continued on the mount point (example: /home/user/Downloads).

My question is, is there a way to make /home/user/Downloads as read-only and then make it write-able only if the HDD is mounted?

Or any other better solutions are most welcome.

4 Answers 4


You could make /home/user/Downloads be a link to a directory deeper in on the mount, which is mounted elsewhere. That would probably cause the torrent download to fail.

E.g., if the target directory is /user/Downloads on the HDD, which is mounted on /HDD, then /home/user/Downloads should be a link to /HDD/user/Downloads, and that directory certainly doesn't exist unless the HDD is mounted.

  • Thanks! I think I got your idea but I'm not sure how to link... I can change the fstab to mount the HDD somewhere and link it to /home/user/Downloads. But how do I link it? and would the link be permanent? Nov 22, 2016 at 3:25
  • link is done with a command: ln -sTf /HDD/user/Downloads /home/user/Downloads but there shouldn't be a /home/user/Downloads beforehand. The link stays there, but is called "a broken link" when the HDD is not mounted. Nov 22, 2016 at 3:34
  • thanks I got it... one question though, not yet mounted, if I do mkdir /home/user/Downloads/test it fails, which I'm inspected it to. But if I add a sudo I'm kind of surprise it works. Is this ok? But maybe not a problem because my torrent is not run by root.. Nov 22, 2016 at 3:51

When you are mounting a drive, the mount point's permissions are changed by permissions of device's root directory.

So yes, you could be able to change permissions on your mount point /home/user/Downloads so your user won't be able to access it. Then, after mounting your external drive you will need to adjust permissions of root directory of your drive (again accessible as /home/user/Downloads after mounting it).

From now on, empty mount point won't be readable by application run as unprivileged user.


Read man mountpoint.

mountpoint /home/user/Downloads

will exit with a status of 0 if it's a mountpoint (something is mounted there), or 32 if not. The exit status is available in the $? environment variable immediately after command execution.


Simply change the underlying directory on which the mount point is created to have its immutable flag set before you mount onto it.

chattr +i /mntpoint
  • If a filesystem is un-expectantly unmounted, it is likely to have errors. So it should only be remounted as read-only and never as read-write, at least not until it has been fsck'd - such as would occur automatically during a reboot. Jan 12, 2022 at 1:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .