Problem mounting GPT partitioned USB Hard Drive

Hello all,

I’ve problems to mount my GPT partitioned USB Hard Drive. I’m using Suse Dartmouth 12.3. I can see the device in /dev/ but not the partitions on it. There are 4 partitions on it.

  • Boot Grub for GPT,
  • SWAP,
  • SYSTEM (ext4) mounted at /
  • and an additional for files mounted at /2ndDisk

I need to get the data from /2ndDisk (2,7 TB file space)

fdisk -l /dev/sdc shows me


fdisk -l /dev/sdc
Hinweis: Die Sektorgröße ist 4096 (nicht 512)

Disk /dev/sdc: 3000.6 GB, 3000592965632 bytes
255 Köpfe, 63 Sektoren/Spur, 45600 Zylinder, zusammen 732566642 Sektoren
Einheiten = Sektoren von 1 × 4096 = 4096 Bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Gerät  boot.     Anfang        Ende     Blöcke   Id  System
/dev/sdc1            2048     1028095     4104192   83  Linux
/dev/sdc2         1028096    11517951    41959424   82  Linux Swap / Solaris
/dev/sdc3   *    11517952    84920319   293609472   83  Linux
/dev/sdc4               1           1           4   ee  GPT

Partitionstabelleneinträge sind nicht in Platten-Reihenfolge

That’s the output from parted


# parted -l /dev/sdc
Model: ATA WDC WD30EZRX-00D (scsi)
Disk /dev/sda: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt_sync_mbr

Number  Start   End     Size    File system     Name     Flags
 1      1049kB  5964MB  5963MB                           bios_grub
 2      5965MB  12,0GB  5989MB  linux-swap(v1)
 3      12,0GB  53,8GB  41,8GB  ext4                     boot, legacy_boot
 4      53,8GB  3001GB  2947GB  ext4            primary


Error: /dev/sdc: unrecognised disk label                                  
Model: WDC WD30 EZRX-00DC0B0 (scsi)
Disk /dev/sdc: 3001GB
Sector size (logical/physical): 4096B/4096B
Partition Table: unknown

Warning: Unable to open /dev/sr0 read-write (Das Dateisystem ist nur lesbar).
/dev/sr0 has been opened read-only.
Error: Can't have a partition outside the disk!                           
Model: TSSTcorp CDDVDW TS-T633A (scsi)
Disk /dev/sr0: 4534MB
Sector size (logical/physical): 2048B/2048B
Partition Table: unknown



And another one:


# sfdisk -luS /dev/sdc 

Festplatte /dev/sdc: 364801 Zylinder, 255 Köpfe, 63 Sektoren/Spur
Einheit = Sektoren von 512 Bytes, Zählung beginnt bei 0

   Gerät  boot.   Anfang      Ende  #Sektoren Id  System
/dev/sdc1          2048   1028095    1026048  83  Linux
sfdisk:         Anfang: (c,h,s) erwartet (0,32,33) gefunden (1023,254,63)

sfdisk:         Ende: (c,h,s) erwartet (63,253,62) gefunden (1023,254,63)

/dev/sdc2       1028096  11517951   10489856  82  Linux Swap / Solaris
sfdisk:         Anfang: (c,h,s) erwartet (63,253,63) gefunden (1023,254,63)

sfdisk:         Ende: (c,h,s) erwartet (716,244,40) gefunden (1023,254,63)

/dev/sdc3   *  11517952  84920319   73402368  83  Linux
sfdisk:         Anfang: (c,h,s) erwartet (716,244,41) gefunden (1023,254,63)

/dev/sdc4             1         1          1  ee  GPT
sfdisk:         Anfang: (c,h,s) erwartet (0,0,2) gefunden (0,0,1)

sfdisk:         Ende: (c,h,s) erwartet (0,0,2) gefunden (1023,254,63)

When I try to mount my 2.7 TB partition - seems to be sdb3 with fdisk - I’m getting this:


# mount -t ext4 /dev/sdc3 /mnt/
mount: special device /dev/sdc3 does not exist

Please help me out. How can I mount the partitions?

Thank you!

Something seems wrong there.

If I have a USB device with GPT partitioning, then “fdisk -l” tells me that the disk uses gpt partitioning, and that I should use “parted”. I’m not seeing that in your “fdisk” output.


# fdisk -l /dev/sdf

WARNING: GPT (GUID Partition Table) detected on '/dev/sdf'! The util fdisk doesn't support GPT. Use GNU Parted.




Disk /dev/sdf: 8004 MB, 8004304896 bytes
64 heads, 32 sectors/track, 7633 cylinders, total 15633408 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x6cfdad04


   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1     9191423     4595711+  ee  GPT

I suggest you try “gdisk -l”. It might report problems with the gpt partitioning.

It’s only shown on the build in device. /dev/sda is build in - same partitions, only differs in size. I switched and switched back the USB with the internal one. But on any setup the fdisk -l says only for the build in HDD that I use parted. And as I can see there is no other warning.


