Is there a more-correct way to unmount a device/filesystem/etc? Should I umount the device I originally mounted or the mount point?
mount /dev/sda1 /mnt/myusbstick do stuff umount /mnt/myusbstick
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
On Linux, the recommended way (according to the util-linux maintainers)[citation neeed] is to use
umount <mountpoint>, for several reasons:
The same device may be mounted on multiple locations, e.g. using bind mounts, btrfs subvolumes, or FUSE filesystems; you don't know which one would be unmounted first.
(You can use
umount --all-targets <device> though.)
A mount might have multiple backing devices, for filesystems such as btrfs, and
umount won't necessarily understand all of them (as the mtab & mountinfo files only show one).
The backing device might be not what you think it is. For example,
mount foo.iso /mnt will set up a loop device and mount that. (Though, luckily,
umount foo.iso is also smart enough to look up the corresponding loop device.)
You can stack several mounts on the same location, with only the latest one being visible.
It doesn't matter which way you refer to the mount.
The only case where it makes a difference is when you have a device mounted to multiple mount points. In that case when you specify the device to the umount command, it'll unmount the most recently mounted mountpoint. Specifying a mountpoint will allow unmounting that specific mountpoint.