On 2017年11月19日 14:17, Chris Murphy wrote:
> fstrim should trim free space, but it only trims unallocated. This is
> with kernel 4.14.0 and the entire 4.13 series. I'm pretty sure it
> behaved this way with 4.12 also.
Tested with 4.14-rc7, can't reproduce it.
------
# btrfs fi us /mnt/btrfs/
Overall:
Device size: 1.00GiB
Device allocated: 566.38MiB
Device unallocated: 457.62MiB
Device missing: 0.00B
Used: 256.81MiB
Free (estimated): 649.62MiB (min: 420.81MiB)
Data ratio: 1.00
Metadata ratio: 2.00
Global reserve: 16.00MiB (used: 0.00B)
Data,single: Size:448.00MiB, Used:256.00MiB
/dev/loop0 448.00MiB
Metadata,DUP: Size:51.19MiB, Used:400.00KiB
/dev/loop0 102.38MiB
System,DUP: Size:8.00MiB, Used:16.00KiB
/dev/loop0 16.00MiB
Unallocated:
/dev/loop0 457.62MiB
# fstrim /mnt/btrfs -v
/mnt/btrfs: 665.3 MiB (697597952 bytes) trimmed
------
Any special mount options or setup?
(BTW, I also tried space_cache=v2 and default v1, no obvious difference)
Thanks,
Qu
>
>
> [root@f27h ~]# fstrim -v /
> /: 39 GiB (41841328128 bytes) trimmed
> [root@f27h ~]# btrfs fi us /
> Overall:
> Device size: 70.00GiB
> Device allocated: 31.03GiB
> Device unallocated: 38.97GiB
> Device missing: 0.00B
> Used: 22.02GiB
> Free (estimated): 47.72GiB (min: 47.72GiB)
> Data ratio: 1.00
> Metadata ratio: 1.00
> Global reserve: 65.97MiB (used: 0.00B)
>
> Data,single: Size:30.00GiB, Used:21.25GiB
> /dev/nvme0n1p8 30.00GiB
>
> Metadata,single: Size:1.00GiB, Used:791.58MiB
> /dev/nvme0n1p8 1.00GiB
>
> System,single: Size:32.00MiB, Used:16.00KiB
> /dev/nvme0n1p8 32.00MiB
>
> Unallocated:
> /dev/nvme0n1p8 38.97GiB
>
>
Attachment:
signature.asc
Description: OpenPGP digital signature
