EDIT: Given link of another thread suggest that newer kernel do not have this issue but I am using latest kernel i.e. 4.18.5. Hence, this issue is either new or newer kernel have this bug

In my setup, I need to mount least 200 Loop devices. Mounting 200+ loop device is not an issue. But I observed that mounting 200+ devices eats up almost 300+ MB of RAM. All these loop devices are of squashfs type. Few devices are of size 1MB while few are of 50+MB.

top command also don't show anything about RAM consumption. echo 3 > /proc/sys/vm/drop_caches also doesn't free up memory.

I would like to know that:

  • Is this normal that mere mounting loop devices eats up memory ?
  • Mounting 200 devices takes up almost 15 Sec. Is there any way to speed up this ? I am using the command: mount -o loop,nodev Sample.sq /mnt/loop1
  • 1
    Maybe you find it useful for your case overhead of using loopdevice. Nov 13, 2018 at 9:33
  • I am using kernel 4.18.5. Gcc 7.2
    – SHW
    Nov 13, 2018 at 10:18
  • You are mounting 200 squashfs images at once. I'm not surprised there's some memory ovehead and that it takes ~15 seconds, due to how squashfs works. en.wikipedia.org/wiki/SquashFS
    – Mio Rin
    Nov 13, 2018 at 11:39
  • You mention "few are of 50+MB". What is the total size of all those squashfs filesystems, and how much memory would you expect them to take?
    – JigglyNaga
    Nov 13, 2018 at 12:34
  • Total size of all squashfs images is around 1.2GB.
    – SHW
    Nov 13, 2018 at 12:52


Browse other questions tagged .