• Quotes
  • Index
  • About
AOssama.NET Technical Notes

Quick Note: Find partition size in GB from fdisk

January 8, 2011 12:45 pm / Ahmed

I am a big fan of fdisk, and since the output of fdisk is the block size of each partition I had to find a way to know how much each partition’s size in GB…

Do the regular fdisk command, and note the block size:

# fdisk -l /dev/sda

output omitted…
Device Boot Start End Blocks Id System
/dev/xvdc1 * 1 2871 23061276 83 Linux
…output omitted

Then using bc (An arbitrary precision calculator language) do:

# echo “23061276/(2^20)” | bc

21

Which will output the partition size in GB

Posted in: FreeBSD, Linux / Tagged: fdisk, FreeBSD, Linux

Comments are closed.

Post Navigation

← Previous Post
Next Post →

Categories

  • Apache (1)
  • Asterisk (2)
  • bind9 (1)
  • FreeBSD (9)
  • iSCSI (2)
  • Linux (12)
  • Netcat (1)
  • Networking (3)
  • Penetration Testing (1)
  • PHP (2)
  • Squid (2)

Archives

  • January 2013 (1)
  • April 2012 (3)
  • May 2011 (1)
  • January 2011 (1)
  • September 2010 (1)
  • August 2010 (1)
  • June 2010 (3)
  • May 2010 (1)
  • November 2009 (2)
  • October 2009 (9)
  • September 2009 (2)

Meta

  • Register
  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
© Copyright 2013 - AOssama.NET
Infinity Theme by DesignCoral / WordPress