Bug 464561 - BTRFS filesystems are not resized after shrinking a partition
Summary: BTRFS filesystems are not resized after shrinking a partition
Status: REPORTED
Alias: None
Product: partitionmanager
Classification: Applications
Component: general (show other bugs)
Version: 22.12.1
Platform: Fedora RPMs Linux
: NOR major
Target Milestone: ---
Assignee: Andrius Štikonas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-20 16:48 UTC by meow464
Modified: 2023-01-20 16:48 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description meow464 2023-01-20 16:48:31 UTC
STEPS TO REPRODUCE
1.  Shrink a BTRFS partition

OBSERVED RESULT
It will srhink the partition but fail with an error. I didn't save the kde partition error but it was identical to the `btrfs check` command output.
```
btrfs check /dev/nvme0n1p2                                                                                                                                                                                        
Opening filesystem to check...                                                                                                                                                                                                              
Checking filesystem on /dev/nvme0n1p2                                                                                                                                                                                                       
UUID: d7dde9e4-227a-41bb-a96b-830a638d1fc7                                                                                                                                                                                                  
[1/7] checking root items                                                                                                                                                                                                                   
[2/7] checking extents                                                                                                                                                                                                                      
ERROR: block device size is smaller than total_bytes in device item, has 1505755136 expect >= 1610612736                                                                                                                                    
ERROR: errors found in extent allocation tree or chunk allocation                                                                                                                                                                           
[3/7] checking free space tree                                                                                                                                                                                                              
[4/7] checking fs roots                                                                                                                                                                                                                     
[5/7] checking only csums items (without verifying data)                                                                                                                                                                                    
[6/7] checking root refs                                                                                                                                                                                                                    
[7/7] checking quota groups skipped (not enabled on this FS)                                                                                                                                                                                
found 257695744 bytes used, error(s) found                                                                                                                                                                                                  
total csum bytes: 250824                                                                                                                                                                                                                    
total tree bytes: 851968                                                                                                                                                                                                                    
total fs tree bytes: 360448                                                                                                                                                                                                                 
total extent tree bytes: 49152                                                                                                                                                                                                              
btree space waste bytes: 280984                                                                                                                                                                                                             
file data blocks allocated: 256843776                                                                                                                                                                                                       
 referenced 256843776
```


EXPECTED RESULT
It would just work.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Fedora 37
(available in About System)
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION
I had to run `btrfs rescue fix-device-size /dev/nvme0n1p2` to fix it.