Linux check hard disk size command

 

How to check hard disk size on Linux

 

   The step by step example below show how to check hard disk size on Linux system using command.  There is may command that you can use on Linux system to check the hard disk size, and this article only show 3 example of linux command (df command, fdisk command and hdparm command) that you can use to show hard disk size on your Linux system…

 

Check Hard disk size using df command.  

 

The command example below show the output from df command (df - report file system disk space usage) that display hard disk size.

 

1.  Open shell terminal and type in df -H and hit enter key.

Check Hard disk size using df command

[root@fedora ~]# df -H

Filesystem             Size   Used  Avail Use% Mounted on

rootfs                 488G   9.3G   454G   3% /

udev                   1.1G      0   1.1G   0% /dev

tmpfs                  1.1G   455k   1.1G   1% /dev/shm

tmpfs                  1.1G   705k   1.1G   1% /run

/dev/mapper/VolGroup-lv_root

                       488G   9.3G   454G   3% /

tmpfs                  1.1G      0   1.1G   0% /sys/fs/cgroup

tmpfs                  1.1G      0   1.1G   0% /media

/dev/sda1              508M    78M   405M  17% /boot

/dev/mapper/VolGroup-lv_root

                       488G   9.3G   454G   3% /tmp

/dev/mapper/VolGroup-lv_root

                       488G   9.3G   454G   3% /var/tmp

/dev/mapper/VolGroup-lv_root

                       488G   9.3G   454G   3% /home

[root@fedora ~]#

 

Check Hard disk size using fdisk command.  

 

The command example below show the output from fdisk command (fdisk -l List the partition tables for the specified devices) that display total hard disk size.

 

1.  Open shell terminal and type in fdisk -l and hit enter key.

Check Hard disk size using fdisk command

[root@fedora ~]# fdisk -l

 

Disk /dev/sda: 500.1 GB, 500107862016 bytes

255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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

Disk identifier: 0x01580157

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     1026047      512000   83  Linux

/dev/sda2         1026048   976773119   487873536   8e  Linux LVM

 

Disk /dev/mapper/VolGroup-lv_swap: 4227 MB, 4227858432 bytes

255 heads, 63 sectors/track, 514 cylinders, total 8257536 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

Disk identifier: 0x00000000

 

Disk /dev/mapper/VolGroup-lv_swap doesn't contain a valid partition table

 

Disk /dev/mapper/VolGroup-lv_root: 495.3 GB, 495330525184 bytes

255 heads, 63 sectors/track, 60220 cylinders, total 967442432 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

Disk identifier: 0x00000000

 

Disk /dev/mapper/VolGroup-lv_root doesn't contain a valid partition table

[root@fedora ~]#

 

Check hard disk size using hdparm command.  

 

The command example below show the output from hdparm command (hdparm - get/set SATA/IDE device parameters) that display hard disk size in GB.

 

1.  Open shell terminal and type in hdparm -I /dev/sda |grep and hit enter key.

Check hard disk size using hdparm command

[root@fedora ~]# hdparm -I /dev/sda |grep "device size"

        device size with M = 1024*1024:      476940 MBytes

        device size with M = 1000*1000:      500107 MBytes (500 GB)

[root@fedora ~]#

 

Please note :- that all command example display on above example are executed on Linux Fedora 15 machine... the output may vary base on your machine use, operating system and command version

 

Keywords:  hard disk size, check hard disk size, linux hard disk size, linux check hard disk size, show hard disk size

 

aaaaaaaaaaa