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
- 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的具体实现。敬请期待!
尊重原创,转载请注明出处 anzhsoft: http://blog.csdn.net/anzhsoft/article/details/20359531