Hello everybody,
I am fstransform author (https://github.com/cosmos72/fstransform),
and I am currently testing it on ntfs3-mounted filesystems,
in order to understand whether fstransform is able to use the recently
merged
ntfs3 kernel module to convert ntfs filesystems to ext4/xfs etc.
Previous attempts using fuse ntfs-3g or the old, read-only ntfs kernel
module
had disappointing (read: negative) results due to their limitations, so
I am hoping
that in-kernel read-write NTFS support would fare better.
My setup is:
* Linux/amd64 + Debian 11 (bookworm)
* kernel 5.17.2, compiled from sources to enable ntfs3 support (Debian
kernels do not yet enable it)
* a large loop-mounted file containing an NTFS filesystem:
# ls -al ntfs.img
-rw-r----- 1 max users 53603205120 Apr 9 12:55 ntfs.img
# file ntfs.img
ntfs.img: DOS/MBR boot sector, code offset 0x52+2, OEM-ID "NTFS ",
sectors/cluster 8, Media descriptor 0xf8, sectors/track 63, heads 255,
hidden sectors 204800, dos < 4.0 BootSector (0x80), FAT (1Y bit by
descriptor); NTFS, sectors/track 63, sectors 104693759, $MFT start
cluster 786432, $MFTMirror start cluster 2, bytes/RecordSegment
2^(-1*246), clusters/index block 1, serial number 060c8eafbc8eace7a;
contains bootstrap BOOTMGR
# losetup /dev/loop0 ntfs.img
# mount /dev/loop0 /mnt -t ntfs3
# df /mnt
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/loop0 52346876 20930272 31416604 40% /mnt
# ls -al /mnt
total 262592
[.. lots of files and directories...]
---------------------------------------------------------
My problem: fstransform needs to create a sparse file as large as the
device inside the
filesystem, so I tried to do the same:
# truncate --size=$((52346876*1024)) /mnt/sparse-file
truncate: failed to truncate '/mnt/sparse-file' at 53603201024 bytes:
File too large
# rm /mnt/sparse-file
# truncate --size=$((40000000*1024)) /mnt/sparse-file
truncate: failed to truncate '/mnt/sparse-file' at 40960000000 bytes: No
space left on device
# rm /mnt/sparse-file
# truncate --size=$((30000000*1024)) /mnt/sparse-file
# du /mnt/sparse-file
30000000 /mnt/sparse-file
# df /mnt
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/loop0 52346876 50930272 1416604 98% /mnt
So it seems that "truncate" creates non-sparse files inside
NTFS3-mounted filesystems,
although from what I understand NTFS _does_ support sparse files, see
for example http://ntfs.com/ntfs-sparse.htm
-------------------------------------------------------------
Questions:
1. Is "truncate" behaviour described above intentional/expected?
2. Is there a way to create sparse files inside NTFS3-mounted
filesystems using Linux tools?
Thanks,
Massimiliano Ghilardi
|