# fdisk -l

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    11649171     5823562   83  Linux
/dev/sda2        11651072    23349247     5849088   82  Linux swap / Solaris
/dev/sda3   *    23349248   105070591    40860672   83  Linux
/dev/sda4               1           1           0+  ee  GPT
Partition 4 does not start on physical sector boundary.

Partition table entries are not in disk order
#Note: sector size is 4096 (not 512)

Disk /dev/sdc: 3000.6 GB, 3000592965632 bytes
255 heads, 63 sectors/track, 45600 cylinders, total 732566642 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
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     1028095     4104192   83  Linux
/dev/sdc2         1028096    11517951    41959424   82  Linux swap / Solaris
/dev/sdc3   *    11517952    84920319   293609472   83  Linux
/dev/sdc4               1           1           4   ee  GPT

Partition table entries are not in disk order



As you were already told - please show output of gdisk. Linux does not use partition numbers from protective MBR, but from GPT.

Also what devices are present (ls /dev/sdc*)?

Ah ok. With gdisk I get this result:


# gdisk -l /dev/sdc
GPT fdisk (gdisk) version 0.8.5

Partition table scan:
  MBR: hybrid
  BSD: not present
  APM: not present
  GPT: not present


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

Disk /dev/sdc: 732566642 sectors, 2.7 TiB
Logical sector size: 4096 bytes
Disk identifier (GUID): 0687EB0C-533B-4AD8-9F68-70C5E6118F4C
Partition table holds up to 128 entries
First usable sector is 6, last usable sector is 732566636
Partitions will be aligned on 256-sector boundaries
Total free space is 647648359 sectors (2.4 TiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         1028095   3.9 GiB     8300  Linux filesystem
   2         1028096        11517951   40.0 GiB    8200  Linux swap
   3        11517952        84920319   280.0 GiB   8300  Linux filesystem



For comparsion same for sda (bulid in device):


# gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.5

Partition table scan:
  MBR: hybrid
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with hybrid MBR; using GPT.
Disk /dev/sda: 5860533168 sectors, 2.7 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 6F285E2B-8DE5-4C0C-86D2-208E2804CA51
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 5860533134
Partitions will be aligned on 2048-sector boundaries
Total free space is 4825 sectors (2.4 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048        11649171   5.6 GiB     EF02
   2        11651072        23349247   5.6 GiB     8200
   3        23349248       105070591   39.0 GiB    EF00
   4       105070592      5860532223   2.7 TiB     0700  primary


And I only can see /dev/sdc without partitions:


# ls /dev/sdc*
/dev/sdc

What can I do to fix the invalid GPT on sdc?
Thanks!

Did it ever work? Under which operating system partition table was created? Can you access this disk on any other installation?

Could you please make available first 24K of disk?

dd if=/dev/sdc of=/tmp/sdc.part bs=4k count=6

and upload sdc.part somewhere?

Sure, here we go:
http://digitales-zimmer.de/sdc.part

Both HDD Drives, internal and external are brand new set up. It never worked. I tried to access the HDD from an ubuntu 11.10 now, but it seems to be the same problem.

One is partitioned with GParted under Knoppix 7.0. The second one (my external HDD) I used the suse installer for partitionating. At the start of the disk I let some free disk space for GPT and configured it to boot_grub. Suse set up finished with installing GRUB2. Maybe there went something wrong?!

Thanks for you help!

suse - it is openSUSE or SLES or SLED? Which version exactly? Do you mean that you booted from installation DVD and created partition table on this disk?

The more details you give, the more chances someone will be able to help.

Yes, exactly. I booted from openSuse installation DVD and created the partition table on this disk.

According to fdisk/gdisk, /dev/sdc has 4K blocks but GPT is created for 512B blocks. So it is correct, current GPT is invalid for this disk. If it was indeed installer, it would be major bug. But to prove it we would need to

a) zero out existing partition table (and there are two, one at the beginning and another at the end)
b) start installer again and use it to format drive
c) capture partition table after installer has created it
d) capture installation logs

I do not know if you are willing to go into all these troubles :slight_smile:

Otherwise just use gdisk to re-label disk, create new partition table and use it.

Sure, I can do it. Can you just please let me know how to do step a) and where I can find the installation log. Thanks.

Would be also interesting for myself to know if I did something wrong or it’s a bug.

To zero out both partition tables you could use


dd if=/dev/zero of=/dev/sdc bs=4k count=256
dd if=/dev/zero of=/dev/sdc bs=4k count=256 seek=732566386

It wipes out first and last 1M of disk.
Reboot and verify that you do not have any partition indeed. Then start installation. It would be helpful if you made screenshots of each step in disk partition tool. For such quick tests I usually select minimal text mode software pattern, it takes less than half an hour to install. After installation is completed, simply run save_y2logs to collect all available logs. And of course verify partition that you got.

Hello,

thanks for the instruction. I have tried two different ways again. But I can’t get it running. So this is what I’ve done (pictures in attached zip file):

