Why df -h and lsblk show different sizes of my one and only xvda1?

enter image description here

So when i do lsblk, it shows that my xvda1 size is 10 GB. but when i do df -h, it shows that my xvda1 size is 7.7 GB

Upvotes: 5

Views: 8650

Answers (2)

erfan tarighi
erfan tarighi

Reputation: 5

  1. If the partition the file system is on is currently mounted, unmount it.

For example

umount /dev/vdb1

  1. Run fsck on the unmounted file system.

For example

e2fsck /dev/vdb1
e2fsck 1.41.12 (17-May-2010)
Pass 1:Checking inodes, blocks, and sizes
Pass 2:Checking directory structure
Pass 3:Checking directory connectivity
Pass 4:Checking reference counts
Pass 5:Checking group sumary information
ext4-1:11/131072 files (0.0% non-contiguous),27050/524128 blocks
  1. Resize the file system with the resize2fs /dev/device command.

For example

resize2fs /dev/vdb1
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/vdb1 to 524128 (1k) blocks.
The filesystem on /dev/vdb1 is now 524128 blocks long.

Mount the file system and partition.

Upvotes: 0

Sangam Belose
Sangam Belose

Reputation: 4506

because the commands work differently.

lsblk: Use lsblk command to view your available disk devices and their mount points (if applicable) to help you determine the correct device name to use. The output of lsblk removes the /dev/ prefix from full device paths. It tells you the size of volume and partition(which in your case both 10 GB).

df-h:Use df -h command to verify the size of the file system for each volume. Sometimes the size of the filesystem might be default, so you need to extend that using resize2fs or xfs_growfs commands depending on the type of file system.

For more details please check: recognize-expanded-volume-linux

Upvotes: 7

Related Questions