You are not logged in.
I noticed recently a 4GB discrepancy between my main arch filesystem on /dev/sda2 and the partition it is on: my partition is 226GB according to fdisk -l, while my filesystem is 222GB according to df-h.
df -h
Filesystem Size Used Avail Use% Mounted on
dev 3.9G 0 3.9G 0% /dev
run 3.9G 1.1M 3.9G 1% /run
/dev/sda2 222G 137G 74G 65% /
tmpfs 3.9G 4.1M 3.9G 1% /dev/shm
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
tmpfs 3.9G 988K 3.9G 1% /tmp
/dev/sda1 7.8G 208M 7.6G 3% /boot/efi
tmpfs 787M 28K 787M 1% /run/user/1000
Notice that when using df -h there is 12 GB missing (if you add used and available 12GB is missing to reach 222GB size), this is due to 5% of my fs being reserved and is normal behaviour. Therefore, the 4GB missing are not due to this!
fdisk -l
Disk /dev/sda: 238.5 GiB, 256060514304 bytes, 500118192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 3785BDD8-2C2D-4828-B9B7-82A5C37FC96B
Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 474951679 473901056 226G Linux root (x86)
/dev/sda3 474951680 500118158 25166479 12G Linux swap
After some research i found out this might be cause by the fs not occupying the whole partition, however it is not the case, as shown by the command resize2fs /dev/sda2.
resize2fs /dev/sda2
resize2fs 1.43.4 (31-Jan-2017)
The filesystem is already 59237632 (4k) blocks long. Nothing to do!
From what i've seen on other topics and on the wiki, this is not normal behaviour, but i have no idea what could cause this and cannot find anything. Any ideas how to recover my 4GB? I'm quite tight!
Last edited by Shaih (2017-03-26 21:55:44)
Offline
What does "df -H" (capital H, not small h) or just "df" (with no arguments) tell you?
Last edited by 2ManyDogs (2017-03-26 21:32:34)
Offline
What does "df -H" (capital H, not small h) or just "df" (with no arguments) tell you?
that wouldn't be it, 226GB is 210GiB.
the issue is that inodes occupy space as well. disks don't just store data, they also store information about what the data actually contains, and where that data is. those are inodes on Unix filesystems. they occupy around 1.6% of disk space, which for 226GB works out to 3.39GB. you're right around the correct usage, and I'm sure if you removed the -h from df, you'd see a similar max file system size.
Offline
Oh so i guess my units were all wrong: fdisk does not use GB as unit. However this still makes no sense to me:
df -H
Filesystem Size Used Avail Use% Mounted on
dev 4.2G 0 4.2G 0% /dev
run 4.2G 1.1M 4.2G 1% /run
/dev/sda2 238G 147G 80G 65% /
tmpfs 4.2G 0 4.2G 0% /dev/shm
tmpfs 4.2G 0 4.2G 0% /sys/fs/cgroup
tmpfs 4.2G 8.2k 4.2G 1% /tmp
/dev/sda1 8.4G 218M 8.2G 3% /boot/efi
tmpfs 826M 8.2k 826M 1% /run/user/1000
/dev/sda2 is 238G while fdisk -l tells me it is 226G... Unless i should factor in the swap (12G), but I don't see why it would be included (according to df man https://linux.die.net/man/1/df )
Same with parted -l and df -h both using GB..
Offline
the issue is that inodes occupy space as well. disks don't just store data, they also store information about what the data actually contains, and where that data is. those are inodes on Unix filesystems. they occupy around 1.6% of disk space, which for 226GB works out to 3.39GB. you're right around the correct usage, and I'm sure if you removed the -h from df, you'd see a similar max file system size.
Ok this explains that. Unfortunately i couldn't find anything searching the web/wiki about that. I'll mark this thread as solved.
Offline