With recommended partition table - first try folder in zip file:

  • zero out both existing partition table
  • created partition table with installer based on the recommended one. I reduced disk space on / and added my second partition on /2ndDisk also ext4
  • MBR is deactivated (07.jpg)
  • suse-firsttry.txt contains output of gdisk from the hdd as external USB drive
  • sda_first_try.txt contains output of gdisk from the same hdd as internal boot device — !!! :slight_smile: — ]

With own partition table - second try folder in zip file:

  • zero out both existing partition table
  • far as I know gpt needs some free disk space at the start of the disk, so I created once again a 50mb partiton marked as boot_grub (02.jpg)
  • I also created a 8GB swap, a 30GB system / and a 2,7TB partition /2ndDisk
  • MBR is deactivated (07.jpg)
  • suse_secondtry.txt contains output of gdisk from the hdd as external USB drive
  • sda_second_try.txt contains output of gdisk from the same hdd as internal boot device

save_y2logs and “dd if=/dev/sdc of=/tmp/sdc.part bs=4k count=6” output is also for each setup included.

Here you can get the collected information:
http://www.digitales-zimmer.de/gpt.zip

So that I understand - it means partition table is always shown as “invalid”, partitions are not detected? Right?

Could you please do the last test, which is easier to verify eventual fix. Under installed system zero out partition table and simply use “parted” to create new partitions, same size you did during installation. I expect it will be invalid as well. If yes, it gives easy step to a) reproduce and b) test fix.

So you need to tell more about what you did. When you show partitions you say about /dev/sdc, but your installation logs show single disk /dev/sda. So please explain step by step how you performed installation and how /dev/sda became /dev/sdc.

For installing I removed the main HDD as internal SATA device and build in the external HDD. After installation I connected the main HDD back to internal SATA and put the second one back to USB. This is the point where the second HDD getting from /dev/sdc or /dev/sdb.

So yesterday I tried to use parted as recommended from you:


# parted /dev/sdc
GNU Parted 2.4
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Error: /dev/sdc: unrecognised disk label
Model: WDC WD30 EZRX-00DC0B0 (scsi)
Disk /dev/sdc: 3001GB
Sector size (logical/physical): 4096B/4096B
Partition Table: unknown
(parted) mklabel gpt
(parted) print
Model: WDC WD30 EZRX-00DC0B0 (scsi)
Disk /dev/sdc: 3001GB
Sector size (logical/physical): 4096B/4096B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

(parted) mkpart primary 0MB 50MB
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? I
(parted) print
Model: WDC WD30 EZRX-00DC0B0 (scsi)
Disk /dev/sdc: 3001GB
Sector size (logical/physical): 4096B/4096B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      24.6kB  50.0MB  50.0MB               primary

(parted) mkpart primary 50MB 4GB
(parted) print
Model: WDC WD30 EZRX-00DC0B0 (scsi)
Disk /dev/sdc: 3001GB
Sector size (logical/physical): 4096B/4096B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      24.6kB  50.0MB  50.0MB               primary
 2      50.3MB  4000MB  3950MB               primary

(parted) mkpart primary 4GB 30GB
(parted) print
Model: WDC WD30 EZRX-00DC0B0 (scsi)
Disk /dev/sdc: 3001GB
Sector size (logical/physical): 4096B/4096B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      24.6kB  50.0MB  50.0MB               primary
 2      50.3MB  4000MB  3950MB               primary
 3      4000MB  30.0GB  26.0GB               primary

(parted) mkpart primary 30GB 3000GB
(parted) print
Model: WDC WD30 EZRX-00DC0B0 (scsi)
Disk /dev/sdc: 3001GB
Sector size (logical/physical): 4096B/4096B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      24.6kB  50.0MB  50.0MB               primary
 2      50.3MB  4000MB  3950MB               primary
 3      4000MB  30.0GB  26.0GB               primary
 4      30.0GB  3001GB  2971GB               primary

(parted)


-------------------------------


# gdisk -l /dev/sdc
GPT fdisk (gdisk) version 0.8.5

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sdc: 732566642 sectors, 2.7 TiB
Logical sector size: 4096 bytes
Disk identifier (GUID): EC21C401-D428-4B77-9C87-D4A6ED60DB4C
Partition table holds up to 128 entries
First usable sector is 6, last usable sector is 732566636
Partitions will be aligned on 8-sector boundaries
Total free space is 189 sectors (756.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1               6           12207   47.7 MiB    0700  primary
   2           12288          976639   3.7 GiB     0700  primary
   3          976640         7324159   24.2 GiB    0700  primary
   4         7324160       732566527   2.7 TiB     0700  primary


Everything was working fine and I can mount the 2.7TB partiton without any problem. As the disk seems to be partitioned correctly now I gave the openSuse Installer one last chance and connected the disk back to internal SATA. But the installer told me, there are no partitions detected on the disk.

Doesen’t really matter because it was only an option to have the same installation on the USB drive. I had to give back the system to the owner yesterday so I can’t do any further tests.

There is little that can be done here from openSUSE side. Apparently your BIOS emulates 512 bytes sectors. When you put HDD back into external enclosure, it returns to native 4K sector size. So in either case you get mismatch between partition table and actual sector size.

It is not installer fault. It just does what hardware tells it.