Page 1 of 3

[SOLVED] Drive space disappearing with BTRFS...

Posted: Wed Jan 04, 2023 4:40 am
by Death

What I've figured out after further testing:

1 . If I add new files to the drive, the filesystem size increases and free space decreases proportionately. If I remove these same files, the inverse happens.

2 . If I delete any existing files from the file system, the file system shrinks but no space is freed up. So, everytime I delete any existing files, that space is simply lost. Because of this I am now down by 100s of GBs of drive space and I've no idea what's happening to it all.

Solution: In '/run.BtrfsAssistant' there were 3 folders labelled 'root_backup_' plus a bunch of numbers on the ends of the names which looks to represent time & date. Deleting all 3 of them freed up the space I was expecting. There was also another folder in this directory, simply called 'root'; Yeh, don't delete that one like me :lol: (viewtopic.php?p=151830#p151830)

Original post:

I'm using Nobara (Fedora, basically) on a 1TB SSD with the BTRFS file system. Recently I decided to uninstall some games and found that afterwards there was no space freed up. I then deleted all of the BTRFS snapshots on the drive and while it did free up some space, it wasn't as much as it should've been - about half actually. So it seemed that more than 100GB of space just went missing somewhere (& likely more at other times) :shock:

I've stopped using BTRFS snapshots and am instead just using Rsync backups of the system files onto an external drive and this first full backup is about 27GB. So now there should be no BTRFS snapshots taking up room on the system drive & I've also used Bleachbit (including in root mode) to clean unneeded files.

Now when I use 'Disk Usage Analyser' to look this 1TB SSD (which it recognises as 998.5GB), it shows that the whole Nobara install (including user files) is taking up 650GB with the largest folder being the Home folder at 628GB. The contents & size of the home folder seem to make sense to me and if you add to it the 27GB for the system files, it comes to about 655GB which seems about right. So, free space should be somewhere close to 350GB. However, the reported free space is only 75GB! So what the hell has happened to the other 275GB? There's a FAT & an EXT4 partition on the drive also but they come to less than 2GB combined so it's not them. There's no unused space on the drive either as the Nobara partition is 999GB according to the GNOME Disks software.

I don't get it.. Any ideas!?

Edit: I have also tried scrub & balance, multiple times just to see if they'd help but they didn't.

1.jpg
1.jpg (9.97 KiB) Viewed 3576 times
2.jpg
2.jpg (99.64 KiB) Viewed 3576 times

Re: Drive space disappearing with BTRFS...

Posted: Wed Jan 04, 2023 6:50 am
by erlkönig

Have a look allt ~/.local:

Code: Select all

du -sch ~/.local/share/Trash/

Re: Drive space disappearing with BTRFS...

Posted: Wed Jan 04, 2023 7:54 am
by ycollette

With btrfs, du command doesn't report all disk usage.
Check this web page to see how to check disk usage on btrfs:
https://www.thegeekdiary.com/how-to-che ... balancing/


Re: Drive space disappearing with BTRFS...

Posted: Wed Jan 04, 2023 8:03 am
by erlkönig

oh, i didn't know that. What does it leave out? But it should show the size under Trash, shouldn't it?


Re: Drive space disappearing with BTRFS...

Posted: Wed Jan 04, 2023 10:58 am
by Kott

Re: Drive space disappearing with BTRFS...

Posted: Wed Jan 04, 2023 1:31 pm
by Death

Ok. A few things there so I'll try them all out..

erlkönig wrote: Wed Jan 04, 2023 6:50 am

Have a look allt ~/.local:

Code: Select all

du -sch ~/.local/share/Trash/

I get:

Code: Select all

[z@fedora ~]$ du -sch ~/.local/share/Trash/
17M	/home/z/.local/share/Trash/
17M	total
ycollette wrote: Wed Jan 04, 2023 7:54 am

With btrfs, du command doesn't report all disk usage.
Check this web page to see how to check disk usage on btrfs:
https://www.thegeekdiary.com/how-to-che ... balancing/

Code: Select all

[z@fedora ~]$ sudo btrfs fi show
[sudo] password for z: 
Label: 'nobara_localhost-live'  uuid: [Redacted]
	Total devices 1 FS bytes used 855.48GiB
	devid    1 size 929.93GiB used 879.06GiB path /dev/sda3

Code: Select all

[z@fedora ~]$ btrfs filesystem du /btr
     Total   Exclusive  Set shared  Filename
ERROR: cannot check space of '/btr': No such file or directory

Code: Select all

[z@fedora ~]$ btrfs filesystem usage /btr
ERROR: cannot access '/btr': No such file or directory

As for balancing, I've ran a few of those and scrubs already via a program called 'Btrfs assistant' (which I was also using for snapshots) just on the chance they might help but it made no difference..

Code: Select all

[z@fedora ~]$ sudo btrfs filesystem show /
[sudo] password for z: 
Label: 'nobara_localhost-live'  uuid: [Redacted]
	Total devices 1 FS bytes used 855.49GiB
	devid    1 size 929.93GiB used 879.06GiB path /dev/sda3

Code: Select all

[z@fedora ~]$ sudo btrfs filesystem df /
Data, single: total=868.00GiB, used=851.47GiB
System, DUP: total=32.00MiB, used=128.00KiB
Metadata, DUP: total=5.50GiB, used=4.02GiB
GlobalReserve, single: total=512.00MiB, used=0.00B

Code: Select all

[z@fedora ~]$ sudo btrfs filesystem usage /
Overall:
    Device size:		 929.93GiB
    Device allocated:		 879.06GiB
    Device unallocated:		  50.86GiB
    Device missing:		     0.00B
    Device slack:		     0.00B
    Used:			 859.51GiB
    Free (estimated):		  67.40GiB	(min: 41.96GiB)
    Free (statfs, df):		  67.40GiB
    Data ratio:			      1.00
    Metadata ratio:		      2.00
    Global reserve:		 512.00MiB	(used: 0.00B)
    Multiple profiles:		        no

