Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between df-h and fdisk command [closed]

Tags:

linux

We know that df -h command shows disk usage in human readable format and fdisk command shows all the disks used in the linux partition.

But when i am giving df -h command the following output has been shown:

**Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0       18G  2.9G   14G  18% /
udev            1.4G  4.0K  1.4G   1% /dev
tmpfs           576M  888K  575M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            1.5G  160K  1.5G   1% /run/shm
none            100M   56K  100M   1% /run/user
/dev/sda5       140G   52G   88G  38% /host
/dev/sr0        225M  225M     0 100% /media/aritradas/McAfee
/dev/sda3       150G   59G   91G  40% /media/aritradas/OS**

At the same time when i am giving fdisk -l command the following output has been shown:

   **Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63      257039      128488+  de  Dell Utility
/dev/sda2   *      258048    20979711    10360832    7  HPFS/NTFS/exFAT
/dev/sda3        20979712   333627391   156323840    7  HPFS/NTFS/exFAT
/dev/sda4       333627392   625139711   145756160    f  W95 Ext'd (LBA)
/dev/sda5       333629440   625139711   145755136    7  HPFS/NTFS/exFAT**

From the above mentioned outputs it is clear that in the first output only /dev/sda3 and /dev/sdba5 is displayed. But in the second output /dev/sda1,/dev/sda2,/dev/sda3,/dev/sda4,/dev/sda5 are displayed.

Kindly let me know the why this difference between df -h and fdisk -l commands exists.

like image 431
user1988366 Avatar asked Dec 12 '22 15:12

user1988366


1 Answers

df -h displays all of the mounted partitions.

fdisk -l displays all of the partitions that exist on your disk.

Apparently there are some partitions which exist, but which are not mounted.

like image 174
Robᵩ Avatar answered Jan 03 '23 06:01

Robᵩ