Mounting gpt partitions on Raspberry Pi

I was pretty excited when I received my Raspberry Pi last week as a replacement for my aging Tonidoplug V1 since due to its lack of support to the newest OS distributions (other than ArchLinux, which I am not too familiar with).

I am using 3.6.11+ Linux, which at the time of writing is the latest Raspbian (Raspberry Pi + Debian) “wheezy” image that is available online.

 cat /proc/version
Linux version 3.6.11+ ([email protected]) (gcc version 4.7.2 20120731 (prerelease) (crosstool-NG linaro-1.13.1+bzr2458 - Linaro GCC 2012.08) ) #456 PREEMPT Mon May 20 17:42:15 BST 2013

You can always download the latest version of the Raspbian image here.

For storage, I used an old Drobo with four WD Red 3TB drives. Thanks to thin provision in Drobo, I was able to create two 8TB partitions to store my data. As my Drobo has crashed recently, I had to format it with the Drobo tools program to create the partitions.

Raspberry Pi was able to detect partitions using fdisk, however with a warning message:

Disk /dev/sda: 8796.1 GB, 8796093022208 bytes
256 heads, 63 sectors/track, 1065220 cylinders, total 17179869184 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: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1  4294967295  2147483647+  ee  GPT

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

Disk /dev/sdb: 8796.1 GB, 8796093022208 bytes
256 heads, 63 sectors/track, 1065220 cylinders, total 17179869184 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: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1  4294967295  2147483647+  ee  GPT

When I simply tried to use mount, it does not quite work:

mount /dev/sdb /media/Data/
NTFS signature is missing.
Failed to mount '/dev/sdb': Invalid argument
The device '/dev/sdb' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?

Trying to mount sdb1 gave the same results:

mount /dev/sdb1 /media/Data
NTFS signature is missing.
Failed to mount '/dev/sdb1': Invalid argument
The device '/dev/sdb1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?

Just when I was about to give up, I remembered the warning message, how about I just try to use GNU Parted? Turns out if I use parted -l rather than fdisk -l, I see a much better picture:

 parted -l
Model: TRUSTED Mass Storage (scsi)
Disk /dev/sda: 8796GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name                          Flags
 1      17.4kB  134MB   134MB                Microsoft reserved partition  msftr                                                                                                 es
 2      134MB   8796GB  8796GB  ntfs         Basic data partition

Model: TRUSTED Mass Storage (scsi)
Disk /dev/sdb: 8796GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name                          Flags
 1      17.4kB  134MB   134MB                Microsoft reserved partition  msftr                                                                                                 es
 2      134MB   8796GB  8796GB  ntfs         Basic data partition

As you can see, when Windows formatted the partition, the first partition was marked as Microsoft reserved partition with a weird partition type of msftr and the actual data partition is on the second partition.

Therefore, if I do:

mount /dev/sdb2 /media/Data/

Now I can finally mount everything properly. And df -h is now showing both of my 8TB partitions:

 df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs           30G  2.2G   27G   8% /
/dev/root        30G  2.2G   27G   8% /
devtmpfs        212M     0  212M   0% /dev
tmpfs            44M  856K   43M   2% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            88M     0   88M   0% /run/shm
/dev/mmcblk0p1   56M   19M   38M  33% /boot
/dev/sdb2       8.0T  891G  7.2T  11% /media/Data
/dev/sda2       8.0T  1.7T  6.4T  21% /media/Backup

