It looks to me like your BTRFS file system is damaged. Probably not an actual hardware problem, just the file system itself.
Disclaimer: I am NOT an expert on repairing file systems, for all that I’ve been running Linux for years. I keep constant recent backups of my /home
hierarchy, so on the rare occasion that something like this happens and I can’t easily recover, I just reinstall the OS and copy my latest data backup back to the system, which immediately gets me 95% of the way back to productive. Haven’t actually had to do that for years, but I’m always prepared for it, from long experience.
With that out of the way: the first thing you should do is copy all of your important data to a backup drive. That probably just means your home directory, if the machine isn’t set up as a server (server programs often store data under /opt
or /etc
too). If you don’t have an up-to-date backup, create one NOW, before ANYTHING else – copy everything manually if you have to (look at the cp -r
command, it will copy the directory you point it to and everything below it). Make sure that you have any important hidden files and directories (whose names start with a period) as well. Double-check that any critical data files have copied correctly before moving on to the next step (md5sum
or sha1sum
makes that a lot easier), because you have to assume that any repair attempts could wipe out your drive’s contents.
Once you have a safe backup, and have dismounted the backup drive, you’re protected from any mistakes and you can try to fix your main drive. Actually fixing it will probably be either simple or impossible, there isn’t much in between. The btrfs-check program will try to identify the problems, and might be able to fix it (talk to an expert, which again I am not). If so, great – you’re in business again!
If not, the only answer may be to reformat the drive and reinstall the OS and your data. Annoying, but if you have all of your data backed up, that’s all it is – annoying, not disastrous. It usually takes me a couple hours to reinstall everything, as opposed to a couple days when I was running Windows as my main OS.
If, after you reinstall everything, the drive suddenly throws you into this state again, you might have a physical SSD problem that requires replacement. Unlikely, but it’s not impossible.
The only other thing I can do is wish you luck. Feel free to ask if get stuck somewhere.