kdave / btrfs-progs

Development of userspace BTRFS tools
GNU General Public License v2.0
527 stars 239 forks source link

btrfs-convert fails with 0 free space but 15G is free #803

Closed androos closed 2 weeks ago

androos commented 4 weeks ago

I tried converting from ext4 with size 162G used 148G free 15G

fsck2ext4 -fyD and defrag was done before.
btrfs-convert /devksds6
`btrfs-convert from btrfs-progd v6.8.1
Source filesystem:
type: ext2
label: home
Blocksize: 4096
UUID: ...
tsrget filesystem:
label:
Blocksize: 4096
Nodesize: 16384
UUID: .._
checksum: crc32c
Features: extref, skinny-metadata, no-holes, free-space-tree (default)
Data csum: yes
Inline data: yes
Copy xattr: yes
Reported stats:
Total space: 177413816320
Free space: 0 (0.00%)
Inode count: 43313920
Create initial btrfs filesystem
ERROR: failed to reserve 65536 bytes for temporay superblock, largest available: 0 bytes
ERROR: unable to create initial ctree: No space left on device`

Output of tine2fs -l
`tune2fs 1.47.0 (5-Feb-2023)
Filesystem volume name:   home
Last mounted on:          /home
Filesystem UUID:          e4bc514d-dbf3-473c-8ff9-30a19346f7a3
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash 
Default mount options:    journal_data user_xattr acl discard
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              10829824
Block count:              43313920
Reserved block count:     43313
Overhead clusters:        957342
Free blocks:              3747750
Free inodes:              9780317
First block:              0
Block size:               4096
Fragment size:            4096
Group descriptor size:    64
Reserved GDT blocks:      1024
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Flex block group size:    16
Filesystem created:       Fri Dec 15 01:28:56 2017
Last mount time:          Sun Jun  2 17:32:06 2024
Last write time:          Sun Jun  2 18:32:06 2024
Mount count:              2
Maximum mount count:      9
Last checked:             Sun Jun  2 17:27:12 2024
Check interval:           777600 (1 week, 2 days)
Next check after:         Tue Jun 11 17:27:12 2024
Lifetime writes:          29 TB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     32
Desired extra isize:      32
Journal inode:            8
First orphan inode:       418090
Default directory hash:   half_md4
Directory Hash Seed:      a7bf7ad8-ebe1-4e7e-ba3f-ec9d5ce9307e
Journal backup:           inode blocks
Checksum type:            crc32c
Checksum:                 0xaa4b8cbf
adam900710 commented 4 weeks ago

Please reformat the output with proper newline.

kdave commented 3 weeks ago

I've edited the post to fix the formatting.

adam900710 commented 3 weeks ago

The free space problem seems to be caused by the fragmentation, thus doesn't look like a bug.

androos commented 2 weeks ago

I freed 69G of free space on the device and run defrag again and conversion worked.