In summary, when you are mounting a gpt partition, please use parted –l to check the actual data partition (the one with the huge disk size) and mount that specific partition number to the mount point.

  • Bart

    mount: special device /dev/sdb2 does not exist? why this happens?

    • zhuanyi

      Could you run parted -l and paste your output here? Your device might not be called /dev/sdb2.

  • Bart

    [email protected]:~$ sudo parted -l

    Warning: /dev/sda contains GPT signatures, indicating that it has a GPT table.

    However, it does not have a valid fake msdos partition table, as it should.

    Perhaps it was corrupted — possibly by a program that doesn’t understand GPT

    partition tables. Or perhaps you deleted the GPT table, and are now using an

    msdos partition table. Is this a GPT partition table?

    Yes/No? yes

    Model: SAMSUNG HD161HJ (scsi)

    Disk /dev/sda: 160GB

    Sector size (logical/physical): 512B/512B

    Partition Table: gpt

    Number Start End Size File system Name Flags

    1 20.5kB 210MB 210MB fat32 EFI System Partition boot

    2 211MB 160GB 160GB ntfs TEST

    Model: SD SE16G (sd/mmc)

    Disk /dev/mmcblk0: 15.7GB

    Sector size (logical/physical): 512B/512B

    Partition Table: msdos

    Number Start End Size Type File system Flags

    1 2097kB 75.5MB 73.4MB primary fat32 lba

    2 77.6MB 15.7GB 15.6GB primary ext4

    [email protected]:~$ sudo mount /dev/sda2 /media/TEST

    mount: special device /dev/sda2 does not exist

    • zhuanyi

      Your 160GB drive is /dev/sda, so you will need to mount /dev/sda2 instead of sdb2. Hope that helps!

      • Bart

        thanks for the help, but it gives the same error
        [email protected]:~$ sudo mount /dev/sda2 /media/TEST
        mount: special device /dev/sda2 does not exist

        • zhuanyi

          If you check your /dev folder can you see any of the sda and sdb and all that?

          • zhuanyi

            Actually I just saw the first part of your error message, seems your partition table is corrupted, try this (assuming your HDD is empty):

            Step one: Download fixparts. http://www.rodsbooks.com/fixparts/

            Step two: follow the instructions. Type “Y” when needed to delete GPT data.

          • bart

            sudo fixparts /dev/disk1

            FixParts 0.8.7

            Loading MBR data from /dev/disk1

            This disk appears to be a GPT disk. Use GNU Parted or GPT fdisk on it!

            Exiting!

          • bart

            i tried reformating again the disk and appears now…

            I think it solved my problem.

            Thanks so much for the help

          • zhuanyi

            No problem and glad to know. I guess that’s the advantage of an empty disk, you can always format it 🙂

  • Seth

    Whenever I type any parted command with my Drobo attached it hangs the terminal (cursor goes to the next line and no output or prompt is available). Typing ctrl+C just prints a ^C and doesn’t bring a prompt back. This happens on “parted -l” or any of the commands inside the script created by “drobom -d /dev/sda format ext3 PleaseEraseMyData” (dev/sda is my drobo), such as “parted /dev/sda mklabel gpt”

    Anybody have any ideas why my Pi is hanging? Seems like its running out of memory, but thats just a random guess.

    Full Disclosure: Its a Gen2 Drobo with 4 3tb hdd’s and I’m trying to create a volume >2tb (obviously). Everything I read says >2tb LUN’s aren’t allowed on linux, but all the disclaimers are from at least 2 years ago and come the claim that it might/probably is possible if the kernel is newer than 2.6.x.x and Enable Block Layer->Support for Large Devices is enabled (both of which are true). But my friend has accomplished it with a Gen1 Drobo, so I’m pretty sure its possible.

    Thanks in advance!

    • @Seth: Are you actually using a powered USB hub for your Drobo? I think I read somewhere people were saying that even though Drobo itself has a power adaptor, you have to use a powered USB hub for it to work with those ARM devices.

    • @Seth: Sorry for the double-comments, but it does take a while for the Drobo to load, particularly if the partition is large (in my case, the 8TB partitions took a full 5-10 min at least before it is done (i.e., when you see the next command line and ready). However for 3TB partitions it is a lot faster (almost instant), so I guess for larger partitions, the program will need to spend some time to analyze the partitions, hence it would take a while.

  • Pingback: My Raspi List for use cases | Creative Geckos()

  • Leigh Fidock

    Thanks so much for this!!

  • Dan Dart

    I like to use gdisk instead of fdisk, which supports gpt.