--- title: "btrfs - tips" pubDatetime: 2024-11-27 slug: btrfs tags: - meetup - btrfs description: btrfs --- # btrfs - metadata - data ``` btrfs filesystem show / ``` ``` Label: 'fedora' uuid: 3c6b0688-169e-4fce-8bfe-dc95771930bb Total devices 2 FS bytes used 92.18GiB devid 1 size 116.86GiB used 49.03GiB path /dev/nvme0n1p6 devid 2 size 118.41GiB used 51.03GiB path /dev/nvme0n1p2 ``` ``` btrfs filesystem df / ``` ``` Data, single: total=94.00GiB, used=90.61GiB System, RAID1: total=32.00MiB, used=16.00KiB Metadata, RAID1: total=3.00GiB, used=1.57GiB GlobalReserve, single: total=199.94MiB, used=0.00B ``` GlobalReserve - 純緊急救援, 不能手動操作 ## 很厲害的 online 調整 ``` btrfs balance start -dconvert=single -mconvert=raid1 /mnt ``` ## RAID-like function - btrfs RAID 5/6 write hole - Write-Ahead Logging (WAL) and CoW ## btrfs balance炸空間 - zfs reservation like 要留 unallocated 的空間 也許 10~15% (其實這個跟 zfs 的 reservation 就幾乎沒兩樣了) 等 不小心 快炸的時候 再放出來 - ka-iu 用usb 暫時增加空間 緊急救援 ## 避免 raid 5/6 ## btrfs balance ## Reflink ``` cp --reflink=always source target ``` ``` cp --reflink=always /var/lib/containers/rocky8.qcow2 /var/lib/containers/rocky8-kernel-ready.qcow2 ``` ## NOCOW ``` chattr +C ``` ``` lsattr ``` ## subvolume ``` btrfs subvolume show /home/p123 home/p123 Name: p123 UUID: 8c27b7eb-811f-6f43-8957-cb5a36fddf4a Parent UUID: - Received UUID: - Creation time: 2024-11-26 13:15:41 +0800 Subvolume ID: 261 Generation: 348697 Gen at creation: 343745 Parent ID: 257 Top level ID: 257 Flags: - Send transid: 0 Send time: 2024-11-26 13:15:41 +0800 Receive transid: 0 Receive time: - Snapshot(s): home/shawn/p123.x Quota group: n/a ``` ## snapshots
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up