NickSoft asked:
I have a backup script in which I umount a squashfs file, I do backup then mount it back again. A simplified version of the script is:
umount /home/backup/auto/mnt/os
mksquashfs /src-dir /home/backup/auto/os.sqfs.img
mount -t squashfs -o loop /home/backup/auto/os.sqfs.img /home/backup/auto/mnt/os
The idea is to have access at all times to backedup data.
And this worked for long time. However I got an error of not having enough loopback devices and I saw that umount does not detach loop devices mounted with mount anymore.
Lately I had two major changes:
- I updated the kernel to 2.6.32-754.11.1.el6.i686
- I moved the OS to an SSD.
I just noticed that there is new kernel update 2.6.32-754.12.1.el6, so I updated, but it did not fix the problem.
OS: CentOS 6.10
My answer:
On kernels < 2.6.37, Linux requires that an entry be written to /etc/mtab
for loop mounted filesystems in order to autoclear the loop device later. If /etc/mtab
is not writable at mount time or the entry was removed from /etc/mtab
then the loop device won’t be autocleared. On kernels >= 2.6.37 the kernel remembers the loop device backing store path and it is not required to be in /etc/mtab
.
View the full question and any other answers on Server Fault.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.