Making `fdisk -l` display partition sizes by GB/MB

How to make fdisk -l display partition sizes by bytes instead of sectors?

asked Dec 14, 2014 by Eric Z Ma (44,280 points)

1 Answer

 
Best answer

fdisk does not have such options as far as I know.

However, good news is that you can use parted:

# parted -l

It will print partition info like

# parted -l
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/fedora_vm235-swap: 2164MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system     Flags
 1      0.00B  2164MB  2164MB  linux-swap(v1)


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/fedora_vm235-root: 18.8GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system  Flags
 1      0.00B  18.8GB  18.8GB  ext4


Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  525MB   524MB   primary  ext4         boot
 2      525MB   21.5GB  20.9GB  primary               lvm


Model: Xen Virtual Block Device (xvd)
Disk /dev/xvdb: 537GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  537GB  537GB  primary  ext4


Model: Xen Virtual Block Device (xvd)
Disk /dev/xvdc: 999GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  537GB  537GB  primary  ext4
 2      537GB   999GB  462GB  primary  ext4


Model: Xen Virtual Block Device (xvd)
Disk /dev/xvdd: 1979GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  1979GB  1979GB  primary  ext4
answered Dec 14, 2014 by Eric Z Ma (44,280 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...