View Full Version : [ubuntu] Make fdisk display size in MB?
oxsyn
April 24th, 2008, 02:33 AM
If I do "sudo fdisk -l" I see the disk size in blocks. Is there a way to display it in MB?
Monicker
April 24th, 2008, 02:38 AM
If I do "sudo fdisk -l" I see the disk size in blocks. Is there a way to display it in MB?
The total size of the disk, or each partition on the disk? fdisk -l shows the size of the drive as the top line.
For seeing the size of partitions in megabytes, do "df -h"
SOULRiDER
April 24th, 2008, 03:13 AM
For seeing the size of partitions in megabytes, do "df -h"
I believe that will only show size of mounted partitions and not all partitions.
niteshifter
April 24th, 2008, 03:48 AM
Hi,
If I do "sudo fdisk -l" I see the disk size in blocks. Is there a way to display it in MB?
With fdisk, no. Size in blocks is all there is. However these two utilities will:
There's sfdisk:
sudo sfdisk -l -uM
which generates a report ala fdisk. The -uM specifies report sizes in MB.
There's also cfdisk:
sudo cfdisk
Press the u key to cycle through the size in sectors, cylinders or M-bytes.
Press Shift+Q to exit cfdisk.
Of the two sfdisk is the safest one to use for inspection. I'd avoid cfdisk unless / until one has some experience using ncurses-based console programs.
Both are in the repositories, but usually are already installed.
Gen2ly
April 11th, 2009, 08:35 AM
Never found a way to have fdisk display in MBs but blocks can be easily converted to megabytes with bc:
echo "BLOCKS/(2^20)" | bc
Gigabytes are 2^30.
forger
July 9th, 2009, 02:00 AM
sudo parted -l ;)
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.