A colleague of mine mounted an incorrect volume onto the directory, and then mounted the correct volume onto the same directory. Is there a way to unmount this "incorrect" volume without touching the "correct" volume?
Here's a reproducible example of this situation:
$ dd if=/dev/zero of=file-a bs=1M count=1 $ mkfs.ext4 file-a $ dd if=/dev/zero of=file-b bs=1M count=1 $ mkfs.ext4 file-b $ mkdir target $ sudo mount -o loop file-a target $ sudo mount -o loop file-b target Here's the situation after these commands:
$ findmnt TARGET SOURCE FSTYPE OPTIONS / /dev/xxx ext4 └─/home/user/test-umount/target /dev/loop1 ext4 rw,relatime └─/home/user/test-umount/target /dev/loop2 ext4 rw,relatime So we want to unmount the /dev/loop1 device here, but keep the /dev/loop2 mounted onto target.
Doing umount target will unmount the second volume, which is not the intended effect. Trying to umount the loop device itself gives:
$ sudo umount /dev/loop1 $ umount: /dev/loop1: umount failed: Invalid argument. Is there some way to solve this conundrum?