this post was submitted on 26 Jun 2026
6 points (100.0% liked)
linux4noobs
4242 readers
2 users here now
linux4noobs
Noob Friendly, Expert Enabling
Whether you're a seasoned pro or the noobiest of noobs, you've found the right place for Linux support and information. With a dedication to supporting free and open source software, this community aims to ensure Linux fits your needs and works for you. From troubleshooting to tutorials, practical tips, news and more, all aspects of Linux are warmly welcomed. Join a community of like-minded enthusiasts and professionals driving Linux's ongoing evolution.
Seeking Support?
- Mention your Linux distro and relevant system details.
- Describe what you've tried so far.
- Share your solution even if you found it yourself.
- Do not delete your post. This allows other people to see possible solutions if they have a similar problem.
- Properly format any scripts, code, logs, or error messages.
- Be mindful to omit any sensitive information such as usernames, passwords, IP addresses, etc.
Community Rules
- Keep discussions respectful and amiable. This community is a space where individuals may freely inquire, exchange thoughts, express viewpoints, and extend help without encountering belittlement. We were all a noob at one point. Differing opinions and ideas is a normal part of discourse, but it must remain civil. Offenders will be warned and/or removed.
- Posts must be Linux oriented
- Spam or affiliate links will not be tolerated.
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Thanks, I am OK with issuing a command before physically unplugging the device. I was just finding too many uses of the word "mount" because it's a verb, a command and a noun in this situation lol. I added my fstab to the top so you can see that I am actually using a bind mount.
I investigated symlinks as an alternative and for some reason decided against them. One thing I like about bind mounts is that there is always a backup directory in the location, so if the USB isn't plugged in, accidentally saved files don't just fall into the void. But I don't remember if that was the reason.
I could write some kind of script but I thought it would make more sense to see if something had already been developed because usually in Linux, it has been.
So, if you have a symlink, what will happen is that trying to save to a path that passes through the symlink will fail, because the program trying to save will fail to access the original path (assuming your above directory structure; /mount/external will exist, but /mount/external/realfolder will not, as realfolder is on your USB drive and won't exist when the media isn't mounted). With most programs, they'll warn you that they couldn't write the file (and in fact, that the directory isn't there). From their standpoint, the path is invalid. You won't typically just save a file and have it vanish.
I guess you could theoretically have something like a script that writes a file data and fails silently if the path doesn't exist. I do think that it might get confusing, to have some files written to the bind mount point in the user directory
I mean, the OS isn't going to merge them when you do the bind mount or anything. You're going to have one directory structure on your removable media that contains some files, and when it's inserted and the bind mount is in place, that's what you'll see, and a second directory structure inside the bind mount that will have different data. Like, if whatever is writing this is something that you control, I think I might set it up to explicitly write somewhere else. Or just create a /mount/external/realfolder directory on the /mount filesystem and give the user write permission to /mount/external/realfolder which will have the same effect, with some data going to a the removable media and some to the directory structure where the mountpoint lives if the media isn't present (just that the files will be written to wherever /mount lives, which may not be the same filesystem as /home/user/; I don't know if that matters for your use case).
But if you do feel that you want to set up a bind mount, then yeah, I'd look at the other comment I have in response to your comment here, the one talking about systemd-udev.