LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-20-2017, 04:05 AM   #1
vijaymaurya
LQ Newbie
 
Registered: Jan 2017
Posts: 23

Rep: Reputation: Disabled
fdisk -l shows different size than lsblk, and


Hi All,

We have added 300 GB disk from in VM but when we run fdisk -l shows 322GB.

fdisk -l /dev/sdc1
Disk /dev/sdc1: 322.1 GB, 322118383104 bytes, 629137467 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

lsblk
sdc 8:32 0 300G 0 disk
└─sdc1 8:33 0 300G 0 part /mnt

Kindly help how fdisk -l calculate the disk size and shows 322 GB instead of 300 GB.
 
Old 09-20-2017, 04:49 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Read this.
 
Old 09-20-2017, 04:58 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
To elaborate the above...

The default output of the lsblk command is in human readable format.

1GB = 1,073,741,824 Bytes

If you use the -b i.e lsblk -b option you will see that they match.

Here is an example from one of my computers
Code:
fdisk shows      Disk /dev/sda: 160.0 GB, 160041885696 bytes
lsblk shows   sda      8:0    0 149.1G  0 disk  <- 160,041,885,696 / 1,073,741,824
lsbl -b shows sda      8:0    0 160041885696  0 disk

Last edited by michaelk; 09-20-2017 at 05:06 AM.
 
Old 09-21-2017, 02:45 AM   #4
vijaymaurya
LQ Newbie
 
Registered: Jan 2017
Posts: 23

Original Poster
Rep: Reputation: Disabled
Thanks to all of you for your support.

Here i found the solution, why fdisk show different disk size than lsblak or df -h.

fdisk only calculate the values by dividing the disk size in bytes by 1000 instead of 1024, that's why you see the discrepancy in the value.

If you simply divide the value 322122547200 (in bytes) by 1000 three times, it will give you 322 GB size. And if you divide the same value by 1024, it will give you 300 GB size.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
"lsblk" sees flash drive but "fdisk -l" does not themohawkninja Linux - Newbie 5 06-13-2017 01:42 PM
[SOLVED] fdisk shows logical sector size smaller than physical sector size? enine Slackware - Installation 5 09-03-2014 11:57 AM
fdisk lsblk, parted do not work eliassal Linux - Newbie 4 06-25-2014 11:38 PM
Fdisk shows logical sector size smaller than physical sector size after clonezilla narnie Linux - Hardware 12 07-03-2013 09:01 PM
Extended a LV size, but df shows orig size, using DEBIAN ETCH, on a AMD64 hector3rd Linux - Newbie 8 04-23-2008 05:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration