Partition corruption after resizing with GParted – Need help recovering my Linux KDE Neon (nvme0n1p4)
Initial context:
I had a dual boot setup with Windows 10 and Linux KDE Neon 5, where GRUB was installed on the old KDE partition (nvme0n1p4) and used to boot all my OSes.
A few months ago, KDE Neon 5 became outdated and couldn’t be updated properly anymore, 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.
The old KDE (Neon 5) was no longer my main OS, but I kept it because it contained important files that I hadn’t fully migrated yet.
What caused the problem:
I initially tried to run my Windows 10 installation in a VM using KVM/Passthrough, but I couldn’t get it to work properly.
So 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.
- I booted into RescueZilla (Live USB)
- I 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 since GRUB was installed on that partition, I could no longer boot into any Linux system, and my PC would boot directly into Windows 10.
By selecting my KDE Neon 6 installation from the boot menu, I ended up in a minimal GRUB shell.
I was able 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.
Attempts to recover the corrupted partition:
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 an unallocated space that matches the amount I tried to shrink before the crash
I’m attaching a screenshot of GParted showing these details.
2. Repair attempts with fsck and e2fsck
First attempt with fsck:
sudo fsck /dev/nvme0n1p4
➜ Result: 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):
sudo e2fsck -y /dev/nvme0n1p4
➜ Result: It automatically fixed many errors without requiring manual confirmation.
However, some critical errors remained unresolved.
Another attempt with different parameters:
sudo e2fsck -f -y /dev/nvme0n1p4
➜ Result: Some errors were fixed, but others persisted, including corrupted inodes, unreadable blocks, and file system inconsistencies.
Example errors encountered:
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.
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
- I ran a deep scan, and it 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 link to find-overlap.py
The script generated several dd
commands to attempt a recovery.
Example of the generated commands and their execution:
sudo dd if=/dev/nvme0n1p4 bs=1048576 count=171032 of=/dev/nvme0n1p4
This command successfully copied about 179 GB without errors.
sudo dd if=/dev/nvme0n1p4 bs=1048576 skip=171039 seek=171032 of=/dev/nvme0n1p4
This command returned an error:
dd: error reading '/dev/nvme0n1p4': Input/output error
Despite the error, 140 GB were copied.
Other similar dd
commands successfully restored some areas, but some regions still have errors.
Current situation and questions:
-
Current state of /dev/nvme0n1p4:
- The partition is still detected by GParted and TestDisk
- Some parts of the file system are readable, but others still show I/O errors
- fsck and e2fsck fixed some errors but not all
- The
dd
commands helped recover certain blocks, but some areas remain corrupted
-
GRUB issue:
- Due to this corruption, I lost the GRUB installed on the old KDE
- I was able to boot into my new KDE (Neon 6) via the GRUB shell and then properly reinstall GRUB for KDE Neon 6
What I need help with:
- How can I fully repair /dev/nvme0n1p4 and recover my old KDE Neon 5 without data loss?
- 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?
Thanks in advance for your help!