0

fsck shows /dev/sda1 is okay, and uses 3811/49152 inodes and 105570/171776 blocks.

df -i and df show that /dev/sda1 uses 443/239944 inodes and 0/959776 KiB.

GParted shows /dev/sda1 uses 412.38/671.00 MiB (= 422277/687104 KiB).

Why do these tools all show different results?

# fsck /dev/sda1
fsck from util-linux 2.25.2
e2fsck 1.42.12 (29-Aug-2014)
/dev/sda1: clean, 3811/49152 files, 105570/171776 blocks
# df -i /dev/sda1
Filesystem     Inodes IUsed  IFree IUse% Mounted on
dev            239944   443 239501    1% /dev
# df /dev/sda1
Filesystem     1K-blocks  Used Available Use% Mounted on
dev               959776     0    959776   0% /dev
# gparted
======================
libparted : 3.2
======================
2

fsck is telling you that 105570/171776 blocks are used, not KiB.

As for df, your example shows the df results for the wrong filesystem. It shows the usage stats for /dev (an in-memory filesystem), not for the filesystem you thought you were measuring. That is because df takes as an argument the mountpoint of the mounted filesystem, not the block device.

As for gparted, that's a tool for configuring partitions, not filesystems. It is more likely to tell you how much of the whole disk a partition fills up than it is to tell you how much data is used on the filesystem that happens to be inside one of the partitions.

If you wish to know how much space is used on this filesystem, you should first mount it somewhere (if if isn't already), then issue df on that mount point. For example:

df -h /mnt   # block counts
df -i /mnt   # inode counts
  • Ahh, I can't believe I didn't notice Filesystem dev in the output of df. Thanks! – Zaz Feb 18 '15 at 13:48
  • You can pass a block device to df, but only while it's mounted. mount /dev/sda1 /mnt && df /dev/sda1 would show the desired values. – Gilles Feb 18 '15 at 23:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.