Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot delete device /dev/loop0

I unsafely removed a USB device that was attached to loop0 with losetup and could not delete nor detach loop0 afterwards.

losetup -a shows /dev/loop0: [0005]:145606719 (/dev/sdb1)

When I remount the device to /dev/sdb1, umount it and try losetup -d /dev/loop0, I will still get the same error loop: can't delete device /dev/loop0: Device or resource busy. Is there a way to get rid of the loop device?

like image 301
BiX Avatar asked May 04 '11 09:05

BiX


People also ask

Can I delete Dev loop0?

If /dev/loop* are created by snaps, just remove the snaps that created them, using snap remove <name_of_snap> . You can get a list of your installed snaps by running snap list .

What is disk Dev loop0?

What is /dev/loop? /dev/loop is a virtual / loop device which is basically a file in Linux system which acts as a block device. It is used for mounting disk images like Snap. /dev/loop is read only so the size is fixed once created and cannot be modified. The naming is /dev/loopX.

Why is Dev loop0 full?

Your /dev/loop0 is full because you continue to use the app associcated with the block device and whatever that app is creates or increases the block device sized based on usage if it is full then you need to uninstall the app or move the app install location to a different drive.

What is loop0 in Ubuntu?

DESCRIPTION. The loop device is a block device that maps its data blocks not to a physical device such as a hard disk or optical disk drive, but to the blocks of a regular file in a filesystem or to another block device.


1 Answers

You may have to also use dmsetup to remove the device mapping. Easiest way, if it doesn't interfere with any other mappings is to use a dmsetup remove_all.

like image 190
Aaron Flin Avatar answered Oct 14 '22 02:10

Aaron Flin