# GPT 4TB not recognized

## bastibasti

Hi,

Iam trying to use a GPT partitioned HDD. The HDD has been partitioned using gentoo on another box. 

However now I get unknown partition table, but fdisk seems to recognize the table

Is there any kernel option I forgot?? Is it an issue that the system is 32bit?

```

sd 13:0:0:0: Attached scsi generic sg3 type 0

[10701549.279594] sd 13:0:0:0: [sdd] 976754646 4096-byte logical blocks: (4.00 TB/3.63 TiB)

[10701549.280092] sd 13:0:0:0: [sdd] Write Protect is off

[10701549.280097] sd 13:0:0:0: [sdd] Mode Sense: 03 00 00 00

[10701549.280605] sd 13:0:0:0: [sdd] No Caching mode page found

[10701549.280609] sd 13:0:0:0: [sdd] Assuming drive cache: write through

[10701549.284718] sd 13:0:0:0: [sdd] 976754646 4096-byte logical blocks: (4.00 TB/3.63 TiB)

[10701549.287226] sd 13:0:0:0: [sdd] No Caching mode page found

[10701549.287230] sd 13:0:0:0: [sdd] Assuming drive cache: write through

[10701549.297637]  sdd: unknown partition table

[10701549.305600] sd 13:0:0:0: [sdd] 976754646 4096-byte logical blocks: (4.00 TB/3.63 TiB)

[10701549.306591] sd 13:0:0:0: [sdd] No Caching mode page found

[10701549.306595] sd 13:0:0:0: [sdd] Assuming drive cache: write through

[10701549.306600] sd 13:0:0:0: [sdd] Attached SCSI disk

```

```

server ~ # LANG="en" fdisk /dev/sdd

Welcome to fdisk (util-linux 2.25.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Command (m for help): p

Disk /dev/sdd: 3.7 TiB, 4000787030016 bytes, 976754646 sectors

Units: sectors of 1 * 4096 = 4096 bytes

Sector size (logical/physical): 4096 bytes / 4096 bytes

I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disklabel type: dos

Disk identifier: 0x00000000

Device     Boot Start        End    Sectors Size Id Type

/dev/sdd1           1 4294967295 4294967295  16T ee GPT

Command (m for help): 

```

----------

## frostschutz

Missing GPT support in the kernel?

CONFIG_EFI_PARTITION=y

Another issue is sector size, if the disk is an external enclosure... 4k vs. 512 byte sector disks are incompatible to each other. (Linux could support it either way but for some reason it does not)

----------

## bastibasti

The sector size is determined by the usb/sata bridge? what a bummer.. I thought they would only kinda forward the data.

----------

## VoidMage

Also, if the disk is GPT-partitioned, you probably want sys-apps/gptfdisk.

----------

## bastibasti

kernel option seems to be OK

```

7736-CONFIG_SGI_PARTITION=y

7759-CONFIG_ULTRIX_PARTITION=y

7785-CONFIG_SUN_PARTITION=y

7808-CONFIG_KARMA_PARTITION=y

[b]7833:CONFIG_EFI_PARTITION=y[/b]

7856-CONFIG_SYSV68_PARTITION=y

7882-# CONFIG_CMDLINE_PARTITION is not set

```

this means that the issue is probably the wrong sector size. oh man this means I need a second machine to copy my data from a to b

(there is a 2x3tb soft-raid that needs copying onto a 2x4tb soft-raid), then the HDDs will be exchanged.

----------

## s4e8

If you put an internal disk into USB enclosure, and the enclosure change sector size from 512 to 4K, the partition will corrupt and unfixable.

With 4K sector size, you don't need GPT label, traditional dos label support up to 16T w/ 4K sectorsize.

----------

## NeddySeagoon

bastibasti,

A few things,  first,

```
Disk /dev/sdd: 3.7 TiB, 4000787030016 bytes, 976754646 sectors

Units: sectors of 1 * 4096 = 4096 bytes

Sector size (logical/physical): 4096 bytes / 4096 bytes

I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disklabel type: dos

Disk identifier: 0x00000000

Device     Boot Start        End    Sectors Size Id Type

/dev/sdd1           1 4294967295 4294967295  16T ee GPT 
```

