The disk name is /dev/sdd and the partition table was as it follows:
|Number of sectors
|Kingston (Data partition)
|Old Ubuntu Root
* This value is no longer showing but I remember that my home was about 20-30GiB.
I needed to increase the size of /dev/sdd2 because that's where I store my steam library. I figured out I could reduce my swap partition because I was no longer using hibernation, and the old ubuntu root had like 20Gb of free space, so I performed these steps from the Kde Partition Manager booting from a USB Stick with Kubuntu:
Shrink partition '/dev/sdd4' from 20.58GiB to 4.53GiB (This was actually done before going to the USB Live Image, I turned off the swap with swapoff and then shrank the partition, then I could not continue shrinking things because I was in the same system that I wanted to change).
Move partition '/dev/sdd6' to the right by 16.05GiB
Move partition '/dev/sdd7' to the right by 16.05GiB
Move partition '/dev/sdd5' to the right by 16.05GiB
Grow partition '/dev/sdd2' from 270.63GiB to 286.68GiB
Shrink partition '/dev/sdd7' from 49.71GiB to 23.16GiB
Move partition '/dev/sdd7' to the right by 26.56GiB
Move partition '/dev/sdd5' to the right by 26.56GiB
Grow partition '/dev/sdd2' from 286.68GiB to 313.24GiB
And after waiting several minutes, I look at the result and It said they were errors in the last operations (I don't remember which exactly but I think that the first half had no errors and some of the last had errors, sadly I have no record of this log).
But the result was the loss of the entire /dev/sdd6 filesystem (my /home directory). This is a photo of the partition table after the operation:
It seems that the swap did shrink but the unallocated space remained in its original location. The other partitions are still accesible and with normal data (The data ntfs partition and the two root partitions).
But for some reason, the /home partition is now marked as "unknown" and I can't mount it/change filesystem to ext4/do anything.
AT THIS POINT, I MADE A BACKUP (.img file) USING DD, just in case.
When I tried to boot to my regular Kubuntu (GRUB worked fine), I landed on just a terminal with "emergency mode" and with the "root" user.
I tried to run 'fsck' and got:
root@pc:~# fsck /dev/sdd6
fsck from util-linux 2.37.2
e2fsck 1.46.5 (30-Dec-2021)
ext2fs_open2: Bad magic number in super-block
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/sdd6
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
e2fsck -b 32768 <device>
Then, after a little google, I ran the following:
root@pc:~# mke2fs -n /dev/sdd6
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 16149504 4k blocks and 4038656 inodes
Filesystem UUID: 54d63d54-bc82-4017-96a0-012e76d54fc1
Superblocks backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424
And then I tried to run 'fsck' again but with those superblocks with the -b option. Nothing.
Is there anything I can do? Windows 10 (which is in another disk and working fine) detects the partition with the photorec tool and it lets me recover files but it's just a bunch of txt/png/wav/etc... files with no directory structure and it's not useful for me.
I did not have much of important 'regular' files in the partition (like photos, pdf, videos or audios), but a lot of configuration files, history files of bash, preferences of applications, etc...
And regarding testdisk, it detects something really weird when it does the scan (I will upload the photo later but it's something like two very identical /dev/sdd2 partitions at the beginning, but with different start/end sectors) and when I write the new partition table that it suggests, the /home is still unaccesible.
Anything to try? Can I recover my Kubuntu installation using the untouched Root partition and using another partition or disk to mount an empty /home? Or should I install everything from scratch? Beyond of that, I would still like to recover my /dev/sdd6 partition as it was before this happened.