Data,single: Size:868.00GiB, Used:851.47GiB (98.10%)
   /dev/sda3	 868.00GiB

Metadata,DUP: Size:5.50GiB, Used:4.02GiB (73.10%)
   /dev/sda3	  11.00GiB

System,DUP: Size:32.00MiB, Used:128.00KiB (0.39%)
   /dev/sda3	  64.00MiB

Unallocated:
   /dev/sda3	  50.86GiB

Hopefully you guys will make more sense of that all but the only thing that really stood out to me as that there appears to be 50GB of unallocated space on the drive in question. Still, that doesn't account for all of the missing space.

What do you think?

Cheers.


Re: Drive space disappearing with BTRFS...

Posted: Wed Jan 04, 2023 5:17 pm
by erlkönig

What do you get with

Code: Select all

du -sch /home/*

executed as root?


Re: Drive space disappearing with BTRFS...

Posted: Wed Jan 04, 2023 5:40 pm
by Death
erlkönig wrote: Wed Jan 04, 2023 5:17 pm

What do you get with

Code: Select all

du -sch /home/*

executed as root?

I tried with & without sudo and received the same results:

Code: Select all

[z@fedora ~]$ du -sch /home/*
586G	/home/z
586G	total
[z@fedora ~]$ sudo du -sch /home/*
[sudo] password for z: 
586G	/home/z
586G	total

Cheers.


Re: Drive space disappearing with BTRFS...

Posted: Wed Jan 04, 2023 8:32 pm
by erlkönig

...so there are 42 GB difference to the graphical display in your first post, as du does only work on data not belonging to filesystems infrastructure (Metadata, B-Tree, ...).
Are you shure, you don't have that lot of data in projects, videos, and so on under your /home/z ? I would try to get an overview of the biggest folders with

Code: Select all

du -sch /home/z/*

and descending into the folders with lots of data and executing that command again there.


Re: Drive space disappearing with BTRFS...

Posted: Wed Jan 04, 2023 10:33 pm
by Death

Well I already have explored the Home folder with the GUI utility I posted a screenshot of in my opening post and it seems to make sense so I'm not questioning what's in the Home folder. What I don't understand is where the rest of the drive space has gone. This is supposed to be a 1TB drive and I can't account for approximately 275GB of it. I've definitely had drive space go missing when uninstalling games and I just don't understand what happened to it..

Edit: I've just uninstalled another game that was 45Gb but no space has been freed up. I now see this:

3.jpg
3.jpg (127.93 KiB) Viewed 3399 times

So while the Home folder size has reduced, so has the size of 'Fedora'. I cannot understand where this space goes... It's as if the drive gets smaller each time I uninstall something.


Re: Drive space disappearing with BTRFS...

Posted: Wed Jan 04, 2023 11:24 pm
by Largos

Looks like the utility is showing the size of your file system rather than the size of your disk. You deleted 45gb, your file system got 45gb smaller.


Re: Drive space disappearing with BTRFS...

Posted: Wed Jan 04, 2023 11:31 pm
by Death
Largos wrote: Wed Jan 04, 2023 11:24 pm

Looks like the utility is showing the size of your file system rather than the size of your disk. You deleted 45gb, your file system got 45gb smaller.

Yeh I suppose so. So any idea why the size of the file system would shrink each time I delete something?

Edit: I just tried something; I copied a 6GB folder into the home directory and it the size of the file system increased by 6GB and the free space dropped by the same. I then deleted the folder and the size of the file system decreased by the same amount with the free space returning. So now, this has got me wondering if this is an issue with Steam which I am uninstalling these games with. Maybe Steam isn't doing something right when it removes these files..


Re: Drive space disappearing with BTRFS...

Posted: Wed Jan 04, 2023 11:38 pm
by Largos
Death wrote: Wed Jan 04, 2023 11:31 pm
Largos wrote: Wed Jan 04, 2023 11:24 pm

Looks like the utility is showing the size of your file system rather than the size of your disk. You deleted 45gb, your file system got 45gb smaller.

Yeh I suppose so. So any idea why the size of the file system would shrink each time I delete something?

The utility is a breakdown of the data you have. You have less data, it shows less data. If you downloaded a 5gb game, it'd show 5gb more on there. It's shrinking because you are deleting stuff.


Re: Drive space disappearing with BTRFS...

Posted: Wed Jan 04, 2023 11:43 pm
by Death
Largos wrote: Wed Jan 04, 2023 11:38 pm

The utility is a breakdown of the data you have. You have less data, it shows less data. If you downloaded a 5gb game, it'd show 5gb more on there. It's shrinking because you are deleting stuff.

I'm confused. There is still free space missing that I am unable to access. I supposedly had 75GB free (even though there should actually be much more than that), I then uninstalled a 45GB game and tried to copy over 105Gb on to the disk but it says "33GB more space is required by the destination". Something weird is going on. I had a lot more games installed just a few weeks ago and there's no way I could install them all now. I've lost 100s of GBs of space :(

Edit: Well I've figured something out at least..

  1. If I add files to the drive, the filesystem size increases and free space decreases proportionately. If I remove these same files, the inverse happens.

  2. If I delete any existing files from the file system, the file system shrinks but no space is freed up. This not to do with Steam specifically as I previously thought.


Re: Drive space disappearing with BTRFS...

Posted: Wed Jan 04, 2023 11:56 pm
by Largos

Are you sure you've really deleted all the snapshots? How are you making them?