Sample Header Ad - 728x90

when mounting an .img via fstab, it shows duplicate in file manager (Ubuntu Mate 20.04.3)?

0 votes
1 answer
986 views
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** **Update:** 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
List:
sudo losetup --list | grep filename.img
/dev/loop8     0      0    1  0 /home/user/filename.img   0     512
**Important:** 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
**Workaround:** 1. manually mount .img manually to /dev/loopXX available:
losetup -f
/dev/loop8
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
and: sudo mount -a Note: this method is not permanent 2. bash script:
#!/bin/bash
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) 3. 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
**Summary:** - 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:** affects: - caja - nemo - thunar does not affect: - dolphin - nautilus enter image description here launchpad report github issue Reference
Asked by acgbox (1010 rep)
Sep 23, 2021, 08:54 PM
Last activity: Nov 2, 2021, 10:47 PM