1

I moved the source of a loop drive into its mountpoint and umount it. Then the source disappeared.

Note that after moving the source to its mountpoint (or other location), the source was shown as deleted:

$ losetup --all
/dev/loop0: []: (/mnt/storage/test.iso (deleted))

and the space the source previously occupied wasn’t released when I checked via df -h:

# Original Used Space
$ df -h|grep storage
Filesystem                    Type      Size  Used Avail Use% Mounted on
/dev/mapper/vgtank-lvtest     ext4      100M  128K  100M   1% /mnt/storage
# After Creating the File and Mounting
$ dd if=/dev/zero of=/mnt/storage/test.iso bs=64M count=1
1+0 records in
1+0 records out
67108864 bytes (67 MB, 64 MiB) copied, 0.0405464 s, 1.7 GB/s
$ losetup -f test.iso
$ mkdir test
$ mount /dev/loop0 test
$ df -h|grep storage
Filesystem                    Type      Size  Used Avail Use% Mounted on
/dev/mapper/vgtank-lvtest     ext4      100M   64M   36M  64% /mnt/storage
# After Moving the File and Umounting
$ mv test.iso test
$ umount test
$ df -h|grep storage
Filesystem                    Type      Size  Used Avail Use% Mounted on
/dev/mapper/vgtank-lvtest     ext4      100M   64M   36M  64% /mnt/storage

I have two questions here:

  1. why can we mv a file to another file system when the file is in used (by losetup)?
  2. where did the file go after umounting?

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.