/dev/loop 100% utilization

Get FREE domain for 1st year and build your brand new site

Internship at OpenGenus

In this article, we have explained what is /dev/loop and why it has 100% memory utilization.

Table of contents:

  1. What is /dev/loop?
  2. 100% utilization of /dev/loop

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

  • dev stands for device
  • loop denotes the type
  • X is the numbering of the device

It is linked with the snapd service in Linux. For every software that is installed using snap, a loop device is created. Once the app is deleted/ uninstalled, the associated /dev/loop is also removed automatically.

There are many instances of /dev/loop:

  • /dev/loop0
  • /dev/loop1
  • /dev/loop2
  • /dev/loop3

100% utilization of /dev/loop

If you are facing OOM (Out Of Memory errors) and start looking into memory utilization in your system using various commands like "df -a", then you will notice locations like /dev/loop0, /dev/loop1 and so on have 100% memory utilization that is no free space is left.

For example, use the following command and see the output:

df -a


Filesystem                   Size  Used Avail Use% Mounted on
udev                         20G     0  20G   0% /dev
tmpfs                        794M  9.8M  785M   2% /run
/dev/mapper/ubuntu--vg-root  220G   37G  173G  18% /
tmpfs                        3.9G   35M  3.9G   1% /dev/shm
tmpfs                        3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/loop0                    42M   42M     0 100% /snap/docker/171
/dev/loop1                    84M   84M     0 100% /snap/core/3440

At first sight, this might seem to be the issue / cause of OOM errors but it is not. In fact, instances of /dev/loop are expected to have 100% space utilization.

In fact, 100% utilization of /dev/loop or snap images is the expected behaviour. Snap uses Squash File System which is a compressed read only file system. The file system is designed to store only the content that is needed. There should not be any additional (free) space so that there is no space wastage.

With this article at OpenGenus, you must have the complete idea of /dev/loop 100% utilization.