1

Debian 8.2. I want to umount the /dev/loop5 device that I mounted, but I can't. I'm getting the message that

/dev/loop5 is not mounted.

Could anyone explain to me what I'm doing wrong here, please?

touch file
mkdir /mnt/partition
dd if=/dev/zero of=file bs=1M count=10
losetup /dev/loop5 file
mkfs.ext2 /dev/loop5
mount –t auto –o loop /dev/loop5 /mnt/partition
umount /dev/loop5
  • 1
    how about umount /mnt/partition? – Rui F Ribeiro Mar 15 '18 at 20:40
  • I forgot to mention- This works, yea. But I'm trying to get the /dev/ one, because I want to undelete files with mc which requires the /dev/partition way. I'm still learning tho, that's why I don't know much about that stuff. – Doe Mar 15 '18 at 20:41
3

Because you didn't mount /dev/loop5.

mount -oloop SRC MNT means to create a loop device for the file SRC, and then mount that loop device at MNT. Apparently SRC is allowed to be a loop device itself if you really want :).

You could have seen this in the output of mount or findmnt; they would show that the loop device /dev/loop5 is not mounted and a different loop device is mounted.

0

man umount states

... Giving the special device on which the file system lives may also work, but is obsolete, mainly because it will fail in case this device was mounted on more than one directory.

emphasis is mine

So the correct way is

umount /mnt/partition

From your comments I suspect there is some sort of misconception about the relation between device and mountpoint.

Whenever you unmount a device the mountpoint and the device are separated and the observed behaviour will be the same regardless if you specified the device (/dev/loop5) or the mountpoint (/mnt/partition/).

  • But when I'm trying to undelete files with mc it asks me for the /dev/ path, not the /mnt/ one. That's why I was trying to do it with /dev/loop all the time. – Doe Mar 15 '18 at 21:41
  • You can only undelete files as long as the directory is mounted. While it is mounted it doesn't really matter, how you call it. – guntbert Mar 15 '18 at 21:43
  • Oh, I thought I had to unmount it first. Thanks. But still - I can't use undelete, because it asks me for the /dev/ path, while not accepting the /dev/loop5 one. – Doe Mar 15 '18 at 21:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.