Re: btrfs thinks fs is full, though 11GB should be still free

Christoph Anton Mitterer
2023-12-21T22:55:00Z

On Fri, 2023-12-22 at 07:11 +1030, Qu Wenruo wrote:
> Grab the INODE number of that file (`stat` is good enough).
# stat /data/main/prometheus/metrics2/01HHFEZPJ8TPFVYTXV11R7ZH4X/chunks/000001
File: /data/main/prometheus/metrics2/01HHFEZPJ8TPFVYTXV11R7ZH4X/chunks/000001
Size: 15781418 Blocks: 30824 IO Block: 4096 regular file
Device: 0,43 Inode: 642 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 106/prometheus) Gid: ( 106/prometheus)
Access: 2023-12-12 17:50:26.968485936 +0100
Modify: 2023-12-12 17:50:28.748495544 +0100
Change: 2023-12-12 17:50:57.280649521 +0100
Birth: 2023-12-12 17:50:26.968485936 +0100

> Know the subvolume id.

# btrfs subvolume list -pagu /data/main/
ID 257 gen 2371697 parent 5 top level 5 uuid ae3fa7ff-f5a4-cf44-8555-ad579195036c path <FS_TREE>/data

> Then `btrfs ins dump-tree -t <subvolid> <device> | grep -A7 "key (256
> "

I assume 256 should be the inode number?
If so:
# btrfs ins dump-tree -t 257 /dev/vdb | grep -A7 "key (642 "
location key (642 INODE_ITEM 0) type FILE
transid 2348290 data_len 0 name_len 6
name: 000001
item 128 key (638 DIR_INDEX 3) itemoff 9441 itemsize 36
location key (642 INODE_ITEM 0) type FILE
transid 2348290 data_len 0 name_len 6
name: 000001
item 129 key (639 INODE_ITEM 0) itemoff 9281 itemsize 160
generation 2348289 transid 2348290 size 17788225 nbytes 17788928
block group 0 mode 100664 links 1 uid 106 gid 106 rdev 0
sequence 408 flags 0x0(none)
atime 1702399826.500483413 (2023-12-12 17:50:26)
--
item 132 key (642 INODE_ITEM 0) itemoff 9053 itemsize 160
generation 2348289 transid 2348290 size 15781418 nbytes 15781888
block group 0 mode 100664 links 1 uid 106 gid 106 rdev 0
sequence 3362 flags 0x10(PREALLOC)
atime 1702399826.968485936 (2023-12-12 17:50:26)
ctime 1702399857.280649521 (2023-12-12 17:50:57)
mtime 1702399828.748495544 (2023-12-12 17:50:28)
otime 1702399826.968485936 (2023-12-12 17:50:26)
item 133 key (642 INODE_REF 638) itemoff 9037 itemsize 16
index 3 namelen 6 name: 000001
item 134 key (642 EXTENT_DATA 0) itemoff 8984 itemsize 53
generation 2348290 type 1 (regular)
extent data disk byte 9500291072 nr 268435456
extent data offset 0 nr 15781888 ram 268435456
extent compression 0 (none)
item 135 key (643 INODE_ITEM 0) itemoff 8824 itemsize 160
generation 2348290 transid 2363471 size 283 nbytes 283
block group 0 mode 100664 links 1 uid 106 gid 106 rdev 0

If you need the whole output of btrfs ins dump-tree -t 257 /dev/vdb,
it's only 72k compressed, and AFAIU shouldn't contain any private data
(well nothing on the whole fs is private ^^).

Cheers,
Chris