Merge pull request #2161 from GOLinux/master

[Translated] 20141229 How to Create Btrfs Filesystem in Linux and its Features.md
This commit is contained in:
joeren 2014-12-30 10:18:00 +08:00
commit 94fa3a1be5
2 changed files with 84 additions and 84 deletions

View File

@ -1,84 +0,0 @@
Translating by GOLinux!
How to Create Btrfs Filesystem in Linux and its Features
================================================================================
**Btrfs** (B-tree file system) is a new CoW (copy-on-write) file system for Linux. It's development began at [Oracle Corporation][1] in 2007 and it was marked as stable in August 2014. The purpose of Btrfs is to address the lack of pooling, snapshots, checksums, and integral multi-device spanning in Linux file systems and its goal was to let Linux scale for the storage that will be available. Scaling is not just about addressing the storage but also means being able to administer and to manage it with a clean interface that lets people see what's being used and makes it more reliable.
You should note that Btrfs has just become stable so it is recommended to always use the latest available version of the kernel to avoid any problems or bugs.
### Btrfs Features ###
Among the most important features of the new file system:
- Extent based file storage
- 16 EiB maximum file size
- Space-efficient packing of small files and indexed directories
- Dynamic inode allocation
- Writable snapshots and read-only snapshots
- Subvolumes (separate internal filesystem roots)
- Checksums on data and metadata
- Compression (gzip and LZO)
- Integrated multiple device support
- File Striping, File Mirroring, and File Striping+Mirroring implementations
- Efficient incremental backup
- Background scrub process for finding and fixing errors on files with redundant copies
- Online filesystem defragmentation and Offline filesystem check
- Btrfs filesystem have much enhancement on RAID 5/ RAID 6 support and many [bug fixes has been added on linux 3.19][2]
You can [read about the new features][3] on this wiki article covering the subject.
### Converting to Btrfs ###
**WARNING: You should always backup your data before atempting to convert a file system. Although this operation is stable and safe it can lead to data loss and the only way to prevent this is to always have a backup of your data.**
Converting an existing ext4 filesystem to btrfs is quite simple and straightforward, you will first need to use fsck to check if there are any errors on your existing partition and then use the btrfs-convert command to convert it. If the partition you wish to convert is /dev/sda3 you can do it like this:
# fsck.ext4 /dev/sda4
# btrfs-convert /dev/sda4
You can then use the mount command to mount it where you wish.
![btrfs-convert](http://blog.linoxide.com/wp-content/uploads/2014/11/btrfs-convert.jpg)
### Converting the root partition ###
If you wish to convert the root partition of your system you will first have to boot a live CD, you can do this by using the Ubuntu installation CD and selecting "Try Ubuntu" from the first screen or use any other Live CD image available.
After you boot open a terminal and use it to convert the filesystem.
# fsck.ext4 /dev/sda1
# btrfs-convert /dev/sda1
Next chroot to the filesystem so you can change fstab and reinstall grub
# mount /dev/sda1 /mnt
# for i in dev dev/pts proc sys ; do mount --bind /$i /mnt/$i ; done
# chroot /mnt
# blkid | grep sda1
![btrfs-root-convert](http://blog.linoxide.com/wp-content/uploads/2014/11/btrfs-root-convert.jpg)
Now edit fstab and replace the current UUID of the / filesystem with the one blkid outputted and the filesystem type with btrfs, the new line should look like this:
UUID=8e7e80aa-337e-4179-966d-d60128bd3714 / btrfs defaults 0 1
Then reinstall Grub:
# grub-install /dev/sda
# update-grub
You can now reboot the machine without using the boot CD and use it with the new filesystem.
--------------------------------------------------------------------------------
via: http://linoxide.com/file-system/create-btrfs-features/
作者:[Adrian Dinu][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/adriand/
[1]:http://www.oracle.com/index.html
[2]:http://lkml.iu.edu/hypermail/linux/kernel/1412.1/03583.html
[3]:https://btrfs.wiki.kernel.org/index.php/Main_Page#Features

View File

@ -0,0 +1,84 @@
Btrfs文件系统在Linux中的创建及其特性
================================================================================
**Btrfs**B-tree file systemB-tree文件系统是针对Linux开发的一个新的CoWcopy-on-write写时复制文件系统。它最初是由[甲骨文公司][1]在2007年着手开始开发的并在2014年8月正式发布其稳定版。开发Btrfs的目的在于解决Linux文件系统中缺少池、快照、校验和以及集成的跨多设备访问等问题目标在于实现Linux的规模化存储。规模化不仅仅是指解决存储问题也意味着通过简洁的界面提供对存储的管控和管理能力让大家能看到已使用的内容并使它更可靠。
你应该注意到Btrfs才刚刚发布稳定版所以强烈推荐你使用最新版的内核以避免可能出现的问题和漏洞。
### Btrfs特性 ###
新文件系统的最重要的特性有:
- 基于扩展的文件存储
- 文件大小上限16EiB
- 小文件和索引目录的高效空间利用
- 动态索引节点分配
- 支持快照可写和快照只读
- 子卷(分离内部文件系统的根)
- 支持数据和元数据的校验和
- 压缩 gzip和LZO
- 整合的多设备支持
- 支持文件条块化、文件镜像和文件条块化+镜像三种部署方案
- 高效的增量备份
- 后台消除进程支持查找和修复冗余副本上的文件错误
- 支持在线文件系统碎片整理和离线文件系统检查
- Btrfs文件系统对RAID 5/RAID 6加强支持[在linux 3.19中添加了许多漏洞修补][2]
你可以在此关于本主题的维基文章中[阅读关于新特性的内容][3]。
### 转换到Btrfs ###
**警告:在尝试转换文件系统前,请务必备份数据。虽然此操作很稳定,也很安全,但它仍然可能导致数据丢失,而防止此情况发生的唯一途径就是进行数据备份。**
将现存的ext4文件系统转换到btrfs是相当简单而易懂的。你首先需要使用fsck来检查你现存分区上是否存在错误然后使用btrfs-convert命令进行转换。如果你想要对/dev/sda3分区进行转换你可以进行以下操作
# fsck.ext4 /dev/sda4
# btrfs-convert /dev/sda4
然后你就可以使用mount命令将它挂载到你想要的任何位置。
![btrfs-convert](http://blog.linoxide.com/wp-content/uploads/2014/11/btrfs-convert.jpg)
### 转换根分区 ###
如果你想要对你系统上的根分区进行转换你首先需要使用Live CD启动。对于Ubuntu你可以使用Ubuntu安装CD来完成此操作在启动后第一个屏幕选择“尝试Ubuntu”。对于其它系统你同样可以使用Live CD镜像操作类似。
在启动后,打开终端,使用下面的命令来转换文件系统。
# fsck.ext4 /dev/sda1
# btrfs-convert /dev/sda1
接下来chroot到文件系统这样你就可以修改fstab并重新安装grub了。
# mount /dev/sda1 /mnt
# for i in dev dev/pts proc sys ; do mount --bind /$i /mnt/$i ; done
# chroot /mnt
# blkid | grep sda1
![btrfs-root-convert](http://blog.linoxide.com/wp-content/uploads/2014/11/btrfs-root-convert.jpg)
现在来编辑fstab并根据blkid输出的结果来修改当前/文件系统的UUID并将它的文件系统类型修改为btrfs修改后的行如下
UUID=8e7e80aa-337e-4179-966d-d60128bd3714 / btrfs defaults 0 1
然后重新安装Grub
# grub-install /dev/sda
# update-grub
现在,你可以把启动光盘丢到一边了,重启机器后,你就可以使用新的文件系统了。
--------------------------------------------------------------------------------
via: http://linoxide.com/file-system/create-btrfs-features/
作者:[Adrian Dinu][a]
译者:[GOLinux](https://github.com/GOLinux)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://linoxide.com/author/adriand/
[1]:http://www.oracle.com/index.html
[2]:http://lkml.iu.edu/hypermail/linux/kernel/1412.1/03583.html
[3]:https://btrfs.wiki.kernel.org/index.php/Main_Page#Features