I originally posted this issue on the KDE forum (link), and I was advised to seek help here, as TestDisk might be useful in recovering my data.
I had a dual boot setup with Windows 10 and Linux KDE Neon 5, where GRUB was installed on the old KDE partition (/dev/nvme0n1p4) and used to boot all my OSes.
A few months ago, KDE Neon 5 became outdated and could no longer be updated properly, so I installed KDE Neon 6 on a new partition while keeping the old KDE Neon 5.
However, I never reconfigured GRUB, so I continued using the GRUB from the old KDE installation to boot both my new KDE Neon 6 and Windows 10.
Even though I stopped using KDE Neon 5 as my main OS, I kept it because it still contained important files that I hadn’t fully migrated yet.
What caused the problem
I initially tried to run my Windows 10 installation inside a VM using KVM/Passthrough, but I couldn’t get it to work properly.
Since that failed, I thought about installing Windows 11 on a new partition instead.
To do that, I decided to shrink the partition of my old KDE (nvme0n1p4) using GParted to free up space for the new installation.
Steps taken:
- Booted into RescueZilla (Live USB)
- Launched GParted and started resizing nvme0n1p4
- GParted crashed during the process, and the partition became corrupted
Since then, the partition /dev/nvme0n1p4 is inaccessible, and because GRUB was installed on that partition, I could no longer boot into Linux—the PC booted directly into Windows 10.
By selecting my KDE Neon 6 installation from the boot menu, I ended up in a minimal GRUB shell.
I managed to manually boot into KDE Neon 6 using GRUB commands, and once inside my Linux system, I reinstalled GRUB properly for KDE Neon 6 so that I could boot normally again.
Current Situation
- /dev/nvme0n1p4 is still detected by GParted and TestDisk
- Total partition size and used space are displayed correctly
- An unallocated space appears, matching the amount I attempted to shrink before the crash
- Some areas of the file system are readable, but others still show I/O errors
- fsck and e2fsck fixed some errors but not all
- GRUB for KDE Neon 6 has been reinstalled and is now working
Recovery Attempts So Far
1. Checking the partition in GParted (from RescueZilla)
From RescueZilla, I opened GParted to inspect the partition status:
- The partition /dev/nvme0n1p4 is still detected
- The total partition size and used space are correctly displayed
- There is unallocated space, which matches the amount I attempted to shrink before the crash
2. Repair attempts with fsck and e2fsck
First attempt with fsck:
Code: Select all
sudo fsck /dev/nvme0n1p4
- It detected a massive number of errors and asked for manual confirmation ("o") to fix each one.
- I pressed "o" repeatedly, but there were still many more errors left to fix.
Attempt with e2fsck (automatic mode):
Code: Select all
sudo e2fsck -y /dev/nvme0n1p4
- It automatically fixed many errors without requiring manual confirmation.
- However, some critical errors remained unresolved.
Another attempt with different parameters:
Code: Select all
sudo e2fsck -f -y /dev/nvme0n1p4
- Some errors were fixed, but others persisted, including corrupted inodes, unreadable blocks, and file system inconsistencies.
Example errors encountered:
Code: Select all
Inode 102614 has an invalid checksum.
Fix? yes
Inode 203487 is in use, but has dtime set.
Fix? yes
Some issues were resolved, but not all.
3. Attempt with TestDisk
I then tried TestDisk to see if I could recover the partition:
Code: Select all
sudo testdisk
- It detected the /dev/nvme0n1p4 partition
- It reported corrupted blocks and overlapping file system structures
- It suggested rebuilding the partition table, but I wasn’t sure about the correct approach
- A deep scan correctly identified the partition with the right size, but I wasn’t sure which recovery option to choose safely.
4. Using find-overlap.py and dd to recover the partition
I found a script on GitHub that helps identify corrupted areas in a partition after a failed resize operation:
GitHub - find-overlap.py
The script generated several dd commands to attempt recovery.
Example of the generated commands and their execution:
First dd command (successful copy of 179GB):
Code: Select all
sudo dd if=/dev/nvme0n1p4 bs=1048576 count=171032 of=/dev/nvme0n1p4
Second dd command (I/O error while copying 140GB):
Code: Select all
sudo dd if=/dev/nvme0n1p4 bs=1048576 skip=171039 seek=171032 of=/dev/nvme0n1p4
Result:
Code: Select all
dd: error reading '/dev/nvme0n1p4': Input/output error
Some areas were restored, but others remain corrupted.
What I Need Help With
- Can TestDisk help restore this partition safely? If so, what’s the best method for this specific case?
- Should I retry some dd commands or use ddrescue instead to recover the remaining corrupted areas?
- Are there any other tools or approaches I could use to retrieve the existing files from the partition?
- Could the corruption of this partition pose a risk to my other partitions? (I want to make sure nothing else is affected.)
I know that ideally, I should have worked on a cloned drive, but unfortunately, I didn’t have another large enough disk available at the time.
I’ve learned my lesson, and in the future, I’ll make sure to always work on a backup first.
That said, any help to recover as much data as possible from this partition would be greatly appreciated.
Thanks in advance for any help.
