Fun with GPT partitioning


Results 1 to 15 of 16

Thread: Fun with GPT partitioning

Threaded View

  1. #1
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,954

    Fun with GPT partitioning

    Executive summary : A Linux user can easily partition a Pata or Sata disk with the gpt partitioning scheme. Most modern Linux will run on gpt disks with little bother but MS Windows will find it an uphill struggle. It is something useful to have when the hard disk exceeds 2TB. The gpt disks can happily co-exist with the non-gpt disks.


    I have stayed away from this GUID partition table (GPT) until I bought a 2TB hard disk. The legacy partition table, also called MBR partition table adopted since Dos, has a limitation beyond the 2TB so I was just looking ahead and had a go with the gpt partioning system. A disk partitioned with the legacy type is called Msdos disk whereas a hard disk with a gpt scheme is now called gpt disk.

    In theory the gpt partitioning scheme is ready-make for breaking the 2TB barrier in the hard disks. It will cope well with the future 4k physical sector change as well as the resulting alignment problems created. There is a lot of promises so here I am to find it out.

    Apparently the GPT partition table is part of the Extensible Firmware Interface (EFI). The former can be implemented in Linux using certain partitioning tools but the latter requires a efi-aware motherboard which is not easy to find. None of my PC has it.

    The upshot of it is that the 64-bit MS Windows can be installed and booted if the PC has both efi hardware and gpt hard disk. The 32-bit Windows can never be booted with gpt hard disk. That means the gpt partition table is pretty useless for the majority of the MS systems.

    When it comes to Linux the matter is a lot happier and brighter.

    To make a gpt disk all we need is to run the "parted" command in a root terminal. To create a gpt hard disk, say for device /dev/sdb, the command is
    Code:
    parted /dev/sdb
    mklabel gpt
    The command nukes all existing partitions. To create a partition say from 0Gb to 100Gb is simply
    Code:
    mkpart Ubuntu 0 100G
    quit
    The gpt partition table automatically reserves the front end, about 34 sectors or 34x512= 17408 bytes, for the system use. This is a far cry from the Msdos disk that uses 4x16=64 bytes to describe the 4 primary partitions. The MS systems recognise a gpt disk can have 128 partitions. That apparently also applies in Linux as Post #2 shows how I make a 128 partition under 20 seconds!

    The gpt partition table is recognised as one partition type ee in all Linux's partitioning tool that do not support gpt because the first 512 bytes sector is common in both gpt and MBR disks. This GPT partition uses up the whole disk. If the disk is larger than 2TB then only the first 2TB will be reported in the protective MBR entry but the GPT partition can be a lot larger. This is how my 500Gb disk looks like after partitioned with "parted" and interrogated by "fdisk".
    Code:
    bash-3.1# fdisk -l /dev/sdb
    
    WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.
    
    
    Disk /dev/sdb: 500.1 GB, 500107862016 bytes
    255 heads, 63 sectors/track, 60801 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x2aa773c4
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1       60802   488386583+  ee  GPT
    bash-3.1#
    I have actually created 5 partitions inside using parted but only a few partitioning tools that support gpt can report it. The list from parted looks like this
    Code:
    bash-3.1# parted -l /dev/sdb
     
    (note: the tabulations of 60 partitions of sda were removed as they are irrelevant)
    
    Model: ATA SAMSUNG HD501LJ (scsi)
    Disk /dev/sdb: 500GB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    
    Number  Start   End    Size    File system  Name       Flags
     1      17.4kB  100GB  100GB   ext3         Ubuntu
     2      100GB   110GB  9999MB  ext3         Mepis
     3      110GB   120GB  10.0GB  ext3         PClinuxOS
     4      120GB   130GB  10.0GB  ext3         LinuxMint
     5      130GB   140GB  9999MB  ext3         Slackware
    
    bash-3.1#
    Thus the Linux kernel sees the content inside the gpt and the /dev/sdbx partitions can be used as in a normal MBR partition table.

    I have installed Ubuntu 10.4 in sdb1 but sdb2 to sdb5 were filled with Mepis, PClinuxOS, Linux Mint and Slackware from other hard disk. They all boot normally with Grub1 but my Linux Mint has Grub2 and I have to manually boot it up first before I could do a Grub-install inside.

    I encountered the following interesting points:-

    (1) Grub1 if patched can see the partitions inside a gpt disk. The standard 0.97 Grub1 only see gpt disk with one partition type ee and cannot boot the internal partitions. As an example my Mepis has a standard v0.97 Grub1. Although I can chainload Mepis using a patched Grub1 from Ubuntu when Mepis is loaded its standard Grub failed to boot up Mepis, claiming the partition did not exist.

    (2) Grub2 has native support for gpt disks so it can be used to boot their internal partitions.

    (3) Some older kernel fail to detect the internal partitions of a gpt disk. As an example I am now using Slackware with a 2.6.29 kernel. I managed to boot it up from sdb5 and was using it, yet when I attempted to mount /dev/sdb2 I got an error message of
    mount: special device /dev/sdb2 does not exist
    . Its /dev directory only has sdb1 device name. Thus the gpt support is still not mature in Linux.

    (4) The UUID numbering system appears to originate from gpt partitioning system.

    (5) Without efi hardware support from the motherboard I could not install any of the 64 bit MS Windows on the gpt disk. For the 32 bit MS system the gpt is a no-go area because the internal partitions won't get mounted at all. This means a ntfs partition created by a 64-bit Win7 cannot be seen in a Xp home. And I originally thought gpt partition table was invented for the MS systems.

    (6) Any hard disk can be created in gpt format. I have tried it on both 500Gb and 2Tb hard disks.

    (7) The partition type numbers appear to have been dropped in gpt system.

    (8) A gpt partition table to a non gpt-aware partitioning tool like fdisk, cfdisk or sfdisk is similar to a LVM partition or an extended partition. It show up as one entry but there can be several partitions inside it.

    (9) When a hard disk is partitioned in gpt the entire space is used up. A maximum of 128 partitions can be created (as showed in Post #2).

    I shall add references to this thread about gpt in the space below from time to time

    --------------------------------------GPT references--------------------------------------------------------------------

    efi as explained in Wikipedia. Best explanation of gpt A comprehensive tutorial (for gdisk) of the current state of gpt from author of gdisk Rod Smith
    Windows and GPT FAQ uefi specification
    Last edited by saikee; 06-06-2010 at 05:49 PM.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •