Quirky output of Windows NTFS mount inside WSL
Hi,
I see that most Linux apps struggle to get the actual file size of a NTFS drive mounted in WSL.
Using Dust 0.8.3
From my Linux instance I go to /mnt/d/ and see the following results
Normal output
# dust
13294035T ┌── QtGraphicalEffects
13196115T │ ┌── eo
13458252T │ │ ┌── LC_MESSAGES
13458252T │ ├─┴ bs
13574211T │ ├── fi
13589332T │ │ ┌── LC_MESSAGES
13589332T │ ├─┴ nb
14721323T │ │ ┌── LC_MESSAGES
14721323T │ ├─┴ mk
14721323T │ │ ┌── LC_MESSAGES
14721323T │ ├─┴ uz@cyrillic
14721323T │ │ ┌── LC_MESSAGES
14721323T │ ├─┴ cy
14871114T │ │ ┌── LC_MESSAGES
14871114T │ ├─┴ lt
15056111T │ ┌─┴ locale
14673252T ├─┴ data
10797842T ┌─┴ bin
10797842T ┌─┴ KDE
4117825T ┌─┴ .
with apparent-size things are looking better
# dust -s -b
17G ┌── Data
45G ├── Hyper-V
13G │ ┌── ubuntu 22.04
14G │ │ ┌── FreeBSD13.vdi
14G │ ├─┴ FreeBSD13
16G │ │ ┌── FreeBSD.vdi
16G │ ├─┴ FreeBSD 12
16G │ ├── Amazon Linux 2
17G │ │ ┌── Oracle Linux 7.6.vdi
17G │ ├─┴ Oracle Linux 7
18G │ │ ┌── {a1599947-7d7c-492d-b377-7b4187c508a7}.vdi
19G │ │ ┌─┴ Snapshots
38G │ │ ├── Sophos.vdi
58G │ ├─┴ Windows7
28G │ │ ┌── {17213b5e-2726-444d-9ecc-41254bcc1fc1}.vdi
28G │ │ ┌─┴ Snapshots
32G │ │ ├── Centos 6.vdi
60G │ ├─┴ Centos 6
260G ├─┴ VM
332G ┌─┴ .
Is there something wrong with how WSL is presenting the drive as other tools like Dust is also not printing sizes correctly. gdu also needs to use apparent size to display correctly.
https://github.com/dundee/gdu/issues/162
I've no idea how WSL works, but if it is fixed in gdu then I should be able to replicate that here
apparent size uses file length instead of counting the blocks that the file uses. It is possible that the block size in WSL is strange: https://doc.rust-lang.org/std/os/linux/fs/trait.MetadataExt.html#tymethod.st_blocks