# 4 TB GPT Drive now thinks it is 2TB MBR

## grooveman

Hello.

We have a 4tb drive that was used to back up a bunch of data.  The other day I went to look at it to restore some data, but Windows was not detecting it (It is NTFS formatted).  So I tried under Gentoo Linux, and it couldn't properly mount it either.  The partition table was pretty botched.  I had a lot of trouble with it, but eventually using TestDisk, I seemed to fix it... the only problem is that now it thinks it is MBR and only 2TB.  

I probably did something wrong, but it absolutely wouldn't detect anything on the drive under the "EFI GPT" option.  I couldn't use "Advanced", because it wouldn't recognize the disk.  Using the "Intel" option, however seemed to work...  but now It is showing as MBR and being only 2TB.

I'm wondering if there is a safe way to blow away the partition table and rebuild it as GPT without damaging the data... but I'm not really finding a lot of information on this.  I get TON of results on a google search for this, but nothing that seems to leave the data intact while converting to GPT, and nothing that seems to address doing this and re-claiming the "missing" 2TB.

Any suggestions?

Thanks for the help.

G

----------

## frostschutz

Is it a single big partition on the disk? Do you know the starting offset?

file -s /dev/sdx1 says "blah blah filesystem" instead of just "data"?

parted /dev/sdx unit s print free?

if you have the correct starting offset and the offset is not < sector 64, you should be able to make just one big gpt partition (using that offset) with any partitioning software of your choice.

----------

## grooveman

But won't that zap my data?

----------

## frostschutz

> with any partitioning software of your choice.

... that doesn't format the partition it just created   :Rolling Eyes: 

Formatting would zap your data, creating a partition is fine if such a partition existed before. Sometimes people use disks without any partitions, in that case the partition table (which too has to be stored somewhere) would overwrite parts of the filesystem.

If you're looking for an alternative to get at your data w/o creating partitions: use a loop device. For this, too, you must know the exact starting offset (or find out by trial and error)

```
# losetup --find --show --read-only --offset=$((512*2048)) /dev/sdx

/dev/loop2

# mount -o ro /dev/loop2 /mnt/somewhere

# ls -al /mnt/somewhere
```

If that mounts you can backup your files to another disk.

----------

## NeddySeagoon

grooveman,

When you use GPT, you get a free 'protective' MSDOS partition table too.

On a drive larger that 2TBi, like yours, the MSDOS partition table entry only covers the first 2TBi.

This partition table is only there to warn you aboung the GPT table.

If you try to use the drive on a non GPT aware system, it will try to use the MSDOS table and either the filesysem will not be found, or you will get errors about the filesystem being too big for the partition.  In either case, your data is not harmed. 

Yau can use the loop device as frostschutz suggested but the mount command will work directly too.

```
mount -o ro,offset=$((512*2048)) /dev/sdx /mnt/someplace
```

I'm not sure if you need to do the arithmetic for yourself if you use mount directly.

----------

## grooveman

Thanks guys.  Good to see you again, Neddy.

Ok, so I issue

gdisk -l /dev/sdc, and get:

```
GPT fdisk (gdisk) version 0.8.10

Partition table scan:

  MBR: MBR only

  BSD: not present

  APM: not present

  GPT: not present

***************************************************************

Found invalid GPT and valid MBR; converting MBR to GPT format

in memory. 

***************************************************************

Disk /dev/sdc: 7814037168 sectors, 3.6 TiB

Logical sector size: 512 bytes

Disk identifier (GUID): D4768C6F-C8BE-49A8-A58F-429471F36421

Partition table holds up to 128 entries

First usable sector is 34, last usable sector is 7814037134

Partitions will be aligned on 2048-sector boundaries

Total free space is 3519069806 sectors (1.6 TiB)

Number  Start (sector)    End (sector)  Size       Code  Name

   1          264192      4295231486   2.0 TiB     0700  Microsoft basic data

```

So I issue:  mount -o ro,offset=$((264192*512)) /dev/sdc /mnt/misc

Which does work, but the problem is, it still only sees 2TB... so it must be using the mbr information... the output of gdisk doesn't even seem to acknowledge it as gpt...  Is there something I can do to force this?

Or should I blow away the partition table with the O option of gdisk, and create a new one? ... which I'v never done before... so if I did that, i would be most appreciative of a little assistance with syntax using the information above.  I apologize if my questions seem stupid, but I'm pretty new to this.

Thanks.

G

----------

## frostschutz

losetup does not care about partitioning at all, if it says 2TB after the mount then that is what the filesystem believes (probably it was fsck while on a 2TB partition and it was "fixed" to that size?)

You can verify the size of the loop device with blockdev --getsize64 /dev/loopX (there is a loop device even if you used mount -o ro,loop,offset=)

----------

## s4e8

Your disk use standard MS partition layout: 128Mib MSR at 1Mib, and NTFS partition at 129Mib. You should recreate the partitition at 129Mib.

----------

## NeddySeagoon

grooveman,

```
***************************************************************

Found invalid GPT and valid MBR; converting MBR to GPT format

in memory.

*************************************************************** 
```

Regardless of the original GPT, the new GPT was arrived at by converting tho MSDOS 2Tb protective partition table entry to GPT.

Don't read too much into the partition table.  It only points at your data.

It mounting with offset= works but attempting to nount the partition fails, the error message will be very useful.

The offset= version ignores your partition table

The normal mount of the partition will fail if the filesystem size is larger that the partition that holds it.

You may yet have a 4Tb filesystem on a 2Tb partition.  Don't even think of allocating the free space indicated by the partiton table.

----------

## grooveman

Ah yes, I do see that.

After mounting, a 'df -Th' shows me that the partition table is 2TB, but changing to that directory and issuing a 'du -sh' shows the full 3.7TB.  Thanks.  Now I just need to acquire something to dump it to, and I think I should be set!    :Very Happy: 

Thanks for your help!

----------

## NeddySeagoon

grooveman,

Deleting the GPT partition then creating it with the correct start and end points is harmless to your data.

Of course, a backup is always a good idea.

----------

