df and du showing incorrect info on new 12.2 install

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?

drbunsen:~ # df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 41G 9.4G 30G 25% /
devtmpfs 3.9G 16K 3.9G 1% /dev
tmpfs 3.9G 816K 3.9G 1% /dev/shm
tmpfs 3.9G 732K 3.9G 1% /run
/dev/sda3 41G 9.4G 30G 25% /
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
tmpfs 3.9G 732K 3.9G 1% /var/run
tmpfs 3.9G 732K 3.9G 1% /var/lock
tmpfs 3.9G 0 3.9G 0% /media
/dev/sda1 156M 816K 156M 1% /boot/efi
/dev/sda4 256G 220G 26G 90% /home

drbunsen:~ # du -hs /home
3.1T /home

drbunsen:~ # ls /home
.snapshots spoovy

drbunsen:~ # du -hs /home/.snapshots/
3.0T /home/.snapshots/

drbunsen:~ # mount | grep /home
/dev/sda4 on /home type btrfs (rw,relatime,space_cache)

drbunsen:~ # parted -l
Model: ATA TOSHIBA MK3261GS (scsi)
Disk /dev/sda: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 1049kB 165MB 164MB fat16 primary boot
2 165MB 2319MB 2155MB linux-swap(v1) primary
3 2319MB 45.3GB 43.0GB primary
4 45.3GB 320GB 275GB primary

Pl;ease, please, please, use CODE tags around computer text: http://forums.opensuse.org/english/information-new-users/advanced-how-faq-read-only/451526-posting-code-tags-guide.html

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…

maybe
https://www.google.com/search?q=site%3Aopensuse.org+btrfs+snapshots+filling+hard+disk+solution

or, if that fails try:

https://www.google.com/search?q=btrfs+snapshots+filling+hard+disk+solution


dd http://goo.gl/PUjnL
http://tinyurl.com/DD-Caveat

On 09/12/2012 05:16 PM, hcvv wrote:
> Pl;ease, please, please, use CODE tags around computer text:

or teach/force vBulletin to respect spaces and tabs, rather than dump
the “white space” as does html normally…

i say because nntp does that and i see his post nice and well formed as
http://susepaste.org/17160107


dd http://goo.gl/PUjnL

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?

Ta

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…


dd http://goo.gl/PUjnL

“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.

This was royally borked so I’ve just nuked it and created an ext4 fs instead. Still got btrfs on the / though, so fingers crossed!