Debian. Can't umount loop device

8,679

Solution 1

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.

Solution 2

man losetup shows:

Detach all associated loop devices:

losetup -D

So, you can use

losetup -D /dev/loop10
Share:
8,679

Related videos on Youtube

Doe
Author by

Doe

Updated on September 18, 2022

Comments

  • Doe
    Doe almost 2 years

    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
    
    • Rui F Ribeiro
      Rui F Ribeiro over 6 years
      how about umount /mnt/partition?
    • Doe
      Doe over 6 years
      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.
    • Admin
      Admin over 6 years
  • Doe
    Doe over 6 years
    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.
  • guntbert
    guntbert over 6 years
    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.
  • Doe
    Doe over 6 years
    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.