dmesg “kernel: [3179429.878254] loop5: detected capacity change from 0 to 325360”?

The message is printed from the function set_capacity_and_notify in the file block/genhd.c (gendisk handling), in the kernel source tree. In your context the call comes from the file drivers/block/loop.c. See man loop for more details about loop devices, but the first part is copied and pasted here:

The loop device is a block device that maps its data blocks not
to a physical device such as a hard disk or optical disk drive, but to
the blocks of a regular file in a filesystem or to another block
device. This can be useful for example to provide a block device for
a filesystem image stored in a file, so that it can be mounted with
the mount(8) command.

There are multiple calls to loop_set_size, which calls set_capacity_and_notify, within drivers/block/loop.c so we would need more details as to what you are doing to isolate further.

Try the losetup command to learn more about potential /dev/loop# devices: Example:

doug@desk-jj:~$ /sbin/losetup --list
NAME        SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE                                        DIO LOG-SEC
/dev/loop1          0      0         1  1 /var/lib/snapd/snaps/core_16202.snap               0     512
/dev/loop8          0      0         1  1 /var/lib/snapd/snaps/gnome-3-38-2004_137.snap      0     512
/dev/loop6          0      0         1  1 /var/lib/snapd/snaps/firefox_3252.snap             0     512
/dev/loop13         0      0         1  1 /var/lib/snapd/snaps/gtk-common-themes_1534.snap   0     512
/dev/loop4          0      0         1  1 /var/lib/snapd/snaps/core20_2015.snap              0     512
/dev/loop11         0      0         1  1 /var/lib/snapd/snaps/snap-store_959.snap           0     512
/dev/loop2          0      0         1  1 /var/lib/snapd/snaps/core20_1852.snap              0     512
/dev/loop0          0      0         1  1 /var/lib/snapd/snaps/bare_5.snap                   0     512
/dev/loop9          0      0         1  1 /var/lib/snapd/snaps/gnome-42-2204_141.snap        0     512
/dev/loop7          0      0         1  1 /var/lib/snapd/snaps/firefox_3290.snap             0     512
/dev/loop14         0      0         1  1 /var/lib/snapd/snaps/gnome-3-38-2004_143.snap      0     512
/dev/loop5          0      0         1  1 /var/lib/snapd/snaps/core22_864.snap               0     512
/dev/loop12         0      0         1  1 /var/lib/snapd/snaps/snap-store_638.snap           0     512
/dev/loop3          0      0         1  1 /var/lib/snapd/snaps/core_14946.snap               0     512
/dev/loop10         0      0         1  1 /var/lib/snapd/snaps/gtk-common-themes_1535.snap   0     512

Read more here: Source link