You are not logged in.

#1 2024-03-08 10:08:19

Herbalist
Member
Registered: 2014-01-12
Posts: 58

[SOLVED] BTRFS double used space

# lsblk
nvme0n1 465.8G        disk
├─nvme0n1p1
│         300M vfat   part       /boot      
└─nvme0n1p2
        465.5G btrfs  part       /home     

# btrfs subvolume list /
ID 256 gen 115902 top level 5 path @
ID 257 gen 115903 top level 5 path @home
ID 258 gen 34 top level 256 path var/lib/portables
ID 259 gen 34 top level 256 path var/lib/machines

# btrfs fi df -h /
Data, single: total=442.44GiB, used=439.02GiB
System, DUP: total=8.00MiB, used=80.00KiB
Metadata, DUP: total=2.00GiB, used=1.20GiB
GlobalReserve, single: total=512.00MiB, used=0.00B

#  btrfs fi usage /
  
Overall:
    Device size:		 465.47GiB
    Device allocated:		 446.46GiB
    Device unallocated:		  19.01GiB
    Device missing:		     0.00B
    Device slack:		     0.00B
    Used:			 441.41GiB
    Free (estimated):		  22.43GiB	(min: 12.93GiB)
    Free (statfs, df):		  22.43GiB
    Data ratio:			      1.00
    Metadata ratio:		      2.00
    Global reserve:		 512.00MiB	(used: 0.00B)
    Multiple profiles:		        no

Data,single: Size:442.44GiB, Used:439.02GiB (99.23%)
   /dev/nvme0n1p2	 442.44GiB

Metadata,DUP: Size:2.00GiB, Used:1.20GiB (59.78%)
   /dev/nvme0n1p2	   4.00GiB

System,DUP: Size:8.00MiB, Used:80.00KiB (0.98%)
   /dev/nvme0n1p2	  16.00MiB

Unallocated:
   /dev/nvme0n1p2	  19.01GiB


sudo btrfs fi show /
Label: none  uuid: 80904583-388b-4a63-a78a-098a6a23c8c4
	Total devices 1 FS bytes used 440.21GiB
	devid    1 size 465.47GiB used 446.46GiB path /dev/nvme0n1p2


#ncdu /home/
*Total disk usage: 260.0 GiB   Apparent size: 259.4 GiB   Items: 294,222

#ncde -x /
*Total disk usage:  19.9 GiB   Apparent size:  19.8 GiB   Items: 189,222
fstab
# Static information about the filesystems.

# /dev/nvme0n1p1
UUID=3621-3052      	/boot     	vfat      	rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2

# /dev/nvme0n1p2
UUID=80904583-388b-4a63-a78a-098a6a23c8c4	/         	btrfs     	rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=256,subvol=/@	0 0

# /dev/nvme0n1p2
UUID=80904583-388b-4a63-a78a-098a6a23c8c4	/home     	btrfs     	rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=257,subvol=/@home	0 0

It seems like my home dir is duplicated and added to the  20GB of the root directory but I have no clue what might be the cause


#sudo btrfs fi du /home -s
     Total   Exclusive  Set shared  Filename
 259.38GiB   254.08GiB     4.83GiB  /home

# sudo btrfs fi df /home
Data, single: total=442.44GiB, used=439.09GiB
System, DUP: total=8.00MiB, used=80.00KiB
Metadata, DUP: total=2.00GiB, used=1.20GiB
GlobalReserve, single: total=512.00MiB, used=0.00B

Last edited by Herbalist (2024-03-08 15:21:28)

Offline

#2 2024-03-08 10:25:20

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,230

Re: [SOLVED] BTRFS double used space

You only have a single root partition, spanning your entire rest of the disk and / and /home are setup as subvolumes: https://wiki.archlinux.org/title/Btrfs#Subvolumes

Your fstab is broken, order /boot after /.

I'm not entirely sure what you're asking. Since you have a single filesystem spanning your disk then all of this is going to be relevantly used.

Online

#3 2024-03-08 10:36:15

Herbalist
Member
Registered: 2014-01-12
Posts: 58

Re: [SOLVED] BTRFS double used space

V1del wrote:

You only have a single root partition, spanning your entire rest of the disk and / and /home are setup as subvolumes: https://wiki.archlinux.org/title/Btrfs#Subvolumes

Your fstab is broken, order /boot after /.

I'm not entirely sure what you're asking. Since you have a single filesystem spanning your disk then all of this is going to be relevantly used.

My question is if its normal for btrfs to report double the size of the actual used space.

The total disk usage in the home directory is 260GB, but btrfs is reporting it as 420GB

Offline

#4 2024-03-08 10:41:23

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,230

Re: [SOLVED] BTRFS double used space

Yes, because you're looking at two different commands with different semantics. df operates on the entire underlying file system (it doesn't matter whether you pass /home or / or whatever there, it will show you the entirety of the underlying filesystem) and the entire filesystem is of that size. as you've noted du will give you the actual size of the subvolume.

Last edited by V1del (2024-03-08 10:42:37)

Online

#5 2024-03-08 14:45:04

Herbalist
Member
Registered: 2014-01-12
Posts: 58

Re: [SOLVED] BTRFS double used space

a qemu kvm disc was using all that space.
using btdu the drive image file was listed as <UNREACHABLE> data

btrfs filesystem defragment vm_hdd_ng.img

recovered the space.

Offline

Board footer

Powered by FluxBB