Title says it all really - df and du showing incorrect data for /dev/sda4. Pastes below show what I mean - as far as I can see I’m only actually using ~100GB on /home.
Could be btrfs perhaps?
On 09/12/2012 04:36 PM, spoovy wrote:
> Could be btrfs perhaps?
> drbunsen:~ # ls /home
> .snapshots spoovy
du estimates file space usage while df measures and reports file space
usage…therefore differences for those reasons alone are expected…
and, if you look inside /home/.snapshots you will probably find that
btrfs has PACKED your home full of “snapshots” of your file system at
various times during its life…
i have no idea how to tame that btrfs critter…someone else will have
to help you with that…
Isn’t it df that estimates and du that actually calculates it? In any case it wouldn’t account for a >2TB discrepancy. I know btrfs is still pretty experimental but I’d hoped to get past 24hrs install time before my OS became unusable! (this was a reinstall by the way so the /home filesystem - the problem one - is full of my own data.
It seems that the .snapshot directly is indeed full of snapshots. These are divided up into several directories generally 122-140GB in size and apparnetly totalling 3TB - despite the fact that they’re on a 320GB disk.
These directories seem to be un-deletable. I’ve deleted the snapshots using snapper, but the directories remain. I’ve tried from system rescue CD too - still no good. Always the rm error says it’s a read-only filesystem, despite the fact that it is mounted rw and I have chmod’d it to 777.
How to delete the blighters? Or completely reset snapper somehow?
On 09/12/2012 08:26 PM, spoovy wrote:
>
> Isn’t it df that estimates and du that actually calculates it?
from man du “du - estimate file space usage”
from man df “df - report file system disk space usage”
as said: i have no idea how to manage btrfs–because with only 14 years
of Linux experience i don’t want to subject my data to experimental file
systems in the hands of a novice btrfs user (me)…
if i had another system with data i didn’t care about loosing btrfs
would be a good thing to try out, for fun…
“df” reports allocated sectors, whether they are referenced or not.
“du” reports file listing by going down the directory tree.
The most common cause of a discrepancy, is that there can be files that exist (so allocated space is shown by “df”), although files are not listed in any directory. Typically, a program has the file open. Once that program ends, the space will be freed, and “df” will stop listing it.
I’m not a btrfs expert. But it looks as if space can be allocated to files in a snapshot, but what is in a snapshot won’t show in an ordinary directory search. I presume that older snapshots are freed up, when space becomes short. But that’s only a guess.