GPT or MBR: How do I know?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
72
down vote

favorite
23












How can I tell whether my harddrive is laid out using an MBR or GPT format?










share|improve this question

















  • 1




    Same question on AU
    – Avinash Raj
    Mar 19 '14 at 7:16














up vote
72
down vote

favorite
23












How can I tell whether my harddrive is laid out using an MBR or GPT format?










share|improve this question

















  • 1




    Same question on AU
    – Avinash Raj
    Mar 19 '14 at 7:16












up vote
72
down vote

favorite
23









up vote
72
down vote

favorite
23






23





How can I tell whether my harddrive is laid out using an MBR or GPT format?










share|improve this question













How can I tell whether my harddrive is laid out using an MBR or GPT format?







hard-disk gpt mbr






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 18 '14 at 14:38









goldilocks

61k13148203




61k13148203







  • 1




    Same question on AU
    – Avinash Raj
    Mar 19 '14 at 7:16












  • 1




    Same question on AU
    – Avinash Raj
    Mar 19 '14 at 7:16







1




1




Same question on AU
– Avinash Raj
Mar 19 '14 at 7:16




Same question on AU
– Avinash Raj
Mar 19 '14 at 7:16










6 Answers
6






active

oldest

votes

















up vote
78
down vote













You can use parted -l to determine the type of partition table. Eg:



$ sudo parted -l
Model: ATA TOSHIBA THNSNS25 (scsi)
Disk /dev/sda: 256GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 4194kB 32.2GB 32.2GB primary ext4 boot
2 32.2GB 256GB 224GB primary ext4


Model: ATA Hitachi HDT72101 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 1049kB 32.2GB 32.2GB primary ext4 boot
2 32.2GB 996GB 964GB primary ext4
3 996GB 1000GB 4295MB primary linux-swap(v1)


