8

What is the equivalent for GPT using HDDs of:

# fdisk -l /dev/hda > /mnt/sda1/hda_fdisk.info

I got this from https://wiki.archlinux.org/index.php/disk_cloning (under "Create disk image") for getting the extra hdd info which may be important for restoring or extracting from multi-partition images.

When I do this I get an error similar to:

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

6

some unix partitioner, are deperecated and GPT partition table is new and some tools doesn't work GPT. GNU parted is new and gparted is GNOME Parted

for example:

root@debian:/home/mohsen# parted -l /dev/sda
Model: ATA WDC WD7500BPVT-7 (scsi)
Disk /dev/sda: 750GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type      File system     Flags
 1      32.3kB  41.1MB  41.1MB  primary   fat16           diag
 2      41.9MB  2139MB  2097MB  primary   fat32           boot
 3      2139MB  52.1GB  50.0GB  primary   ext4
 4      52.1GB  749GB   697GB   extended
 5      52.1GB  737GB   685GB   logical   ext4
 6      737GB   749GB   12.0GB  logical   linux-swap(v1)

NOTE: GPT is abbrivation of GUID Partition Table and much new. GPT

  • 2
    Note: you may need sudo parted -l if you're not root. Otherwise the output comes blank which may be confusing. – Camilo Martin Jan 21 '15 at 4:50
  • 2
    @CamiloMartin You say true, But when i put # in my shell , it mean i'm root. – PersianGulf Jan 21 '15 at 6:14
  • 1
    Yes, just mentioning because it's one of a few commands that won't give an error/warning message when not root and just fail silently. – Camilo Martin Jan 21 '15 at 21:12
  • Yes, it's high risk. – PersianGulf Jan 22 '15 at 1:06
6

The fdisk equivalent is gdisk, which is commonly available in the gptfdisk package via package manager. You'd do much better to use it, in my opinion. I don't trust anything *parted, personally - any partition tool that simultaneously partitions and formats is not a partition tool.

  • The package name is gdisk at least in Ubuntu and CentOS/RedHat. – Pavel Tankov Aug 25 '16 at 6:32
2

Recent versions of fdisk do support GPT, see here.

For example, on a disk with GPT, I get the following:

fdisk from util-linux 2.23.2 in RedHat / CentOS 7.2 says:

# fdisk -l /dev/sdb
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sdb: 1000.0 GB, 999989182464 bytes, 1953103872 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 label type: gpt

#         Start          End    Size  Type            Name
 1         2048   1953103838  931,3G  Linux filesyste Linux filesystem

fdisk from util-linux 2.27.1 in Linux Mint 18 / Ubuntu 16.04 LTS (Xenial Xerus) says:

# fdisk -l /dev/sda
Disk /dev/sda: 223,6 GiB, 240057409536 bytes, 468862128 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: gpt
Disk identifier: 36CB5C9A-A274-43A0-9EBF-A4C457FFC56F

Device      Start       End   Sectors   Size Type
/dev/sda1    2048    526335    524288   256M EFI System
/dev/sda2  526336 468862094 468335759 223,3G Linux filesystem

and does not complain whatsoever.

But still, I would use gdisk as mikeserv suggested.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.