How to recover a /home partition marked as unallocated


OK, new motherboard, old drive, /home marked / identified as ‘unallocated’ space in GParted! Scratched head and remembered reading somewhere that Gparted comes with Test Disk (this might be the live version, not sure) so I began looking at the options. Before going any further you may well need a live version of GParted if you don’t have another drive with another GNU/Linux installed on it. The scenario I am sharing is a drive with an OS which has GParted installed, but I discovered when first attempting to check for filesystems on the drive affected there was a package missing, ‘gpart’ - you may need to install this. I did it through the terminal:

sudo apt-get install gpart

My GParted layout of the disk concerned was:

sda1 - ‘/’ root partition
sda2 - ‘unallocated’ (actually ‘/home’ - so potentially a partition table error/something else/failing drive.)
sda3 - ntfs data share partition - I also backed this up - just in case - using the data recovery through GParted.

Next we go to the ‘Device’ heading in the menu bar of GParted and select ‘Attempt Data Rescue …’

You will receive a message which states:

Search for filesystems on /dev/sda
A full disk scan is needed to find filesystems.
The scan might take a very long time.
After the scan, you can mount any discovered filesystems and copy the data to other media.
Do you want to continue?

Click ‘OK’.

For me it was very quick because of the new rig (Ryzen 7 with 16 Gb RAM)
In this scenario, you cannot view the ‘root’ filesystem as it is protected file system being ‘root’ and we need to recover the ‘/home’ partition which in this example was #2.

I then simply dragged the ‘swarfendor437’ folder onto my external drive so I am now safe in the knowledge I can reinstall the affected OS and to play extra safe, file system #3 was the NTFS system partition I created for Data Sharing I created a tutorial video for before installing any GNU/Linux so you can access both from GNU/Linux and your Windows machines (or smartphone using Obmin).