[GLLUG] How to repair an unallocated hard drive?

Mark Preston mark at markpreston.co.uk
Fri Jan 1 22:53:53 UTC 2021

On 01/01/21 14:40, John Edwards wrote:
> Hi
> On Fri, Jan 01, 2021 at 01:01:11AM +0000, Mark Preston via GLLUG wrote:
>> I was trying to create a bootable persistent Linux Mint 20 USB stick with
>> EFI support from a linux mint20 .iso downloaded from the internet. but
>> something went wrong and...now I get an unallocated hard drive message.
>> I would like to know how to repair / fix an unallocated hard drive, if
>> possible, preferably without losing the data on it.
> Most obvious question would be "do you have backups"?
> I will assume for the moment the answer is "no".
> <snip>
>> Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
>> Disk model: ST2000DX001-1CM1
>> Units: sectors of 1 * 512 = 512 bytes
>> Sector size (logical/physical): 512 bytes / 4096 bytes
>> I/O size (minimum/optimal): 4096 bytes / 4096 bytes
>> Disklabel type: gpt
>> Disk identifier: 855C35AB-DF58-4AD0-A242-58BC6E6BD581
> Looks like something has deleted the GPT partition tables on your 2TB
> hard drive.
> <snip>
>> knoppix at Microknoppix:~$ fsck -y /dev/sda
> <snip>
> You should not run fsck on a drive device ("sda") but instead run it
> on the partition that holds the filesystem, but in this case you can't
> because the partition information has been removed from the drive.
> You need to get that partiton layout information back before doing any
> more work on the drive. If you have backups that contain information
> about the partitions on that drive (eg a hardware report from
> something like 'lshw') then you can us that.
> Otherwise you will need to use a hard drive utility to scan the whole
> hard drive looking for possible partitions and filesystems, and then
> choose whichever layout seems to look right to you.
> The main tool I have used for this in the past is 'testdisk', which is
> available as a Debian and Ubuntu package (and can be installed if you
> boot from a Live Debian or Ubuntu CD/DVD) and might already be on that
> Knoppix DVD. There might be better tools developed more recently.
> If you have no backups and have a spare 2TB drive then you may want to
> consider making a complete copy of the whole disk (using something
> like 'dd' or 'clonezilla') and run 'testdisk' on the new drive so that
> you don't damage any data on the original.
> Lastly it might worth thinking about how the partition table got
> removed. This could be a fault with the hard drive (unlikely because
> there should be 2 GPT partition tables, but run a full SMART test as
> soon as possible to be safe) or it might be that the wrong device was
> choosen when you tried to create the bootable USB stick.

On 01/01/21 16:14, Chris Bell via GLLUG wrote:
> Hello Mark
> Knoppix appears to show sda as a 2TB disk partitioned using GPT which will
> install a GPT partition immediately after the space normally used by the DOS
> MBR to provide more space for information about multiple main partitions, not
> just the maximum of 4 physical partitions in the old MS-DOS. Most computers
> search for the MBR, so it is used to re-direct the BIOS to the GPT partition.
> The main boot sequence is then controlled from the GPT partition, and none of
> the other partitions will be labelled as bootable.
>   I often see some unallocated space at either end of the disc space, usually
> less than 1 sector, but most of sda appears to be a single partition, possibly
> using a swap file instead of a swap partition.
> Perhaps the disc was re-partitioned as a GPT disc, which would overwrite the
> original MS-DOS system, but then just left not further partitioned or
> formatted.
> There appears to be more information about sdb and its partitions without
> mention of corruption.
> If sda is corrupted do not try to alter it. There was a package "photorec"
> designed to recover deleted photos which was later enhanced to recover almost
> anything and may be re-named "testdisk". It is not a quick and easy recovery,
> but can examine, list, recover, and copy as many directories and files as
> possible to another formatted disc.

Hi John and Chris,
Thank you for your further replies. They are helping me to develop a 
recovery plan.
I have a full backup of the home directory from the end of October which 
I expect will contain nearly all the files I need. I installed the HMRC 
Paye Basic Tools system and this is one of my concerns, but it won't be 
the end of the world. This is a 32 bit program for Linux, but I got it 
working on this 64 bit machine which I was quite pleased about. Whether 
I can repeat that trick I'm not sure. I think you're right that the 
Linux Mint 20 install removed the partitions, but I never installed this 
on the hard drive, so hopefully most of the previous files are still 
there somewhere. The computer never had any Windows operating system 
installed as far as know. It's about time I got a new PC. I think I'll 
change the hard drive and put Linux Mint 20 on the new drive and copy 
the existing 2TB disk using GNU ddrescue to an external hard drive 
before removing it and the copy for further analysis with programs like 
testdisk. Maybe eventually it can be repartitioned and rebooted 

More information about the GLLUG mailing list