Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect free space calculation on RAID1 btrfs volume #130

Closed
bshor opened this issue Jun 16, 2021 · 2 comments
Closed

Incorrect free space calculation on RAID1 btrfs volume #130

bshor opened this issue Jun 16, 2021 · 2 comments

Comments

@bshor
Copy link

bshor commented Jun 16, 2021

Hello, I have a RAID1 btrfs volume running on Ubuntu 20.04 LTS. According to the btrfs fi usage command, I have approx 1.2T of free space (see also the BTRFS wiki on free space calculation). But according to duf, I only have 960Gb. The correct usage is also 1.2Tb, so the percentage should be roughly 50%. I understand the used space being ~600Gb because that is the amount of data I have, but because RAID1 doubles the data, I really have used 1.2Tb. I think it's a mistake but I understand it. But the free space left seems wrong and I don't understand.

╭───────────────────────────────────────────────────────────────────────────────────────────────────╮
│ 1 local device                                                                                    │
├─────────────────────┬──────┬────────┬────────┬───────────────────────────────┬───────┬────────────┤
│ MOUNTED ON          │ SIZE │   USED │  AVAIL │              USE%             │ TYPE  │ FILESYSTEM │
├─────────────────────┼──────┼────────┼────────┼───────────────────────────────┼───────┼────────────┤
│ /var/lib/snapd/host │ 1.8T │ 603.9G │ 961.1G │ [######..............]  33.3% │ btrfs │ /dev/sdd   │
│ fs/hdd              │      │        │        │                               │       │            │
╰─────────────────────┴──────┴────────┴────────┴───────────────────────────────┴───────┴────────────╯

Overall:
    Device size:		   3.54TiB
    Device allocated:		   1.18TiB
    Device unallocated:		   2.36TiB
    Device missing:		     0.00B
    Used:			   1.18TiB
    Free (estimated):		   1.18TiB	(min: 1.18TiB)
    Data ratio:			      2.00
    Metadata ratio:		      2.00
    Global reserve:		 512.00MiB	(used: 0.00B)

Data,RAID1: Size:603.00GiB, Used:602.67GiB (99.95%)
   /dev/sdd	 116.00GiB
   /dev/sda	 422.00GiB
   /dev/sdc	 450.00GiB
   /dev/sde	 218.00GiB

Metadata,RAID1: Size:1.00GiB, Used:768.50MiB (75.05%)
   /dev/sda	   1.00GiB
   /dev/sdc	   1.00GiB

System,RAID1: Size:32.00MiB, Used:128.00KiB (0.39%)
   /dev/sdd	  32.00MiB
   /dev/sda	  32.00MiB

Unallocated:
   /dev/sdd	 480.14GiB
   /dev/sda	 508.48GiB
   /dev/sdb	 465.76GiB
   /dev/sdc	 480.51GiB
   /dev/sde	 480.64GiB

(by the way, this is mounted as /hdd, but I have to use /dev/sdd to get the free space info for some reason)

@muesli
Copy link
Owner

muesli commented Feb 7, 2022

As it's currently impossible to retrieve the actual mountinfo from within a snap, I'm afraid there's nothing I can do. On recent Debian & Ubuntu installs you can simply apt install duf (and there are also .debs you can download from duf's release page). Should you still be able to reproduce issues with a "regular" duf install, please let me know.

@muesli muesli closed this as completed Feb 7, 2022
@bshor
Copy link
Author

bshor commented Feb 7, 2022

Thank you for the response. In the time since, I found the Ubuntu package and installed that. So this is on a different machine with Ubuntu 21.10 (Impish) running duf 0.6.2-1 with a 2-drive RAID1 configuration.

I still get the incorrect free space calculation in duf. I should be getting 2Tb free, but instead it is showing 1.6Tb free.

Here is the duf output:

╭───────────────────────────────────────────────────────────────────────────────────────╮
│ 1 local device                                                                        │
├────────────┬──────┬──────┬───────┬───────────────────────────────┬───────┬────────────┤
│ MOUNTED ON │ SIZE │ USED │ AVAIL │              USE%             │ TYPE  │ FILESYSTEM │
├────────────┼──────┼──────┼───────┼───────────────────────────────┼───────┼────────────┤
│ /data      │ 3.2T │ 1.2T │  1.6T │ [#######.............]  36.5% │ btrfs │ /dev/sdb   │
╰────────────┴──────┴──────┴───────┴───────────────────────────────┴───────┴────────────╯

And here is the btrfs usage output.

Overall:
    Device size:		   6.37TiB
    Device allocated:		   2.34TiB
    Device unallocated:		   4.03TiB
    Device missing:		     0.00B
    Used:			   2.32TiB
    Free (estimated):		   2.02TiB	(min: 2.02TiB)
    Free (statfs, df):		   1.57TiB
    Data ratio:			      2.00
    Metadata ratio:		      2.00
    Global reserve:		 512.00MiB	(used: 0.00B)
    Multiple profiles:		        no

Data,RAID1: Size:1.17TiB, Used:1.16TiB (99.48%)
   /dev/sdb	   1.17TiB
   /dev/sdd	   1.17TiB

Metadata,RAID1: Size:3.00GiB, Used:2.22GiB (74.04%)
   /dev/sdb	   3.00GiB
   /dev/sdd	   3.00GiB

System,RAID1: Size:8.00MiB, Used:192.00KiB (2.34%)
   /dev/sdb	   8.00MiB
   /dev/sdd	   8.00MiB

Unallocated:
   /dev/sdb	   1.56TiB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants