NixOS partition corrupted

Same issue happened 1-2 years ago. I have triple boot system with windows, arch and nixos. I install nixos and use it no problem for few days or a week, I switch between all systems daily but then suddenly nixos partition goes blank, no info about it, bootloader cant load it, cant mount it. What I did before this happened I deleted bunch of files in my windows installation and then did optimize/defrag C disk.

Nixos partition /dev/sdb6 30gb size


I tried to analyze with testdisk tool but it couldnt find anything. I tried creating linux ext4 partition defined sectors of it but still nothing works.

Arch and windows still work just fine. I have been working on my dotfiles for days and didnt put them into git repo yet since I wanted to have system with all apps I need before doing backups. Atleast I would like to access and save my configuration files.

Do I lose my nixos yet again? Why this happens? I didnt touch/resize any partitions since nixos installation

Oh really weird. I’m not an expert, but to recover the data I would try to run photorec or a similar program to see if it can recover the files. And I’d also backup all the other files on the computer as your hard drive might be dying.

To explain the issue… my best guess is that some sectors of your HDD are dying, probably next to the beginning of the nix partition which would explain why it is repeatedly dying (or a virus on Windows is having some fun ^^). I would use some tools like smartctl to check the status of your drive.

Are you using ext4 or a more involved file system?