This relates to the thread here. Since it is closed, I was only able to start a new thread. This is it.
I have seen similar symptoms with the ntfs3
driver using the linux66
kernel package.
I have been using the (commercial) Paragon (ufsd
) driver in the past on Ubuntu, but decided to give it a go after switching to Manjaro. Not last because their install.sh
limits compatibility to kernel 6.4 as the upper boundary.
Alas, it seems mine will be just another thread sharing details about something going wrong. It’s not clear what exactly is going wrong. I only see the symptoms.
So it all started when I downloaded Kali, Tails and some other stuff via qbittorrent. I downloaded them into an NTFS drive mounted read-write via ntfs3
driver. Mount options as per mount
output were at the time:
rw,nosuid,nodev,noexec,noatime,uid=1000,gid=1000,dmask=0007,fmask=0117,windows_names,iocharset=utf8,user
I have a particular directory called ISO where I downloaded those images mentioned above and which at the time also contained a dozen or so Windows-related ISOs (downloaded through my VS subscription).
Suddenly and without any explanation I could find, the majority of those Windows-related ISO files were gone. Alright, not ideal but I can download them again. Alas, it also turned out that not all of the files that were currently being downloaded or had just finished downloading would appear in the directory.
“That’s strange”, I thought to myself and started investigating. My first suspicion was that I had accidentally jailed qbittorrent somehow via firejail/firetools. Alas, lsns
showed that there were no mount namespaces that would explain the weirdness going on. Some peeking into /proc/$PID
for the process in question also didn’t yield anything out of the ordinary.
What’s even weirder, Firefox had the same issue. Because I also wanted to download Tiny Core Linux (also released as of late), I used a browser (they don’t seem to offer torrents).
The individual Firefox processes were in all sorts of namespaces, just no mnt
namespaces involved either …
So I tried what one would usually do, I told both Firefox and qbittorrent to open the location of the respective downloaded file(s).
With Firefox I landed in the said ISO
directory and it was missing plenty of the files in question. With qbittorrent one of them landed me inside a subdirectory of ISO
and according to Dolphin it contained two files. Copying the file paths to the clipboard I was even able to see those files from the terminal. Bummer.
But inside the alleged parent directory ISO
there was no such subdirectory to be seen. Schroedinger’s subdirectory, so to speak.
Alright, since I have a license of the Paragon NTFS driver for Linux, I decided to make a few changes to its install.sh
so I could employ its chkntfs
utility. For obvious reasons I wanted to refrain from using the ntfsfix
utility from Tuxera, because the manual page makes it clear it isn’t equipped to fix certain conditions (and I had not made any negative experiences with chkntfs
).
And lo and behold:
$ sudo chkntfs -f --verbose /dev/nvme0n1p1
(Mar 5 2024 21:00:06)
GetMount(/proc/mounts): "/dev/nvme0n1p1" is not mounted
GetMount(/etc/mtab): "/dev/nvme0n1p1" is not mounted
fstat("/dev/nvme0n1p1") returns mode 60660 and size 0
ioctl("/dev/nvme0n1p1",BLKSSZGET) returns 512
"/dev/nvme0n1p1": discardzeroes is not supported by this device
"/dev/nvme0n1p1": disk size 0x1d1c1000000 bytes. ~1863GB, sector size 0x200
Checking Volume /dev/nvme0n1p1...
Type of the filesystem is NTFS.
Serial number 3C8022DA-80229A82.
Volume label is: FASTDATA.2TB.
Verifying 45696 records...
Verifying 5709 file(s) with EAs...
Verifying 361 folders...
Correcting error in index 0x30 "$I30" for file 0x7d79 (ISO).
Updating bitmap attribute "$I30" in file 0x7d79 (ISO).
Sorting index 0x30 "$I30" in file 0x7d79 (ISO).
info: device "/dev/nvme0n1p1" does not zeroes while discarding
Minor inconsistencies detected on the volume. 24 files contain incorrect links count.
Recovering 24 orphan files...
Recovering orphaned file "tails-amd64-6.0-img" (0x34cf) into directory "ISO" (0x7d79).
Recovering orphaned file "tails-amd64-6.0-iso" (0x34d0) into directory "ISO" (0x7d79).
Recovering orphaned file "neon-user-20240228-1346.iso" (0x34d1) into directory "ISO" (0x7d79).
Recovering orphaned file "SHA256SUM.kali" (0x34d2) into directory "ISO" (0x7d79).
Recovering orphaned file "nethunterpro-2024.1-pinephone-phosh-img-tar-xz" (0x34d5) into directory "ISO" (0x7d79).
Recovering orphaned file "tails-amd64-6.0.iso.torrent" (0x5e23) into directory "ISO" (0x7d79).
Recovering orphaned file "nethunterpro-2024.1-pinephone-phosh.img.tar.xz.torrent" (0x5e26) into directory "ISO" (0x7d79).
Recovering orphaned file "kali-linux-2024.1-raspberry-pi5-arm64.img.xz.torrent" (0x5e27) into directory "ISO" (0x7d79).
Recovering orphaned file "nethunterpro-2024.1-pinephone-phosh.img.tar.xz" (0x5e29) into directory "ISO" (0x7d79).
Recovering orphaned file "TinyCore-current.iso" (0x5e2b) into directory "ISO" (0x7d79).
Skipping further messages about recovering orphans.
Recovered 24 orphans.
Verifying files security...
$UpCase file is formatted for use in Windows 7 and later versions
Checking volume bitmap (59617 kBytes)
Free clusters 0x55cf170 - 0x55cf171 marked as used.
Free cluster 0x102093f3 marked as used.
Used clusters 0x2d22 - 0x2d23 marked as free.
Correcting $Bitmap data attribute.
1863.02 GB total disk space.
1629.38 GB in 6819 files.
1972 KB in 363 directories.
631996 KB in use by the system.
512 MB occupied by the log/journal file.
4 KB in each allocation unit.
488378367 total allocation units on volume (1863.02 GB).
61090771 allocation units available on volume (233.04 GB).
The volume /dev/nvme0n1p1 has been repaired successfully.
chkntfs returns 2. run 0 seconds
So that was the root cause.
I know the ntfs3
driver is said to be completely rewritten from scratch and Paragon even claims to test its consistency against their other NTFS driver (called ufsd
- with u
for universal, because it also supports HFS+) and said to derive from their original NTFS for DOS driver, but something doesn’t hold up here.
Now at this point I am well into the realm of speculation, because my Linux kernel endeavors can only be described as superficial, compared to the Windows kernel driver experience. However, it looks like moving files may be the underlying cause as per this Launchpad issue for Ubuntu. I haven’t tried to confirm my suspicion by further risking the data integrity on my drive or validating it in the qbittorrent and Firefox source, but a common way to download something is to download it into a file - Firefox appends .part
- and then move it into place. So a move would be involved under these conditions.
It’s still beyond me what then causes the corruption or how. I will try to dig through my logs a bit and hopefully something will turn up which helps to narrow it down further.
PS: generally I found this blog entry while researching this topic and it links to other resources including the Launchpad ticket linked above. But no solution to the file system corruption issue …