It looks like
mount -o loop changes the mounted image file. I downloaded the ISO image file and checked its SHA-1 checksum. Then I mounted that ISO file and the checksum changed. Here are the exact steps I made, a copy-paste from my console, CentOS 7 x64 (note, that ISO file is read-only):
[mbartnicki@89-78-33-81 Downloads]$ ls -lh total 3.1G -r--r--r--. 1 mbartnicki mbartnicki 3.1G Mar 31 18:28 X17-58997.iso [mbartnicki@89-78-33-81 Downloads]$ sha1sum X17-58997.iso 6c9058389c1e2e5122b7c933275f963edf1c07b9 X17-58997.iso [mbartnicki@89-78-33-81 Downloads]$ sudo mount -o loop X17-58997.iso /mnt/iso/ mount: /dev/loop0 is write-protected, mounting read-only [mbartnicki@89-78-33-81 Downloads]$ sha1sum X17-58997.iso 994944df320e9e03c032263d7b9e36157a0a587c X17-58997.iso
I was so surprised, that I repeated above steps on another machine (Ubuntu 14.04 x64), just to get the same result: file checksum changed after
mount -o loop. Unmounting ISO image doesn't return its checksum to original value; file change is persistent. Moreover, next mount change the checksum again to some new value. How can it be explained?
Mounting explicitly read-only by adding
ro mount option prevents file from being changed, so that if I use:
sudo mount -o ro,loop X17-58997.iso /mnt/iso
then everything is OK, and ISO image file lasts unchanged after mount. The wrong behaviour occurs only when
ro option is not specified, even if the ISO image file is read-only on the file system level. I tried on three different ISO images: Windows 7 installation DVD (official), SystemRescueCD (small rescue Linux) and hand-made ISO created by
I checked all that ISO files with
file utility, and
file said that all of them are ISO 9660 CD-ROM filesystem data. Files inside ISO images are not changed - I also checked it - it looks like the faulty mount scenario adds some meta-data or just garbage.