2

we can print all disks by the following ( on our RHEL machine )

fdisk -lu | grep "Disk /dev"
Disk /dev/sda: 247.0 GB, 246960619520 bytes, 482344960 sectors
Disk /dev/sdb: 4294 MB, 4294967296 bytes, 8388608 sectors
Disk /dev/sdc: 4294 MB, 4294967296 bytes, 8388608 sectors
Disk /dev/sdd: 4294 MB, 4294967296 bytes, 8388608 sectors
Disk /dev/sde: 4294 MB, 4294967296 bytes, 8388608 sectors

as we can see above disks are in GB and not in GIB

note:

GB is the traditional, metric style of measurement with 1 GB equaling 1,000³ bytes.

GiB is the binary method; which is the way computers measure data at 1024³ bytes.

any option by using fdisk or sfdisk or maybe other manipulation in order to print the disks size with GIB ?

terdon
  • 234,489
  • 66
  • 447
  • 667
yael
  • 12,598
  • 51
  • 169
  • 303

1 Answers1

1

From fdisk man page:

In the case the size is specified in bytes than the number may be followed by the multiplicative suffixes KiB=1024, MiB=1024*1024, and so on for GiB, TiB, PiB, EiB, ZiB and YiB. The "iB" is optional, e.g., "K" has the same meaning as "KiB".

For backward compatibility fdisk also accepts the suffixes KB=1000, MB=1000*1000, and so on for GB, TB, PB, EB, ZB and YB. These 10^N suffixes are deprecated.

IOW, you'll need to patch it and it doesn't sound likely that your patch will ever be accepted/merged.

Here's the obvious rationale behind it: all modern storage devices operate with either 512 or 4096 bytes sectors - the latter becoming more and more ubiquitous. 1MB is not even divisible by either 512 or 4096.

Artem S. Tashkinov
  • 26,392
  • 4
  • 33
  • 64