btrfs
btrfs copied to clipboard
Possible source(s) of corruption
It seems like the following things are a bit buggy, and cause winbtrfs to get a little confused, or for the linux btrfs driver to mount ro, or to not mount at all (or mount with some undeletable files).
- Shared SteamLibrary between Linux and Windows (in specific, wineprefixes and symlinks to /)
- Creating a Visual Studio .NET project sometimes makes the newly created files unmountable on Linux.
The undeletable files I've fixed by using
btrfs-check --repair
, with seemingly no negative side effects (yet)
Thanks. Next time it happens, can you please paste the output of btrfs-check
here? That'll tell me precisely what sort of bug I'm dealing with.
[onni@onskankone ~]$ sudo btrfs check /dev/nvme0n1p1
Opening filesystem to check...
Checking filesystem on /dev/nvme0n1p1
UUID: 84def4e1-7c6f-452d-8efd-deed0a5fe210
[1/7] checking root items
[2/7] checking extents
super bytes used 676351606784 mismatches actual used 675477454848
ERROR: errors found in extent allocation tree or chunk allocation
[3/7] checking free space tree
free space info recorded 1 extents, counted 0
there is no free space entry for 557302411264-557302415360
cache appears valid but isn't 556228673536
free space info recorded 2 extents, counted 1
there is no free space entry for 562536501248-562536505344
there is no free space entry for 562536501248-562671124480
cache appears valid but isn't 561597382656
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups skipped (not enabled on this FS)
found 675477454848 bytes used, error(s) found
total csum bytes: 658767600
total tree bytes: 899432448
total fs tree bytes: 86589440
total extent tree bytes: 27525120
btree space waste bytes: 139232263
file data blocks allocated: 675046608896
referenced 674132881408
[onni@onskankone ~]$
This is the current status of the drive. No read/write errors yet, but seemingly corrupted.
Is btrfs check --repair
actually fixing the errors? I've seen it claim to fix free space errors, but when you run btrfs check
again they're still there.
Also, what's the name of these undeletable files?
Currently not on my pc, but yes, check repair has fixed the errors previously, in a way that they don't show up on subsequent checks, until it happens again. I will create a project with Visual Studio tomorrow to test, and install some Proton-enabled games.
If it helps, I could try to include a log of some kind? If I figure out how to make Windows do kernel logs.
If you'd like to try these issues for yourself, you can create a C# project on a btrfs drive using Visual Studio, compiling it, rebooting a couple times, and trying to delete the whole project from Linux. I've found that the Visual Studio bug really isn't consistent though.
You can also try sharing a SteamLibrary with proton prefixes in it between os'ses(no Linux native version), and launching the games in the order Linux->Windows. This will most likely cause some issues (in btrfs check). I had this issue with GTA V.
If a game has Linux and Windows binaries, you can try "updating" the game from the Windows side after installing it from Linux. This can result in a steam "Disk Write Error". Personally had this issue with terraria.
Going to resize the btrfs partition, I noticed it had quite the amount of errors. To resize, you need to fix them first. So I did a btrfs check (--repair) and well:
[onni@onskankone ~]$ sudo btrfs check /dev/nvme0n1p2
Opening filesystem to check...
Checking filesystem on /dev/nvme0n1p2
UUID: 84def4e1-7c6f-452d-8efd-deed0a5fe210
[1/7] checking root items
[2/7] checking extents
super bytes used 644939857920 mismatches actual used 644060905472
ERROR: errors found in extent allocation tree or chunk allocation
[3/7] checking free space tree
free space info recorded 19 extents, counted 18
there is no free space entry for 319996477440-319996481536
there is no free space entry for 319996477440-320005472256
cache appears valid but isn't 318931730432
there is no free space entry for 328595394560-328595406848
cache appears valid but isn't 327521665024
there is no free space entry for 336645177344-336645181440
there is no free space entry for 336645177344-337185341440
cache appears valid but isn't 336111599616
there is no free space entry for 557302411264-557302415360
cache appears valid but isn't 556228673536
wanted bytes 939122688, found 939118592 for off 561597382656
wanted bytes 1073741824, found 939118592 for off 561597382656
cache appears valid but isn't 561597382656
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups skipped (not enabled on this FS)
found 644060905472 bytes used, error(s) found
total csum bytes: 628107456
total tree bytes: 878870528
total fs tree bytes: 100089856
total extent tree bytes: 27017216
btree space waste bytes: 143315147
file data blocks allocated: 647219642368
referenced 642754031616
And repair:
[onni@onskankone ~]$ sudo btrfs check --repair /dev/nvme0n1p2
enabling repair mode
WARNING:
Do not use --repair unless you are advised to do so by a developer
or an experienced user, and then only after having accepted that no
fsck can successfully repair all types of filesystem corruption. Eg.
some software or hardware bugs can fatally damage a volume.
The operation will start in 10 seconds.
Use Ctrl-C to stop it.
10 9 8 7 6 5 4 3 2 1
Starting repair.
Opening filesystem to check...
Checking filesystem on /dev/nvme0n1p2
UUID: 84def4e1-7c6f-452d-8efd-deed0a5fe210
[1/7] checking root items
Fixed 0 roots.
[2/7] checking extents
No device size related problem found
[3/7] checking free space tree
free space info recorded 19 extents, counted 18
there is no free space entry for 319996477440-319996481536
there is no free space entry for 319996477440-320005472256
cache appears valid but isn't 318931730432
there is no free space entry for 328595394560-328595406848
cache appears valid but isn't 327521665024
there is no free space entry for 336645177344-336645181440
there is no free space entry for 336645177344-337185341440
cache appears valid but isn't 336111599616
there is no free space entry for 557302411264-557302415360
cache appears valid but isn't 556228673536
wanted bytes 939122688, found 939118592 for off 561597382656
wanted bytes 1073741824, found 939118592 for off 561597382656
cache appears valid but isn't 561597382656
Clear free space cache v2
free space cache v2 cleared
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups skipped (not enabled on this FS)
found 644060905472 bytes used, no error found
total csum bytes: 628107456
total tree bytes: 878870528
total fs tree bytes: 100089856
total extent tree bytes: 27017216
btree space waste bytes: 143315147
file data blocks allocated: 647219642368
referenced 642754031616
And after the repair:
[onni@onskankone ~]$ sudo btrfs check /dev/nvme0n1p2
Opening filesystem to check...
Checking filesystem on /dev/nvme0n1p2
UUID: 84def4e1-7c6f-452d-8efd-deed0a5fe210
[1/7] checking root items
[2/7] checking extents
[3/7] checking free space tree
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups skipped (not enabled on this FS)
found 644070998016 bytes used, no error found
total csum bytes: 628107456
total tree bytes: 888963072
total fs tree bytes: 100089856
total extent tree bytes: 27017216
btree space waste bytes: 143367111
file data blocks allocated: 647219642368
referenced 642754031616
sudo btrfs check --clear-space-cache v2 /dev/sdX1
fixed the issue for me quicker than repair, and I think it's probably a safer command to run from looking at the btrfs documentation
I also get these errors for the space tree. I also have a shared Steam folder.
Could these issues be caused by EasyAntiCheat or some other anti-cheats?
Actually I get the feeling that installing Star Citizen via the "RSI Launcher" triggers the issue. I "banned" that thing from my System, I will see what happens... Also, it seems to use EasyAntiCheat ...
I did a new test:
- Installed StarCitizen's "RSI Launcher"
- did a scrub, all fine
- installed StarCitizen through the RSI Launcher
- did a scrub. BOOM, checksum errors in totally unrelated files...
Something is very wrong. I haven't tried many other games, but for Fortnite, just installing an update ALWAYS leads to a ton of corrupted files. Last time it was a 16GB update and 29 GB files had to be redownloaded. I tried setting NoCoW a while ago, seemingly that doesn't change anything.
Today, VALORANT's files were corrupted, when I tried to rename the game folder so the launcher verifies file integrity, it just vanished with a "folder does not exist" error. Correlation doesn't always mean causation but I didn't write anything else to the drive (no other game installs or updates).
I wouldn't be surprised if Fortnite had corrupted files after I reinstall Valorant.
I backed up one of the corrupted files before redownloading, that may or may not help.