Fixed it.
- Boot with a NixOS live USB
- Enter Terminal
- First, check if the NVMe drive has any partitions:
sudo fdisk -l /dev/nvme0n1 - Try to recover the partition table using testdisk:
sudo nix-shell -p testdisk
sudo testdisk /dev/nvme0n1 - If you can see the partitions but can’t mount them, try checking the filesystems:
# For ext4 partitions
sudo fsck -f /dev/nvme0n1px# Replace x with partition number - If you still can’t access the partition, try repairing the GPT table first:
sudo gdisk /dev/nvme0n1
Typerfor recovery/transformation menu
Typebto rebuild the GPT table from backup
Typewto write changes and exit - After fixing the GPT table, try mounting again:
sudo mkdir -p /mnt
sudo mount /dev/nvme0n1x /mnt