I mount disk image via loop device (losetup -f image.img). It contains partition table and I force kernel to read it: partprobe /dev/loop1.
I mount /dev/loop1p1, fix stuff I want to fix, umount back filesystem. I remove file from loopback device (losetup -d /dev/loop1). But /dev/loop1p1 does not disappear.
I even tried to recreate lodevice, add and remove partition table via fdisk. But all my attempts failed:
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 22: Invalid argument. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks.
Partition is not in use in any way, but I unable to free it. Is any way to remove it without reboot?
I see in dmesg few records:
[4649002.505727] loop1: rw=0, want=211812300, limit=62914560 [4649002.505753] Buffer I/O error on device loop1p1, logical block 52952562 [4649002.505870] attempt to access beyond end of device
And they are nagging my nagios.