惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
博客园 - 【当耐特】
博客园_首页
博客园 - Franky
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
Recorded Future
Recorded Future
H
Hackread – Cybersecurity News, Data Breaches, AI and More
F
Fortinet All Blogs
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
T
Tailwind CSS Blog
博客园 - 三生石上(FineUI控件)
M
MIT News - Artificial intelligence
D
Docker
H
Help Net Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
S
SegmentFault 最新的问题
腾讯CDC
Latest news
Latest news
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
I
InfoQ
美团技术团队
C
Cybersecurity and Infrastructure Security Agency CISA
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
C
Cisco Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Schneier on Security
Spread Privacy
Spread Privacy
Recent Announcements
Recent Announcements
T
Threat Research - Cisco Blogs
F
Full Disclosure
T
Threatpost
T
Tenable Blog
AWS News Blog
AWS News Blog
Cloudbric
Cloudbric
The Last Watchdog
The Last Watchdog
B
Blog RSS Feed
W
WeLiveSecurity
I
Intezer
月光博客
月光博客
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
L
Lohrmann on Cybersecurity
Hacker News - Newest:
Hacker News - Newest: "LLM"

IT Notes - btrfs

IT Notes IT Notes IT Notes IT Notes
IT Notes
Stefano Marinelli · 2018-10-13 · via IT Notes - btrfs

I've been using BTRFS for years and have encountered few problems. Some of them are small and can be avoided with some smart improvements. The following advice is based on my experience.

You can find posts online arguing against these options, so your mileage may vary.

Fragmentation, speed and compression

If using rotating disks, employ the space_cache and autodefrag options. The latter can slow down writes but will keep the disk in a usable state for a long time. Otherwise, fragmentation may become a problem.

Generally speaking, I use compression. Modern CPUs are much faster than rotating disks, so compressing data before writing saves space and often improves speed.

Filesystem stats and status

Periodically, check the file system status with the command "btrfs fi df [mountpoint]." Here's an example:

Data, RAID1: total=1.42TiB, used=1.40TiB
System, RAID1: total=32.00MiB, used=256.00KiB
Metadata, RAID1: total=12.00GiB, used=4.68GiB
GlobalReserve, single: total=512.00MiB, used=0.00B

The numbers are quite similar (except for metadata), so no action is needed. Sometimes they're different, and you might encounter a strange situation: you see a lot of free space, but you can't write anymore as the disk appears to be full.

This can happen when the total (allocated) reaches the disk's space, but the used amount is lower. You have space, but you can't use it. A balance will fix this issue.

Perform some manual operations

Ideally, professional file systems should auto-heal and auto-clean. For example, ZFS autoscrubs data periodically. BTRFS still lacks some of these automatic operations, so it's recommended to perform some maintenance. I run them via cron.

My daily job looks like this:

/bin/btrfs fi ba start -dusage=50 -dlimit=2 -musage=50 -mlimit=4 mountpoint

This operation checks and rebalances only a subset of blocks that meet specific conditions. This ensures that the operation only lasts a few minutes. Scheduling it daily will, over time, result in a clean situation.

My weekly job looks like this:

/bin/btrfs scrub start -B -d -c 2 -n 4 mountpoint

This command performs a scrub, checking blocks and detecting (and, if possible, correcting) errors. It's a longer operation, so I don't perform it daily.

I've been using BTRFS since 2012, and thanks to these operations, it still rocks.Its capabilities have helped me in many situations.

I also use BTRFS for my Linux desktop PCs to have snapshots and consistent backups.