When trying to set up a dwarfs file as a loop device, it does not align to the default 512B sector boundary. However, if I pad the file to multiples of 512B, it also fail to mount.
This affects automounting utilities like udevil, which may be used in GUI file managers and such. Another use case is when the dwarfs is written to a dedicated partition (in a firmware image, I imagine), which is likely to have paddings after the filesystem itself.
0 ~:ls -l test.dwarfs
-rw-r--r-- 1 root root 45834020970 03-28 11:28 test.dwarfs
0 ~:mkdir test
0 ~:mount -t fuse.dwarfs test.dwarfs test
0 ~:umount test
0 ~:udevil mount --verbose -t fuse.dwarfs test.dwarfs
ROOT: /sbin/losetup /dev/loop0 /root/test.dwarfs
losetup: /root/test.dwarfs: Warning: file does not end on a 512-byte sector boundary; the remaining end of the file will be ignored.
ROOT: /bin/mount -v -t fuse.dwarfs -o nosuid,noexec,nodev,lazytime,ro /dev/loop0 /run/mount/test.dwarfs
E 11:26:54.892551 error initializing file system: dwarfs::runtime_error: [fs_section.cpp:68] truncated section data: 45834020970 > 45834020864
mount exit status = 1
ROOT: /sbin/losetup -d /dev/loop0
0 ~:echo $((45834020970%512))
106
0 ~:echo $((45834020970-106+512))
45834021376
0 ~:truncate -s 45834021376 test.dwarfs
0 ~:udevil mount --verbose -t fuse.dwarfs test.dwarfs
ROOT: /sbin/losetup /dev/loop0 /root/test.dwarfs
ROOT: /bin/mount -v -t fuse.dwarfs -o nosuid,noexec,nodev,lazytime,ro /dev/loop0 /run/mount/test.dwarfs
E 11:29:02.360347 error initializing file system: dwarfs::runtime_error: [fs_section.cpp:52] truncated section header: 45834021354 + 64 > 45834021376
mount exit status = 1
ROOT: /sbin/losetup -d /dev/loop0
Also, please consider adding a filesystem label and UUID, so the mountpoint can be displayed better in GUI file managers.
When trying to set up a
dwarfsfile as a loop device, it does not align to the default 512B sector boundary. However, if I pad the file to multiples of 512B, it also fail to mount.This affects automounting utilities like
udevil, which may be used in GUI file managers and such. Another use case is when thedwarfsis written to a dedicated partition (in a firmware image, I imagine), which is likely to have paddings after the filesystem itself.Also, please consider adding a filesystem label and UUID, so the mountpoint can be displayed better in GUI file managers.