I have done these procedures to mount my .img file in /etc/fstab (for ubuntu mate 20.04 x64)

Create .img file:

dd if=/dev/zero of=filename.img bs=1024 count=2M
sudo mkfs.ext4 filename.img

Note: also be done with gparted with this method

The problem:

Mount /etc/fstab in /mount/point:

/home/user/filename.img /home/user/vdisk ext4 defaults 0 0
# or
/home/user/filename.img /home/user/vdisk ext4 loop 0 0
# or
/home/user/filename.img /home/user/vdisk auto loop 0 0

But always show 2 units: vdisk (mount) and loop (not mount) (see image)

enter image description here

if i try to click on this other drive showing unmounted i get the following message:

enter image description here

Why doesn't it just show the fileimage.img image mounted in the vdisk folder?

I would like you to help me fix the fstab line so that two units do not appear when mounting .img but only one


if I run any of the following commands:

sudo mount -a
# or
sudo mount /home/user/vdisk

The same thing that I describe in my post appears.

My fstab (I have altered the UUID for security reasons):

# / was on /dev/sda2 during installation
UUID=9f92d1aa-458d-441a-b349-abcdefghijkl /   ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=F798-ABCD  /boot/efi       vfat    umask=0077      0       1
/swapfile          none            swap    sw              0       0
/home/user/filename.img /home/user/vdisk ext4 defaults 0 0


sudo losetup --list | grep filename.img
/dev/loop8     0      0    1  0 /home/user/filename.img   0     512


But, if I remove the /etc/fstab line, delete /dev/loop8 and mount .img image manually (with the followings commands), the described error does not appear

sudo mount -o loop /home/user/filename.img /home/user/disk
# or
sudo mount -t ext4 -o loop /home/user/filename.img /home/user/disk


  1. manually

mount .img manually to /dev/loopXX available:

losetup -f
sudo losetup -P /dev/loop8 filename.img
sudo losetup -l
/dev/loop8         0      0         0  0 /home/user/filename.img                            0     512

edit /etc/fstab and put the line:

# /path/to/loop/device       /path/to/mount/point       auto       loop       0 0
# example:
/dev/loop8 /home/user/disk ext4      defaults      0 0


sudo mount -a

Note: this method is not permanent

  1. bash script:
mount -o loop /home/user/filename.img /home/user/disk

# sudo crontab -e
@reboot ./mount-img.sh

Another bash to mount/umount .img HERE (can be programmed in crontab to start with the system)

  1. with bindfs:
sudo mkdir /mnt/disk
# edit fstab and add line:
/home/user/filename.img /mnt/disk ext4    defaults  0   0
sudo mount -a
sudo -u user bindfs -n /mnt/disk /home/user/disk


  • There is no error
  • The image is mounted (manually and with fstab)

About mount:

When mounting the .img in fstab, it appears duplicated (one is mounted and the other is not). This does not happen when mounting the .img manually or /dev/loopXX in fstab

Update New:

This appears to be a bug in Ubuntu Mate 20.04.3. In Ubuntu version 20.04.3 this problem is not present.

testing file managers:


  • caja
  • nemo
  • thunar

does not affect:

  • dolphin
  • nautilus

enter image description here

launchpad report

github issue


  • When you reboot the machine, I would expect it to be mounted (which should be checked with sudo mount), I don't care what a GUI might say about it. What happens if you try running sudo mount /home/user/vdisk? (check with sudo mount after the fact).
    – eftshift0
    Commented Sep 23, 2021 at 21:16
  • Maybe you can try loop,noauto, but I'm not sure... Commented Sep 23, 2021 at 23:00
  • @schrodigerscatcuriosity I tried but it doesn't work
    – acgbox
    Commented Sep 23, 2021 at 23:18
  • @eftshift0 It isn't necessary to use sudo mount to see the mounted file systems. That can be just run as a regular user. Commented Sep 24, 2021 at 1:01
  • mount: only root user can do this. Anyway, the question is about fstab and not about mount
    – acgbox
    Commented Sep 24, 2021 at 12:31

1 Answer 1


Loop mount of simple image file via `/etc/fstab'

In a test system of Ubuntu Server 20.04.3 LTS I created an image file similar to yours,

$ dd if=/dev/zero of=file.img bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB, 1000 MiB) copied, 5.90297 s, 178 MB/s
$ sudo mkfs.ext4 file.img
[sudo] password for tester: 
mke2fs 1.45.5 (07-Jan-2020)
Discarding device blocks: done                            
Creating filesystem with 256000 4k blocks and 64000 inodes
Filesystem UUID: bbf0ad05-d48b-4b0c-b7e5-ea4e5959b78b
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

I created a mount point,

sudo mkdir /mnt/lp0

and added the following line at the tail end of /etc/fstab

/home/tester/test/file.img  /mnt/lp0  ext4  loop,rw,relatime  0  0

and rebooted.

(I did some tests by editing the line and running sudo mount -a until it worked.)

I verified with df that it works after rebooting,

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1.9G     0  1.9G   0% /dev
tmpfs           382M  1.1M  381M   1% /run
/dev/sda9        32G  4.3G   26G  15% /
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/loop0      969M  2.5M  900M   1% /mnt/lp0
/dev/sda8       511M  5.3M  506M   2% /boot/efi
tmpfs           382M     0  382M   0% /run/user/1000

Loop mount of general image file with [several] partitions

It is not straightforward to loop mount 'any' image file. I suggest that you use kpartx for that purpose. It can manage also images with [several] partitions. You find details how to use kpartx in this link to my answer to a question at AskUbuntu.

  • What you propose is very similar to what I have posted and may work for Ubuntu server, but not for ubuntu mate
    – acgbox
    Commented Sep 27, 2021 at 22:06
  • @ajcg, In the title you asked about mounting and I think it works, meaning that mounting works as it should. It is the user interface that shows the mounted device twice. I am not using the MATE desktop environment, and cannot debug that part of your problem.
    – sudodus
    Commented Sep 28, 2021 at 6:37
  • I think it is a bug. but maybe it isn't and it's just fstab issue. I do not know. Your answer is correct, just like what I posted, but it doesn't fix the problem. Anyway, I appreciate the effort you have put into my case.
    – acgbox
    Commented Sep 28, 2021 at 14:41
  • @ajcg, I agree, it is probably a bug. Maybe the best way to manage it is the workaround that you describe in the question.
    – sudodus
    Commented Sep 28, 2021 at 14:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .