Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
4 TB GPT Drive now thinks it is 2TB MBR
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
grooveman
Veteran
Veteran


Joined: 24 Feb 2003
Posts: 1166

PostPosted: Thu Jul 30, 2015 12:17 pm    Post subject: 4 TB GPT Drive now thinks it is 2TB MBR Reply with quote

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
_________________
To look without without looking within is like looking without without looking at all.
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2968
Location: Germany

PostPosted: Thu Jul 30, 2015 12:26 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
grooveman
Veteran
Veteran


Joined: 24 Feb 2003
Posts: 1166

PostPosted: Thu Jul 30, 2015 1:32 pm    Post subject: Reply with quote

But won't that zap my data?
_________________
To look without without looking within is like looking without without looking at all.
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2968
Location: Germany

PostPosted: Thu Jul 30, 2015 1:39 pm    Post subject: Reply with quote

> with any partitioning software of your choice.

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

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)


Code:
# 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.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42800
Location: 56N 3W

PostPosted: Thu Jul 30, 2015 6:39 pm    Post subject: Reply with quote

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.

Code:
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.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
grooveman
Veteran
Veteran


Joined: 24 Feb 2003
Posts: 1166

PostPosted: Fri Jul 31, 2015 12:54 pm    Post subject: Reply with quote

Thanks guys. Good to see you again, Neddy.

Ok, so I issue

gdisk -l /dev/sdc, and get:
Code:
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
_________________
To look without without looking within is like looking without without looking at all.
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2968
Location: Germany

PostPosted: Fri Jul 31, 2015 12:57 pm    Post subject: Reply with quote

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=)
Back to top
View user's profile Send private message
s4e8
Guru
Guru


Joined: 29 Jul 2006
Posts: 309

PostPosted: Fri Jul 31, 2015 1:14 pm    Post subject: Reply with quote

Your disk use standard MS partition layout: 128Mib MSR at 1Mib, and NTFS partition at 129Mib. You should recreate the partitition at 129Mib.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42800
Location: 56N 3W

PostPosted: Fri Jul 31, 2015 6:21 pm    Post subject: Reply with quote

grooveman,

Code:
***************************************************************
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.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
grooveman
Veteran
Veteran


Joined: 24 Feb 2003
Posts: 1166

PostPosted: Mon Aug 03, 2015 1:29 pm    Post subject: Reply with quote

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! :D

Thanks for your help!
_________________
To look without without looking within is like looking without without looking at all.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42800
Location: 56N 3W

PostPosted: Mon Aug 03, 2015 4:41 pm    Post subject: Reply with quote

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.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum