Disk Size Inconsistency – fdisk vs parted

diskmanagementlinuxlvmpartedpartition

I have noticed some difference in size displayed using parted and fdisk. I have a disk attached with a size of 20GB. Executing the fdisk command shows that the size is 20GB which is correct.

fdisk -l /dev/nvme0n1
Disk /dev/nvme0n1: 20 GiB, 21474836480 bytes, 41943040 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: 0x22c4d209

On the other hand, using parted the disk size is 21.5GB

parted /dev/nvme0n1
GNU Parted 3.2
Using /dev/nvme0n1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: NVMe Device (nvme)
Disk /dev/nvme0n1: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Why does parted show a larger disk size?

Best Answer

fsdisk shows 20 GiB, which means 20 gibibyte. this equals to 20 * 2^30 = 21474836480 bytes

This is rounded by parted to 21.5 gigabyte (GB).

Related Topic