BTRFS,通常念成 Butter FS,Better FS 或B-tree FS。下一代的Linux檔案系統。
它基於寫時拷貝(copy-on-write),支援高效的snapshot和clone。它使用b-tree作為儲存的資料結構。在BTRFS項目首頁上對自己是這麼描述的:"一個新的針對Linux的寫時複製檔案系統,致力於實施進階的功能,同時關注容錯、修複和管理方便性。"
它有哪些進階功能呢?下面的feature來自BTRFS的項目首頁:http://btrfs.wiki.kernel.org/
Extent based file storage #擴充了
2^64 byte == 16 EiB maximum file size #支援16EB的檔案大小, 1PB = 1024 TB, 1EB = 1024 PB
Space-efficient packing of small files #高效支援小檔案, 通過inline files實現的
Space-efficient indexed directories #高效的目錄索引
Dynamic inode allocation #動態inode分配。我們知道,傳統Linux檔案系統的inode格式化好後inode的節點數就確定了,也就是說檔案系統的檔案數確定
Writable snapshots, read-only snapshots #支援可讀,可寫的快照
Subvolumes (separate internal filesystem roots) #支援subvolumes,可以理解成在檔案系統上建立子的檔案系統,方便使用者的許可權控制
Checksums on data and metadata (crc32c) #支援資料和中繼資料的檢驗,保證資料的正確性
Compression (zlib and LZO) #支援在線壓縮
Integrated multiple device support #多裝置支援
File Striping, File Mirroring, File Striping+Mirroring, Striping with Single and Dual Parity implementations
查看本欄目更多精彩內容:http://www.bianceng.cnhttp://www.bianceng.cn/database/storage/
SSD (Flash storage) awareness (TRIM/Discard for reporting free blocks for reuse) and optimizations (e.g. avoiding unnecessary seek optimizations, sending writes in clusters, even if they are from unrelated files. This results in larger write operations and faster write throughput)
Efficient Incremental Backup #高效的增量備份
Background scrub process for finding and fixing errors on files with redundant copies #後台進程自動檢測並修複錯誤
Online filesystem defragmentation #線上的檔案系統片段管理
Offline filesystem check#離線的檔案系統檢查
Conversion of existing ext3/4 file systems #ext3/4檔案系統的轉換
Seed devices. Create a (readonly) filesystem that acts as a template to seed other Btrfs filesystems. The original filesystem and devices are included as a readonly starting point for the new filesystem. Using copy on write, all modifications are stored on different devices; the original is unchanged.
Subvolume-aware quota support #支援subvolume配額,就是支援subvolume的大小限制設定
Send/receive of subvolume changes
Efficient incremental filesystem mirroring
Batch, or out-of-band deduplication (happens after writes, not during) #支援寫後的資料消重
以下這些features正在開發,或者計劃中:
Very fast offline filesystem check #快速離線檔案系統檢查
Object-level mirroring and striping #對象層級的鏡像和條帶
Alternative checksum algorithms #可選擇的校正演算法
Online filesystem check #線上檔案系統檢查
Other compression methods (snappy, lz4) #其他的壓縮演算法
Hot data tracking and moving to faster devices (currently being pushed as a generic feature available through VFS): 熱資料轉移到更快的裝置上,比如SSD
In-band deduplication (happens during writes) #支援寫時資料消重
既然BTRFS的目標是下一代的Linux檔案系統,那麼它不單單能作為智能手持功能的檔案系統,還能作為企業生產環境下的檔案系統。它需要能搭建在眾多的硬體平台上。
BTRFS的實現視圖可以看成需要btree構成的一個森林,使用copy-on-write(COW,寫時複製)作為更新的方法。硬碟的block以extent的形式被管理。
這篇文章作為該系列文章的開篇,簡單的介紹一下BTRFS。接下來的文章我講更詳細的去分享這些feature的具體實現。