shows the 'protective MSDOS partition table you get for free with a GPT disklabel.

Thats not the real GPT partition table.

Notice  Disk /dev/sdd: 3.7 TiB and the 16T partition size.

Try parted to show the real partition table.

```
CONFIG_EFI_PARTITION=y
```

is correct for GPT.  Are you sure that you are running the kernel that belongs to that config? 

You are making hard work of extending your raid.  If its mdadm raid1, you can replace the drives in turn.  its not quite that simple but I will explain in more detail if that is what you want to accomplish.

----------

## bastibasti

 *Quote:*   

> 
> 
> With 4K sector size, you don't need GPT label, traditional dos label support up to 16T w/ 4K sectorsize.
> 
> 

 

well thats it then. When I created the partitions (using internal sata) fdisk complained that I MUST use GPT - if the USB now shows a setor size where its not neccessary the sector size differs....

I will put one of the hdds on an internal sata controller and recheck it - in that case I will do the safe way and use a second pc. 

 *Quote:*   

> 
> 
> Are you sure that you are running the kernel that belongs to that config? 
> 
> 

 

quite sure. I guess there's no way of telling. The config was in /boot - as I always use make install  I assumed it would be the correct one. But I can also be wrong of course. Before restarting the machine without backup (and loading a newer kernel that defenetly has this option enabled) I will rather retry the disk in another machine...  :Wink: 

----------

## s4e8

Using loopdev would revert sector size to 512.  So add "loop.max_part=15" to kernel parameters or "modprobe loop max_part=15", then  "losetup -f /dev/sdd".

[quote="bastibasti"] *Quote:*   

> 
> 
> well thats it then. When I created the partitions (using internal sata) fdisk complained that I MUST use GPT - if the USB now shows a setor size where its not neccessary the sector size differs....
> 
> I will put one of the hdds on an internal sata controller and recheck it - in that case I will do the safe way and use a second pc. 
> ...

 

----------

## VoidMage

 *bastibasti wrote:*   

>  *Quote:*   
> 
> Are you sure that you are running the kernel that belongs to that config? 
> 
>  
> ...

 

...I'd say 'less /proc/config.gz' is pretty conclusive unless you've worked hard to fake it.

----------

## bastibasti

Wow

learned 5 new thing of one single issue. Thats pretty cool.

Kernel is not the issue - so I guess the loop thing will be my next candidate to give a try

Thank you all for assisting so cool. I will try it when I get home from work tonight...   :Very Happy: 

----------

## bastibasti

Thats crazy!Thanks!

I setup the drive by using

losetup -f /dev/sdd

then I

partprobe /dev/loop0 

and mdadm was able to detect the raid.

Is this safe to use?

----------

## frostschutz

 *bastibasti wrote:*   

> Is this safe to use?

 

Not in the long term. But as long as your partitions are aligned and not off-by-512 you can just re-create the partition table for the 4K side of things.

I.e. check `parted /dev/loop0 unit b print` of offsets and sizes in bytes.

and then create those same partitions on /dev/sdx.

This could be supported directly by Linux. It should ignore the sector size the disk reports and just look at GPT header with offset 512 or 4096 bytes and use that accordingly. But alas, we have this situation instead where a simple change of enclosure can render the disk unusabel.

----------

## s4e8

If filesystem hard reference sector# (eg: FAT & NTFS) or fs blocksize less than 4K, or RAID metadata not 4K aligined, re-create method doesnit work. And some circumstance, larger sectorsize use more metadata, you can't re-create partition at same position and size.

 *frostschutz wrote:*   

>  *bastibasti wrote:*   Is this safe to use? 
> 
> Not in the long term. But as long as your partitions are aligned and not off-by-512 you can just re-create the partition table for the 4K side of things.
> 
> I.e. check `parted /dev/loop0 unit b print` of offsets and sizes in bytes.
> ...

 

----------