The Partition Table field shows that I am using a msdos MBR partition table (the one still commonly used for Linux and Windows) on both disks. From the man page parted can create (and thus hopefully identify) the following types of partition table (or more broadly `disk label'):



bsd
dvh
gpt - this is a GPT partition table
loop - this is raw disk access without a partition table
mac
msdos - this is a standard MBR partition table
pc98
sun


Update



It is worth adding the command for listing a single partition since this is not obvious without some knowledge of parted and it can be a pain finding the data you need if there are multiple drives. For /dev/sda you would do:



parted /dev/sda print





share|improve this answer






















  • That is a great command, Graeme. Although I've been using Linux for several years, I had never really noticed it. Thanks!
    – Tim
    Mar 18 '14 at 15:59






  • 3




    parted /dev/sda p will do, too.
    – sjas
    May 4 '15 at 22:35










  • i had to do "sudo parted -l"
    – Santropedro
    Oct 30 at 3:43

















up vote
31
down vote













On linux, you can check this via the gdisk tool which should be available for any distro.



gdisk -l /dev/sda


Here, /dev/sda is the device node of the physical drive, not a partition (/dev/sda1, /dev/sda2, etc. are partitions).



If you see something that includes:



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


You have a MBR style disk. Don't worry, this did not do any harm.



If you don't see this warning, you have a GPT disk, or a hybrid GPT/MBR disk. The later are used mostly on Apple machines intended to dual-boot versions of MS Windows which do not support GPT. gdisk will indicate this with:



Found valid GPT with hybrid MBR; using GPT


They may also be used in other situations where support for both styles is required.






share|improve this answer






















  • Or the reverse - trying to use cfdisk on a GPT partition will also result in a warning.
    – orion
    Mar 18 '14 at 14:54










  • If not installed and not in a gdisk package, it can be found in the gptfdisk package... at least on Gentoo.
    – jus cogens prime
    Mar 18 '14 at 15:22






  • 2




    @orion I would not recommend that as some versions of tools like fdisk or cfdisk may support GPT and therefore not show an error.
    – goldilocks
    Mar 18 '14 at 15:37










  • For me gdisk detects a hybrid GPT+MBR partition table and gives Found valid GPT with hybrid MBR; using GPT.. This seems to be the only method which will detect a hybrid table.
    – Graeme
    Mar 18 '14 at 19:11










  • @Graeme : Thanks. I was unaware of these (the original hybrid reference was edited in by Stephane Chazelas), but I did a bit of reading and added some details.
    – goldilocks
    Mar 18 '14 at 20:34


















up vote
17
down vote













As the OS was not specified, here is FreeBSD way of doing things.



All is done through the gpart command (short for GEOM partioner - nothing to do with GNU).



A simple gpart show would show you all the available partitions of all the disks, but you can specify the device to have a more precise look on one:




  • legacy partition layout with MBR (aka "msdos") and BSD partition schemes (a 2-level partitioning was usually required for BSD systems, unless using the full disk):



    $gpart show



    => 63 67108801 ada0 MBR (32G)
    63 67108545 1 freebsd [active] (32G)
    67108608 256 - free - (128k)

    => 0 67108545 ada0s1 BSD (32G)
    0 2097152 2 freebsd-swap (1.0G)
    2097152 65011393 1 freebsd-ufs (31G)



  • modern partition layout using GPT:



    $gpart show /dev/ada2



    => 34 976773101 ada2 GPT (465G)
    34 6 - free - (3.0k)
    40 128 1 freebsd-boot (64k)
    168 67108864 2 freebsd-swap (32G)
    67109032 901775360 3 freebsd-zfs (430G)


To know more, all is in the gpart manual.






share|improve this answer



























    up vote
    9
    down vote













    With udisks on Linux:



    $ sudo /lib/udev/udisks-part-id /dev/sda
    using device_file=/dev/sda syspath=/sys/devices/pci0000:00/0000:00:0b.0/ata1/host0/target0:0:0/0:0:0:0/block/sda, offset=0 ao=0 and number=0 for /dev/sda
    Entering MS-DOS parser (offset=0, size=500107862016)
    MSDOS_MAGIC found
    found partition type 0xee => protective MBR for GPT
    Exiting MS-DOS parser
    Entering EFI GPT parser
    GPT magic found
    partition_entry_lba=2
    num_entries=128
    size_of_entry=128
    Leaving EFI GPT parser
    EFI GPT partition table detected
    UDISKS_PARTITION_TABLE=1
    UDISKS_PARTITION_TABLE_SCHEME=gpt
    UDISKS_PARTITION_TABLE_COUNT=4


    Above, I've got a drive with hybrid GPT+MS-DOS partitioning. In that case, the Linux kernel ignores the MS-DOS partitioning, which is why udisks sets UDISKS_PARTITION_TABLE_SCHEME to gpt.



    That udisks-part-id tool is used to populate the udev database. So if you've got udisks installed, you should be able to query that information even as a non-priviledged user with:



    $ udevadm info -q property -n sda | grep UDISKS_PARTITION_TABLE_SCHEME
    UDISKS_PARTITION_TABLE_SCHEME=gpt





    share|improve this answer
















    • 2




      Note that you will get similar output regardless of whether there is a hybrid GPT+MBR or not. GPT requires a fake MBR with a single full disk partition of type 0xee. In a hybrid this is a normal MBR with one 0xee partition (and potential for major problems if the MBR data goes out of sync with the GPT data).
      – Graeme
      Mar 18 '14 at 18:55

















    up vote
    4
    down vote













    Use



    $ sudo fdisk -l 

    Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 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
    Disklabel type: dos
    Disk identifier: 0x987c1a05


    Device Boot Start End Sectors Size Id Type
    /dev/sda1 * 2048 999423 997376 487M 83 Linux
    /dev/sda2 1001470 250068991 249067522 118.8G 5 Extended
    /dev/sda5 1001472 250068991 249067520 118.8G 8e Linux LVM


    See the Disklabel type: dos. If it shows dos that means it is MBR schema else GPT schema






    share|improve this answer



























      up vote
      3
      down vote













      In my Alpine Linux Partition scripts I use:



      check_scheme() 
      fdisk -l $1





      share|improve this answer




















      • On my Ubuntu 18.04 system fdisk -l /dev/sda | grep -i disklabel returns nothing, (GNU Fdisk 1.3.0a).
        – agc
        Nov 18 at 18:02










      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f120221%2fgpt-or-mbr-how-do-i-know%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      6 Answers
      6






      active

      oldest

      votes








      6 Answers
      6






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      78
      down vote













      You can use parted -l to determine the type of partition table. Eg:



      $ sudo parted -l
      Model: ATA TOSHIBA THNSNS25 (scsi)
      Disk /dev/sda: 256GB
      Sector size (logical/physical): 512B/512B
      Partition Table: msdos

      Number Start End Size Type File system Flags
      1 4194kB 32.2GB 32.2GB primary ext4 boot
      2 32.2GB 256GB 224GB primary ext4


      Model: ATA Hitachi HDT72101 (scsi)
      Disk /dev/sdb: 1000GB
      Sector size (logical/physical): 512B/512B
      Partition Table: msdos

      Number Start End Size Type File system Flags
      1 1049kB 32.2GB 32.2GB primary ext4 boot
      2 32.2GB 996GB 964GB primary ext4
      3 996GB 1000GB 4295MB primary linux-swap(v1)


      The Partition Table field shows that I am using a msdos MBR partition table (the one still commonly used for Linux and Windows) on both disks. From the man page parted can create (and thus hopefully identify) the following types of partition table (or more broadly `disk label'):



      bsd
      dvh
      gpt - this is a GPT partition table
      loop - this is raw disk access without a partition table
      mac
      msdos - this is a standard MBR partition table
      pc98
      sun


      Update



      It is worth adding the command for listing a single partition since this is not obvious without some knowledge of parted and it can be a pain finding the data you need if there are multiple drives. For /dev/sda you would do:



      parted /dev/sda print





      share|improve this answer






















      • That is a great command, Graeme. Although I've been using Linux for several years, I had never really noticed it. Thanks!
        – Tim
        Mar 18 '14 at 15:59






      • 3




        parted /dev/sda p will do, too.
        – sjas
        May 4 '15 at 22:35










      • i had to do "sudo parted -l"
        – Santropedro
        Oct 30 at 3:43














      up vote
      78
      down vote













      You can use parted -l to determine the type of partition table. Eg:



      $ sudo parted -l
      Model: ATA TOSHIBA THNSNS25 (scsi)
      Disk /dev/sda: 256GB
      Sector size (logical/physical): 512B/512B
      Partition Table: msdos

      Number Start End Size Type File system Flags
      1 4194kB 32.2GB 32.2GB primary ext4 boot
      2 32.2GB 256GB 224GB primary ext4


      Model: ATA Hitachi HDT72101 (scsi)
      Disk /dev/sdb: 1000GB
      Sector size (logical/physical): 512B/512B
      Partition Table: msdos

      Number Start End Size Type File system Flags
      1 1049kB 32.2GB 32.2GB primary ext4 boot
      2 32.2GB 996GB 964GB primary ext4
      3 996GB 1000GB 4295MB primary linux-swap(v1)


      The Partition Table field shows that I am using a msdos MBR partition table (the one still commonly used for Linux and Windows) on both disks. From the man page parted can create (and thus hopefully identify) the following types of partition table (or more broadly `disk label'):



      bsd
      dvh
      gpt - this is a GPT partition table
      loop - this is raw disk access without a partition table
      mac
      msdos - this is a standard MBR partition table
      pc98
      sun


      Update



      It is worth adding the command for listing a single partition since this is not obvious without some knowledge of parted and it can be a pain finding the data you need if there are multiple drives. For /dev/sda you would do:



      parted /dev/sda print





      share|improve this answer






















      • That is a great command, Graeme. Although I've been using Linux for several years, I had never really noticed it. Thanks!
        – Tim
        Mar 18 '14 at 15:59






      • 3




        parted /dev/sda p will do, too.
        – sjas
        May 4 '15 at 22:35










      • i had to do "sudo parted -l"
        – Santropedro
        Oct 30 at 3:43












      up vote
      78
      down vote










      up vote
      78
      down vote









      You can use parted -l to determine the type of partition table. Eg:



      $ sudo parted -l
      Model: ATA TOSHIBA THNSNS25 (scsi)
      Disk /dev/sda: 256GB
      Sector size (logical/physical): 512B/512B
      Partition Table: msdos

      Number Start End Size Type File system Flags
      1 4194kB 32.2GB 32.2GB primary ext4 boot
      2 32.2GB 256GB 224GB primary ext4


      Model: ATA Hitachi HDT72101 (scsi)
      Disk /dev/sdb: 1000GB
      Sector size (logical/physical): 512B/512B
      Partition Table: msdos

      Number Start End Size Type File system Flags
      1 1049kB 32.2GB 32.2GB primary ext4 boot
      2 32.2GB 996GB 964GB primary ext4
      3 996GB 1000GB 4295MB primary linux-swap(v1)


      The Partition Table field shows that I am using a msdos MBR partition table (the one still commonly used for Linux and Windows) on both disks. From the man page parted can create (and thus hopefully identify) the following types of partition table (or more broadly `disk label'):



      bsd
      dvh
      gpt - this is a GPT partition table
      loop - this is raw disk access without a partition table
      mac
      msdos - this is a standard MBR partition table
      pc98
      sun


      Update



      It is worth adding the command for listing a single partition since this is not obvious without some knowledge of parted and it can be a pain finding the data you need if there are multiple drives. For /dev/sda you would do:



      parted /dev/sda print





      share|improve this answer














      You can use parted -l to determine the type of partition table. Eg:



      $ sudo parted -l
      Model: ATA TOSHIBA THNSNS25 (scsi)
      Disk /dev/sda: 256GB
      Sector size (logical/physical): 512B/512B
      Partition Table: msdos

      Number Start End Size Type File system Flags
      1 4194kB 32.2GB 32.2GB primary ext4 boot
      2 32.2GB 256GB 224GB primary ext4


      Model: ATA Hitachi HDT72101 (scsi)
      Disk /dev/sdb: 1000GB
      Sector size (logical/physical): 512B/512B
      Partition Table: msdos

      Number Start End Size Type File system Flags
      1 1049kB 32.2GB 32.2GB primary ext4 boot
      2 32.2GB 996GB 964GB primary ext4
      3 996GB 1000GB 4295MB primary linux-swap(v1)


      The Partition Table field shows that I am using a msdos MBR partition table (the one still commonly used for Linux and Windows) on both disks. From the man page parted can create (and thus hopefully identify) the following types of partition table (or more broadly `disk label'):



      bsd
      dvh
      gpt - this is a GPT partition table
      loop - this is raw disk access without a partition table
      mac
      msdos - this is a standard MBR partition table
      pc98
      sun


      Update



      It is worth adding the command for listing a single partition since this is not obvious without some knowledge of parted and it can be a pain finding the data you need if there are multiple drives. For /dev/sda you would do:



      parted /dev/sda print






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jul 7 '14 at 18:36

























      answered Mar 18 '14 at 14:49









      Graeme

      24.7k46296




      24.7k46296











      • That is a great command, Graeme. Although I've been using Linux for several years, I had never really noticed it. Thanks!
        – Tim
        Mar 18 '14 at 15:59






      • 3




        parted /dev/sda p will do, too.
        – sjas
        May 4 '15 at 22:35










      • i had to do "sudo parted -l"
        – Santropedro
        Oct 30 at 3:43
















      • That is a great command, Graeme. Although I've been using Linux for several years, I had never really noticed it. Thanks!
        – Tim
        Mar 18 '14 at 15:59






      • 3




        parted /dev/sda p will do, too.
        – sjas
        May 4 '15 at 22:35










      • i had to do "sudo parted -l"
        – Santropedro
        Oct 30 at 3:43















      That is a great command, Graeme. Although I've been using Linux for several years, I had never really noticed it. Thanks!
      – Tim
      Mar 18 '14 at 15:59




      That is a great command, Graeme. Although I've been using Linux for several years, I had never really noticed it. Thanks!
      – Tim
      Mar 18 '14 at 15:59




      3




      3




      parted /dev/sda p will do, too.
      – sjas
      May 4 '15 at 22:35




      parted /dev/sda p will do, too.
      – sjas
      May 4 '15 at 22:35












      i had to do "sudo parted -l"
      – Santropedro
      Oct 30 at 3:43




      i had to do "sudo parted -l"
      – Santropedro
      Oct 30 at 3:43












      up vote
      31
      down vote













      On linux, you can check this via the gdisk tool which should be available for any distro.



      gdisk -l /dev/sda


      Here, /dev/sda is the device node of the physical drive, not a partition (/dev/sda1, /dev/sda2, etc. are partitions).



      If you see something that includes:



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


      You have a MBR style disk. Don't worry, this did not do any harm.



      If you don't see this warning, you have a GPT disk, or a hybrid GPT/MBR disk. The later are used mostly on Apple machines intended to dual-boot versions of MS Windows which do not support GPT. gdisk will indicate this with:



      Found valid GPT with hybrid MBR; using GPT


      They may also be used in other situations where support for both styles is required.






      share|improve this answer






















      • Or the reverse - trying to use cfdisk on a GPT partition will also result in a warning.
        – orion
        Mar 18 '14 at 14:54










      • If not installed and not in a gdisk package, it can be found in the gptfdisk package... at least on Gentoo.
        – jus cogens prime
        Mar 18 '14 at 15:22






      • 2




        @orion I would not recommend that as some versions of tools like fdisk or cfdisk may support GPT and therefore not show an error.
        – goldilocks
        Mar 18 '14 at 15:37










      • For me gdisk detects a hybrid GPT+MBR partition table and gives Found valid GPT with hybrid MBR; using GPT.. This seems to be the only method which will detect a hybrid table.
        – Graeme
        Mar 18 '14 at 19:11










      • @Graeme : Thanks. I was unaware of these (the original hybrid reference was edited in by Stephane Chazelas), but I did a bit of reading and added some details.
        – goldilocks
        Mar 18 '14 at 20:34















      up vote
      31
      down vote













      On linux, you can check this via the gdisk tool which should be available for any distro.



      gdisk -l /dev/sda


      Here, /dev/sda is the device node of the physical drive, not a partition (/dev/sda1, /dev/sda2, etc. are partitions).



      If you see something that includes:



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


      You have a MBR style disk. Don't worry, this did not do any harm.



      If you don't see this warning, you have a GPT disk, or a hybrid GPT/MBR disk. The later are used mostly on Apple machines intended to dual-boot versions of MS Windows which do not support GPT. gdisk will indicate this with:



      Found valid GPT with hybrid MBR; using GPT


      They may also be used in other situations where support for both styles is required.






      share|improve this answer






















      • Or the reverse - trying to use cfdisk on a GPT partition will also result in a warning.
        – orion
        Mar 18 '14 at 14:54










      • If not installed and not in a gdisk package, it can be found in the gptfdisk package... at least on Gentoo.
        – jus cogens prime
        Mar 18 '14 at 15:22






      • 2




        @orion I would not recommend that as some versions of tools like fdisk or cfdisk may support GPT and therefore not show an error.
        – goldilocks
        Mar 18 '14 at 15:37










      • For me gdisk detects a hybrid GPT+MBR partition table and gives Found valid GPT with hybrid MBR; using GPT.. This seems to be the only method which will detect a hybrid table.
        – Graeme
        Mar 18 '14 at 19:11










      • @Graeme : Thanks. I was unaware of these (the original hybrid reference was edited in by Stephane Chazelas), but I did a bit of reading and added some details.
        – goldilocks
        Mar 18 '14 at 20:34













      up vote
      31
      down vote










      up vote
      31
      down vote









      On linux, you can check this via the gdisk tool which should be available for any distro.



      gdisk -l /dev/sda


      Here, /dev/sda is the device node of the physical drive, not a partition (/dev/sda1, /dev/sda2, etc. are partitions).



      If you see something that includes:



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


      You have a MBR style disk. Don't worry, this did not do any harm.



      If you don't see this warning, you have a GPT disk, or a hybrid GPT/MBR disk. The later are used mostly on Apple machines intended to dual-boot versions of MS Windows which do not support GPT. gdisk will indicate this with:



      Found valid GPT with hybrid MBR; using GPT


      They may also be used in other situations where support for both styles is required.






      share|improve this answer














      On linux, you can check this via the gdisk tool which should be available for any distro.



      gdisk -l /dev/sda


      Here, /dev/sda is the device node of the physical drive, not a partition (/dev/sda1, /dev/sda2, etc. are partitions).



      If you see something that includes:



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


      You have a MBR style disk. Don't worry, this did not do any harm.



      If you don't see this warning, you have a GPT disk, or a hybrid GPT/MBR disk. The later are used mostly on Apple machines intended to dual-boot versions of MS Windows which do not support GPT. gdisk will indicate this with:



      Found valid GPT with hybrid MBR; using GPT


      They may also be used in other situations where support for both styles is required.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Mar 18 '14 at 20:33

























      answered Mar 18 '14 at 14:38









      goldilocks

      61k13148203




      61k13148203











      • Or the reverse - trying to use cfdisk on a GPT partition will also result in a warning.
        – orion
        Mar 18 '14 at 14:54










      • If not installed and not in a gdisk package, it can be found in the gptfdisk package... at least on Gentoo.
        – jus cogens prime
        Mar 18 '14 at 15:22






      • 2




        @orion I would not recommend that as some versions of tools like fdisk or cfdisk may support GPT and therefore not show an error.
        – goldilocks
        Mar 18 '14 at 15:37










      • For me gdisk detects a hybrid GPT+MBR partition table and gives Found valid GPT with hybrid MBR; using GPT.. This seems to be the only method which will detect a hybrid table.
        – Graeme
        Mar 18 '14 at 19:11










      • @Graeme : Thanks. I was unaware of these (the original hybrid reference was edited in by Stephane Chazelas), but I did a bit of reading and added some details.
        – goldilocks
        Mar 18 '14 at 20:34

















      • Or the reverse - trying to use cfdisk on a GPT partition will also result in a warning.
        – orion
        Mar 18 '14 at 14:54










      • If not installed and not in a gdisk package, it can be found in the gptfdisk package... at least on Gentoo.
        – jus cogens prime
        Mar 18 '14 at 15:22






      • 2




        @orion I would not recommend that as some versions of tools like fdisk or cfdisk may support GPT and therefore not show an error.
        – goldilocks
        Mar 18 '14 at 15:37










      • For me gdisk detects a hybrid GPT+MBR partition table and gives Found valid GPT with hybrid MBR; using GPT.. This seems to be the only method which will detect a hybrid table.
        – Graeme
        Mar 18 '14 at 19:11










      • @Graeme : Thanks. I was unaware of these (the original hybrid reference was edited in by Stephane Chazelas), but I did a bit of reading and added some details.
        – goldilocks
        Mar 18 '14 at 20:34
















      Or the reverse - trying to use cfdisk on a GPT partition will also result in a warning.
      – orion
      Mar 18 '14 at 14:54




      Or the reverse - trying to use cfdisk on a GPT partition will also result in a warning.
      – orion
      Mar 18 '14 at 14:54












      If not installed and not in a gdisk package, it can be found in the gptfdisk package... at least on Gentoo.
      – jus cogens prime
      Mar 18 '14 at 15:22




      If not installed and not in a gdisk package, it can be found in the gptfdisk package... at least on Gentoo.
      – jus cogens prime
      Mar 18 '14 at 15:22




      2




      2




      @orion I would not recommend that as some versions of tools like fdisk or cfdisk may support GPT and therefore not show an error.
      – goldilocks
      Mar 18 '14 at 15:37




      @orion I would not recommend that as some versions of tools like fdisk or cfdisk may support GPT and therefore not show an error.
      – goldilocks
      Mar 18 '14 at 15:37












      For me gdisk detects a hybrid GPT+MBR partition table and gives Found valid GPT with hybrid MBR; using GPT.. This seems to be the only method which will detect a hybrid table.
      – Graeme
      Mar 18 '14 at 19:11




      For me gdisk detects a hybrid GPT+MBR partition table and gives Found valid GPT with hybrid MBR; using GPT.. This seems to be the only method which will detect a hybrid table.
      – Graeme
      Mar 18 '14 at 19:11












      @Graeme : Thanks. I was unaware of these (the original hybrid reference was edited in by Stephane Chazelas), but I did a bit of reading and added some details.
      – goldilocks
      Mar 18 '14 at 20:34





      @Graeme : Thanks. I was unaware of these (the original hybrid reference was edited in by Stephane Chazelas), but I did a bit of reading and added some details.
      – goldilocks
      Mar 18 '14 at 20:34











      up vote
      17
      down vote













      As the OS was not specified, here is FreeBSD way of doing things.



      All is done through the gpart command (short for GEOM partioner - nothing to do with GNU).



      A simple gpart show would show you all the available partitions of all the disks, but you can specify the device to have a more precise look on one:




      • legacy partition layout with MBR (aka "msdos") and BSD partition schemes (a 2-level partitioning was usually required for BSD systems, unless using the full disk):



        $gpart show



        => 63 67108801 ada0 MBR (32G)
        63 67108545 1 freebsd [active] (32G)
        67108608 256 - free - (128k)

        => 0 67108545 ada0s1 BSD (32G)
        0 2097152 2 freebsd-swap (1.0G)
        2097152 65011393 1 freebsd-ufs (31G)



      • modern partition layout using GPT:



        $gpart show /dev/ada2



        => 34 976773101 ada2 GPT (465G)
        34 6 - free - (3.0k)
        40 128 1 freebsd-boot (64k)
        168 67108864 2 freebsd-swap (32G)
        67109032 901775360 3 freebsd-zfs (430G)


      To know more, all is in the gpart manual.






      share|improve this answer
























        up vote
        17
        down vote













        As the OS was not specified, here is FreeBSD way of doing things.



        All is done through the gpart command (short for GEOM partioner - nothing to do with GNU).



        A simple gpart show would show you all the available partitions of all the disks, but you can specify the device to have a more precise look on one:




        • legacy partition layout with MBR (aka "msdos") and BSD partition schemes (a 2-level partitioning was usually required for BSD systems, unless using the full disk):



          $gpart show



          => 63 67108801 ada0 MBR (32G)
          63 67108545 1 freebsd [active] (32G)
          67108608 256 - free - (128k)

          => 0 67108545 ada0s1 BSD (32G)
          0 2097152 2 freebsd-swap (1.0G)
          2097152 65011393 1 freebsd-ufs (31G)



        • modern partition layout using GPT:



          $gpart show /dev/ada2



          => 34 976773101 ada2 GPT (465G)
          34 6 - free - (3.0k)
          40 128 1 freebsd-boot (64k)
          168 67108864 2 freebsd-swap (32G)
          67109032 901775360 3 freebsd-zfs (430G)


        To know more, all is in the gpart manual.






        share|improve this answer






















          up vote
          17
          down vote










          up vote
          17
          down vote









          As the OS was not specified, here is FreeBSD way of doing things.



          All is done through the gpart command (short for GEOM partioner - nothing to do with GNU).



          A simple gpart show would show you all the available partitions of all the disks, but you can specify the device to have a more precise look on one:




          • legacy partition layout with MBR (aka "msdos") and BSD partition schemes (a 2-level partitioning was usually required for BSD systems, unless using the full disk):



            $gpart show



            => 63 67108801 ada0 MBR (32G)
            63 67108545 1 freebsd [active] (32G)
            67108608 256 - free - (128k)

            => 0 67108545 ada0s1 BSD (32G)
            0 2097152 2 freebsd-swap (1.0G)
            2097152 65011393 1 freebsd-ufs (31G)



          • modern partition layout using GPT:



            $gpart show /dev/ada2



            => 34 976773101 ada2 GPT (465G)
            34 6 - free - (3.0k)
            40 128 1 freebsd-boot (64k)
            168 67108864 2 freebsd-swap (32G)
            67109032 901775360 3 freebsd-zfs (430G)


          To know more, all is in the gpart manual.






          share|improve this answer












          As the OS was not specified, here is FreeBSD way of doing things.



          All is done through the gpart command (short for GEOM partioner - nothing to do with GNU).



          A simple gpart show would show you all the available partitions of all the disks, but you can specify the device to have a more precise look on one:




          • legacy partition layout with MBR (aka "msdos") and BSD partition schemes (a 2-level partitioning was usually required for BSD systems, unless using the full disk):



            $gpart show



            => 63 67108801 ada0 MBR (32G)
            63 67108545 1 freebsd [active] (32G)
            67108608 256 - free - (128k)

            => 0 67108545 ada0s1 BSD (32G)
            0 2097152 2 freebsd-swap (1.0G)
            2097152 65011393 1 freebsd-ufs (31G)



          • modern partition layout using GPT:



            $gpart show /dev/ada2



            => 34 976773101 ada2 GPT (465G)
            34 6 - free - (3.0k)
            40 128 1 freebsd-boot (64k)
            168 67108864 2 freebsd-swap (32G)
            67109032 901775360 3 freebsd-zfs (430G)


          To know more, all is in the gpart manual.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 18 '14 at 17:08









          Ouki

          3,77521324




          3,77521324




















              up vote
              9
              down vote













              With udisks on Linux:



              $ sudo /lib/udev/udisks-part-id /dev/sda
              using device_file=/dev/sda syspath=/sys/devices/pci0000:00/0000:00:0b.0/ata1/host0/target0:0:0/0:0:0:0/block/sda, offset=0 ao=0 and number=0 for /dev/sda
              Entering MS-DOS parser (offset=0, size=500107862016)
              MSDOS_MAGIC found
              found partition type 0xee => protective MBR for GPT
              Exiting MS-DOS parser
              Entering EFI GPT parser
              GPT magic found
              partition_entry_lba=2
              num_entries=128
              size_of_entry=128
              Leaving EFI GPT parser
              EFI GPT partition table detected
              UDISKS_PARTITION_TABLE=1
              UDISKS_PARTITION_TABLE_SCHEME=gpt
              UDISKS_PARTITION_TABLE_COUNT=4


              Above, I've got a drive with hybrid GPT+MS-DOS partitioning. In that case, the Linux kernel ignores the MS-DOS partitioning, which is why udisks sets UDISKS_PARTITION_TABLE_SCHEME to gpt.



              That udisks-part-id tool is used to populate the udev database. So if you've got udisks installed, you should be able to query that information even as a non-priviledged user with:



              $ udevadm info -q property -n sda | grep UDISKS_PARTITION_TABLE_SCHEME
              UDISKS_PARTITION_TABLE_SCHEME=gpt





              share|improve this answer
















              • 2




                Note that you will get similar output regardless of whether there is a hybrid GPT+MBR or not. GPT requires a fake MBR with a single full disk partition of type 0xee. In a hybrid this is a normal MBR with one 0xee partition (and potential for major problems if the MBR data goes out of sync with the GPT data).
                – Graeme
                Mar 18 '14 at 18:55














              up vote
              9
              down vote













              With udisks on Linux:



              $ sudo /lib/udev/udisks-part-id /dev/sda
              using device_file=/dev/sda syspath=/sys/devices/pci0000:00/0000:00:0b.0/ata1/host0/target0:0:0/0:0:0:0/block/sda, offset=0 ao=0 and number=0 for /dev/sda
              Entering MS-DOS parser (offset=0, size=500107862016)
              MSDOS_MAGIC found
              found partition type 0xee => protective MBR for GPT
              Exiting MS-DOS parser
              Entering EFI GPT parser
              GPT magic found
              partition_entry_lba=2
              num_entries=128
              size_of_entry=128
              Leaving EFI GPT parser
              EFI GPT partition table detected
              UDISKS_PARTITION_TABLE=1
              UDISKS_PARTITION_TABLE_SCHEME=gpt
              UDISKS_PARTITION_TABLE_COUNT=4


              Above, I've got a drive with hybrid GPT+MS-DOS partitioning. In that case, the Linux kernel ignores the MS-DOS partitioning, which is why udisks sets UDISKS_PARTITION_TABLE_SCHEME to gpt.



              That udisks-part-id tool is used to populate the udev database. So if you've got udisks installed, you should be able to query that information even as a non-priviledged user with:



              $ udevadm info -q property -n sda | grep UDISKS_PARTITION_TABLE_SCHEME
              UDISKS_PARTITION_TABLE_SCHEME=gpt





              share|improve this answer
















              • 2




                Note that you will get similar output regardless of whether there is a hybrid GPT+MBR or not. GPT requires a fake MBR with a single full disk partition of type 0xee. In a hybrid this is a normal MBR with one 0xee partition (and potential for major problems if the MBR data goes out of sync with the GPT data).
                – Graeme
                Mar 18 '14 at 18:55












              up vote
              9
              down vote










              up vote
              9
              down vote









              With udisks on Linux:



              $ sudo /lib/udev/udisks-part-id /dev/sda
              using device_file=/dev/sda syspath=/sys/devices/pci0000:00/0000:00:0b.0/ata1/host0/target0:0:0/0:0:0:0/block/sda, offset=0 ao=0 and number=0 for /dev/sda
              Entering MS-DOS parser (offset=0, size=500107862016)
              MSDOS_MAGIC found
              found partition type 0xee => protective MBR for GPT
              Exiting MS-DOS parser
              Entering EFI GPT parser
              GPT magic found
              partition_entry_lba=2
              num_entries=128
              size_of_entry=128
              Leaving EFI GPT parser
              EFI GPT partition table detected
              UDISKS_PARTITION_TABLE=1
              UDISKS_PARTITION_TABLE_SCHEME=gpt
              UDISKS_PARTITION_TABLE_COUNT=4


              Above, I've got a drive with hybrid GPT+MS-DOS partitioning. In that case, the Linux kernel ignores the MS-DOS partitioning, which is why udisks sets UDISKS_PARTITION_TABLE_SCHEME to gpt.



              That udisks-part-id tool is used to populate the udev database. So if you've got udisks installed, you should be able to query that information even as a non-priviledged user with:



              $ udevadm info -q property -n sda | grep UDISKS_PARTITION_TABLE_SCHEME
              UDISKS_PARTITION_TABLE_SCHEME=gpt





              share|improve this answer












              With udisks on Linux:



              $ sudo /lib/udev/udisks-part-id /dev/sda
              using device_file=/dev/sda syspath=/sys/devices/pci0000:00/0000:00:0b.0/ata1/host0/target0:0:0/0:0:0:0/block/sda, offset=0 ao=0 and number=0 for /dev/sda
              Entering MS-DOS parser (offset=0, size=500107862016)
              MSDOS_MAGIC found
              found partition type 0xee => protective MBR for GPT
              Exiting MS-DOS parser
              Entering EFI GPT parser
              GPT magic found
              partition_entry_lba=2
              num_entries=128
              size_of_entry=128
              Leaving EFI GPT parser
              EFI GPT partition table detected
              UDISKS_PARTITION_TABLE=1
              UDISKS_PARTITION_TABLE_SCHEME=gpt
              UDISKS_PARTITION_TABLE_COUNT=4


              Above, I've got a drive with hybrid GPT+MS-DOS partitioning. In that case, the Linux kernel ignores the MS-DOS partitioning, which is why udisks sets UDISKS_PARTITION_TABLE_SCHEME to gpt.



              That udisks-part-id tool is used to populate the udev database. So if you've got udisks installed, you should be able to query that information even as a non-priviledged user with:



              $ udevadm info -q property -n sda | grep UDISKS_PARTITION_TABLE_SCHEME
              UDISKS_PARTITION_TABLE_SCHEME=gpt






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Mar 18 '14 at 17:52









              Stéphane Chazelas

              294k54552894




              294k54552894







              • 2




                Note that you will get similar output regardless of whether there is a hybrid GPT+MBR or not. GPT requires a fake MBR with a single full disk partition of type 0xee. In a hybrid this is a normal MBR with one 0xee partition (and potential for major problems if the MBR data goes out of sync with the GPT data).
                – Graeme
                Mar 18 '14 at 18:55












              • 2




                Note that you will get similar output regardless of whether there is a hybrid GPT+MBR or not. GPT requires a fake MBR with a single full disk partition of type 0xee. In a hybrid this is a normal MBR with one 0xee partition (and potential for major problems if the MBR data goes out of sync with the GPT data).
                – Graeme
                Mar 18 '14 at 18:55







              2




              2




              Note that you will get similar output regardless of whether there is a hybrid GPT+MBR or not. GPT requires a fake MBR with a single full disk partition of type 0xee. In a hybrid this is a normal MBR with one 0xee partition (and potential for major problems if the MBR data goes out of sync with the GPT data).
              – Graeme
              Mar 18 '14 at 18:55




              Note that you will get similar output regardless of whether there is a hybrid GPT+MBR or not. GPT requires a fake MBR with a single full disk partition of type 0xee. In a hybrid this is a normal MBR with one 0xee partition (and potential for major problems if the MBR data goes out of sync with the GPT data).
              – Graeme
              Mar 18 '14 at 18:55










              up vote
              4
              down vote













              Use



              $ sudo fdisk -l 

              Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 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
              Disklabel type: dos
              Disk identifier: 0x987c1a05


              Device Boot Start End Sectors Size Id Type
              /dev/sda1 * 2048 999423 997376 487M 83 Linux
              /dev/sda2 1001470 250068991 249067522 118.8G 5 Extended
              /dev/sda5 1001472 250068991 249067520 118.8G 8e Linux LVM


              See the Disklabel type: dos. If it shows dos that means it is MBR schema else GPT schema






              share|improve this answer
























                up vote
                4
                down vote













                Use



                $ sudo fdisk -l 

                Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 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
                Disklabel type: dos
                Disk identifier: 0x987c1a05


                Device Boot Start End Sectors Size Id Type
                /dev/sda1 * 2048 999423 997376 487M 83 Linux
                /dev/sda2 1001470 250068991 249067522 118.8G 5 Extended
                /dev/sda5 1001472 250068991 249067520 118.8G 8e Linux LVM


                See the Disklabel type: dos. If it shows dos that means it is MBR schema else GPT schema






                share|improve this answer






















                  up vote
                  4
                  down vote










                  up vote
                  4
                  down vote









                  Use



                  $ sudo fdisk -l 

                  Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 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
                  Disklabel type: dos
                  Disk identifier: 0x987c1a05


                  Device Boot Start End Sectors Size Id Type
                  /dev/sda1 * 2048 999423 997376 487M 83 Linux
                  /dev/sda2 1001470 250068991 249067522 118.8G 5 Extended
                  /dev/sda5 1001472 250068991 249067520 118.8G 8e Linux LVM


                  See the Disklabel type: dos. If it shows dos that means it is MBR schema else GPT schema






                  share|improve this answer












                  Use



                  $ sudo fdisk -l 

                  Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 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
                  Disklabel type: dos
                  Disk identifier: 0x987c1a05


                  Device Boot Start End Sectors Size Id Type
                  /dev/sda1 * 2048 999423 997376 487M 83 Linux
                  /dev/sda2 1001470 250068991 249067522 118.8G 5 Extended
                  /dev/sda5 1001472 250068991 249067520 118.8G 8e Linux LVM


                  See the Disklabel type: dos. If it shows dos that means it is MBR schema else GPT schema







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Dec 7 '16 at 17:35









                  Rakib

                  909712




                  909712




















                      up vote
                      3
                      down vote













                      In my Alpine Linux Partition scripts I use:



                      check_scheme() 
                      fdisk -l $1





                      share|improve this answer




















                      • On my Ubuntu 18.04 system fdisk -l /dev/sda | grep -i disklabel returns nothing, (GNU Fdisk 1.3.0a).
                        – agc
                        Nov 18 at 18:02














                      up vote
                      3
                      down vote













                      In my Alpine Linux Partition scripts I use:



                      check_scheme() 
                      fdisk -l $1





                      share|improve this answer




















                      • On my Ubuntu 18.04 system fdisk -l /dev/sda | grep -i disklabel returns nothing, (GNU Fdisk 1.3.0a).
                        – agc
                        Nov 18 at 18:02












                      up vote
                      3
                      down vote










                      up vote
                      3
                      down vote









                      In my Alpine Linux Partition scripts I use:



                      check_scheme() 
                      fdisk -l $1





                      share|improve this answer












                      In my Alpine Linux Partition scripts I use:



                      check_scheme() 
                      fdisk -l $1






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jun 19 '15 at 22:47









                      Stuart Cardall

                      73659




                      73659











                      • On my Ubuntu 18.04 system fdisk -l /dev/sda | grep -i disklabel returns nothing, (GNU Fdisk 1.3.0a).
                        – agc
                        Nov 18 at 18:02
















                      • On my Ubuntu 18.04 system fdisk -l /dev/sda | grep -i disklabel returns nothing, (GNU Fdisk 1.3.0a).
                        – agc
                        Nov 18 at 18:02















                      On my Ubuntu 18.04 system fdisk -l /dev/sda | grep -i disklabel returns nothing, (GNU Fdisk 1.3.0a).
                      – agc
                      Nov 18 at 18:02




                      On my Ubuntu 18.04 system fdisk -l /dev/sda | grep -i disklabel returns nothing, (GNU Fdisk 1.3.0a).
                      – agc
                      Nov 18 at 18:02

















                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f120221%2fgpt-or-mbr-how-do-i-know%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown






                      Popular posts from this blog

                      Peggy Mitchell

                      Palaiologos

                      The Forum (Inglewood, California)