Software & AppsOperating SystemLinux

How To Check if Your Disk is Using GPT or MBR in Ubuntu Terminal

Ubuntu 16

In this article, we will explore how to determine whether your disk is using the GUID Partition Table (GPT) or the Master Boot Record (MBR) partitioning scheme in Ubuntu terminal. Both GPT and MBR are technologies used to store partitioning information on your disk. Understanding which one your system is using can be crucial when dealing with system administration tasks such as disk resizing, system recovery, and more.

Understanding GPT and MBR

Before we dive into the methods, let’s briefly understand what GPT and MBR are.

MBR (Master Boot Record) is an older disk-type first introduced with IBM PC DOS 2.0 in 1983. It’s called Master Boot Record because the MBR is a special boot sector located at the beginning of a drive. This sector contains a boot loader for the installed operating system and information about the drive’s logical partitions. The boot loader is a small bit of code that generally loads the larger boot loader from another partition on a drive.

GPT (GUID Partition Table) is a standard for the layout of the partition table of a physical computer storage device, such as a hard disk drive or solid-state drive. It’s a more modern, robust, and flexible replacement for the older MBR. It overcomes various limitations of MBR and is part of the Unified Extensible Firmware Interface (UEFI) standard.

Checking Disk Type in Ubuntu Terminal

There are several ways to check if your disk is using GPT or MBR in Ubuntu terminal. We will be covering four methods using different commands: gdisk, parted, fdisk, and lshw.

Using gdisk

gdisk is a GPT fdisk program, used for the creation and manipulation of partition tables.

  1. First, you need to install the gdisk utility. Open your terminal and type the following command:
sudo apt-get install gdisk
  1. After the installation, you can check the partition type with the following command:
sudo gdisk -l /dev/sda

Please replace /dev/sda with your device.

In the output, if you see “MBR: MBR only” under “Partition table scan”, then your disk is using MBR. If you see “MBR: protective” and “GPT: present”, then your disk is using GPT.

Using parted

parted is a disk partitioning and partition resizing program. It allows you to create, destroy, resize, move, and copy ext2, linux-swap, FAT, FAT32, and reiserfs partitions.

  1. Install the parted utility by running the following command:
sudo apt-get install parted
  1. Run the following command to check the partition type:
parted /dev/sda print | grep -i '^Partition Table'

Replace /dev/sda with your device.

If the output shows “Partition Table: msdos”, then your disk is using MBR. If it shows “Partition Table: gpt”, then your disk is using GPT.

Using fdisk

fdisk is a command-line utility that provides disk partitioning functions. It is available by default in most Linux distributions.

To check the partition type, run the following command:

sudo fdisk -l /dev/sda

Replace /dev/sda with your device.

Look for the line that says “Disklabel type”. If it shows “gpt”, then your disk is using GPT. If it shows “msdos”, then your disk is using MBR.

Using lshw

lshw is a small tool to extract detailed information on the hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc.

To check the partition type, run the following command:

sudo lshw -C disk

Look for the line that says “capabilities”. If it shows “partitioned partitioned:gpt”, then your disk is using GPT.

Conclusion

Understanding whether your disk is using GPT or MBR is crucial for system administration tasks. The methods above should provide you with a clear understanding of how to check your disk type using Ubuntu terminal. Remember to replace /dev/sda with your actual device in the commands above.

What is the difference between GPT and MBR?

GPT (GUID Partition Table) and MBR (Master Boot Record) are two different partitioning schemes used to store partitioning information on a disk. GPT is a more modern and flexible standard that overcomes the limitations of MBR. It is part of the UEFI (Unified Extensible Firmware Interface) standard.

How can I check if my disk is using GPT or MBR in Ubuntu terminal?

There are several methods to check the partition type in Ubuntu terminal. You can use commands like gdisk, parted, fdisk, or lshw. Each command provides different outputs that indicate whether your disk is using GPT or MBR. Please refer to the article above for detailed instructions on each method.

How do I install the `gdisk` utility in Ubuntu?

To install the gdisk utility in Ubuntu, open your terminal and run the command sudo apt-get install gdisk. This command will install the gdisk package from the default repositories.

What is the purpose of the `parted` utility?

The parted utility is a disk partitioning and resizing program. It allows you to create, destroy, resize, move, and copy different types of partitions, such as ext2, linux-swap, FAT, FAT32, and reiserfs. It is a powerful tool for managing disk partitions on Linux systems.

How can I check the partition type using the `fdisk` command?

To check the partition type using the fdisk command, open your terminal and run the command sudo fdisk -l /dev/sda. Replace /dev/sda with the appropriate device name. Look for the line that says "Disklabel type" in the output. If it shows "gpt", then your disk is using GPT. If it shows "msdos", then your disk is using MBR.

What does the “capabilities” line indicate when using the `lshw` command?

When using the lshw command, the "capabilities" line indicates the capabilities of a disk. If it shows "partitioned partitioned:gpt", it means that the disk is using GPT partitioning.

Leave a Comment

Your email address will not be published. Required fields are marked *