I'm using Debian 13 in a headless setup and I've been trying to ensure that an external drive always mounts to a specific directory, even if I remove it and insert it later, possibly in a different bay. I understand that I should use the UUID to set this up in the /etc/fstab file. I initially got everything working, but now, after removing the drive and reinserting it, I'm getting an Input/output error when I try to access the mount point. The contents of my /etc/fstab haven't changed, and while `lsblk` shows the drive is there, using `findmnt` returns nothing. What's the best way to make this setup work so that my drive mounts to the correct directory every time?
3 Answers
When you remove a drive, remember to unmount it first. If you yank it out while it's still mounted, it can lead to errors and potentially corrupt data. After you've safely removed the drive, you can use `mount -a` to check if the fstab entries are mounted. Just don't forget that the safety of the data on removable drives is important; ensure all operations are completed before disconnecting.
Just a heads up, /etc/fstab primarily handles automounting at boot time. If you plug in a drive after the system is running, you might have to mount it manually. To make hot-swapping easier, consider using a tool like udiskie or setting up a udev rule to mount the drive automatically when it's connected. It can be a little trickier on Linux compared to Windows.
Could you share your exact fstab entry? To mount a drive in a consistent way, you should be using its UUID or a similar identifier in your fstab line. I have a few USB drives set up this way, and they mount correctly no matter which system I use. Here are some examples of how my fstab entries look:
```
LABEL="SomeLabel" /mnt/somewhere ntfs defaults,noatime 0 0
UUID="SomeUUID" /mnt/anotherlocation ext4 defaults 0 2
```
Make sure your entry matches that format!
I have it set up like this: "UUID=7E1C7AE11C7A93BD /srv/media/othermedia ntfs-3g defaults,noatime,uid=1000,gid=1000 0 0". I also tried it with 'nofail'. Any thoughts?

Got it, I thought it would be similar to my Windows setup where it just works. I’ll check out udiskie, but honestly, if it’s that complicated, I might just stick with Windows.