Difference between revisions of "Btrfs/zh-cn"

From Funtoo
Jump to navigation Jump to search
(Created page with "要在重启后自动挂载这个卷,需要添加一个简单的 fstab 条目:")
(Created page with "BTRFS 可以用来管理它使用的物理磁盘,物理磁盘被添加到 BTRFS 卷中。然后,BTRFS 可以从卷中创建子卷,子卷上可以存储文件。")
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
<languages/>
<languages/>
BTRFS is a file system based on the copy-on-write (COW) principle, initially designed at Oracle Corporation for use in Linux. The development of Btrfs began in 2007, and since August 2014 the file system's on-disk format has been marked as stable.
BTRFS 是一个基于写时复制 (COW) 原则的文件系统,最初是在 Oracle 公司设计的,用于 Linux。Btrfs 的开发始于 2007 年,自 2014 年 8 月起,该文件系统的磁盘格式被标记为稳定。


In 2015, Btrfs was adopted as the default filesystem for SUSE Linux Enterprise Server 12. SUSE reaffirmed its commitment to Btrfs in 2017 after RedHat announced to stop supporting Btrfs.
2015 年,Btrfs 被采纳为 SUSE Linux Enterprise Server 12 的默认文件系统。在 RedHat 宣布停止支持 Btrfs 后,SUSE 于 2017 年重申了对 Btrfs 的承诺。


Btrfs 旨在解决 Linux 文件系统中缺乏文件池、快照、校验和以及集成多设备跨度的问题。
Btrfs 旨在解决 Linux 文件系统中缺乏文件池、快照、校验和以及集成多设备跨度的问题。


It is easy to set up and use BTRFS. In this simple introduction, we're going to set up BTRFS under Funtoo Linux using an existing {{c|debian-sources}} or {{c|debian-sources-lts}} kernel, like the one that comes pre-built for you with Funtoo Linux, and we will also be using our BTRFS storage pool for storing data that isn't part of the Funtoo Linux installation itself. Funtoo Linux will boot from a non-BTRFS filesystem, and as part of the initialization process will initialize our BTRFS storage and mount it at the location of our choice.
设置和使用 BTRFS 非常简单。在这个简单的介绍中,我们将使用现有的 {{c|debian-sources}} {{c|debian-sources-lts}} 内核在 Funtoo Linux 下设置 BTRFS,比如 Funtoo Linux 为你预置的内核,我们还将使用我们的 BTRFS 存储池来存储不属于 Funtoo Linux 安装本身的数据。Funtoo Linux 将从一个非 BTRFS 文件系统启动,作为初始化过程的一部分,将初始化我们的 BTRFS 存储,并将其挂载在我们选择的位置。


== 安装 ==
== 安装 ==
Line 20: Line 20:
== BTRFS 概念 ==
== BTRFS 概念 ==


BTRFS can be used to manage the physical disks that it uses, and physical disks are added to a BTRFS volume. Then, BTRFS can create subvolumes from the volume on which files can be stored.
BTRFS 可以用来管理它使用的物理磁盘,物理磁盘被添加到 BTRFS 卷中。然后,BTRFS 可以从卷中创建子卷,子卷上可以存储文件。


与传统的 Linux 文件系统不同,BTRFS 文件系统将从底层卷按需分配存储空间。  
与传统的 Linux 文件系统不同,BTRFS 文件系统将从底层卷按需分配存储空间。  
Line 26: Line 26:
在 BTRFS 的世界里,卷这个词对应的是一个存储池 (ZFS) 或一个卷组 (LVM)。
在 BTRFS 的世界里,卷这个词对应的是一个存储池 (ZFS) 或一个卷组 (LVM)。


* ''devices'' - one or multiple underlying physical volumes.
* ''设备'' - 一个或多个底层物理卷。
* ''volume'' - one large storage pool comprised of all space of the devices and can support different redundancy levels
* '''' - 一个大型存储池,由设备的所有空间组成,可支持不同的冗余级别。
* ''subvolumes'' - these are what get mounted and you store files in.
* ''子卷'' - 这些是被挂载的部分,你可以在其中存储文件。
* ''snapshots'' - a read-only copy of a subvolume at a given point in time and/or read-write copy of a ''subvolume'' in time (aka clone).
* ''快照'' - 子卷在某个时间点的只读副本和/''子卷''在某个时间点的读写副本(也就是克隆)。


== 创建一个卷 ==
== 创建一个卷 ==
Line 81: Line 81:
}}
}}


You should now be at the point where you can begin to use BTRFS for a variety of tasks. While there is a lot more to BTRFS than what is covered in this short introduction, you should now have a good understanding of the fundamental concepts on which BTRFS is based.
你现在应该已经到了可以开始使用 BTRFS 来完成各种任务的阶段。虽然 BTRFS 的内容比这篇简短的介绍要多得多,但你现在应该对 BTRFS 的基本概念有了很好的理解。


[[Category:BTRFS]]
[[Category:BTRFS]]

Revision as of 19:00, April 5, 2021

Other languages:
English • ‎Türkçe • ‎español • ‎português do Brasil • ‎中文(中国大陆)‎

BTRFS 是一个基于写时复制 (COW) 原则的文件系统,最初是在 Oracle 公司设计的,用于 Linux。Btrfs 的开发始于 2007 年,自 2014 年 8 月起,该文件系统的磁盘格式被标记为稳定。

2015 年,Btrfs 被采纳为 SUSE Linux Enterprise Server 12 的默认文件系统。在 RedHat 宣布停止支持 Btrfs 后,SUSE 于 2017 年重申了对 Btrfs 的承诺。

Btrfs 旨在解决 Linux 文件系统中缺乏文件池、快照、校验和以及集成多设备跨度的问题。

设置和使用 BTRFS 非常简单。在这个简单的介绍中,我们将使用现有的 debian-sourcesdebian-sources-lts 内核在 Funtoo Linux 下设置 BTRFS,比如 Funtoo Linux 为你预置的内核,我们还将使用我们的 BTRFS 存储池来存储不属于 Funtoo Linux 安装本身的数据。Funtoo Linux 将从一个非 BTRFS 文件系统启动,作为初始化过程的一部分,将初始化我们的 BTRFS 存储,并将其挂载在我们选择的位置。

安装

安装 BTRFS 不需要任何额外的步骤,因为它是 Linux 内核的一部分(从 2.6.29 开始在主线 Linux 内核中)。让我们用 emerge 安装 BTRFS 用户空间工具 (btrfs-progs)。

root # emerge btrfs-progs

BTRFS 现在可以使用了。

BTRFS 概念

BTRFS 可以用来管理它使用的物理磁盘,物理磁盘被添加到 BTRFS 卷中。然后,BTRFS 可以从卷中创建子卷,子卷上可以存储文件。

与传统的 Linux 文件系统不同,BTRFS 文件系统将从底层卷按需分配存储空间。

在 BTRFS 的世界里,卷这个词对应的是一个存储池 (ZFS) 或一个卷组 (LVM)。

  • 设备 - 一个或多个底层物理卷。
  • - 一个大型存储池,由设备的所有空间组成,可支持不同的冗余级别。
  • 子卷 - 这些是被挂载的部分,你可以在其中存储文件。
  • 快照 - 子卷在某个时间点的只读副本和/或子卷在某个时间点的读写副本(也就是克隆)。

创建一个卷

要创建一个基本的 BTRFS 卷,将需要一个额外的空盘。执行以下步骤:

root #  mkfs.btrfs /dev/sdxy
btrfs-progs v4.17.1 
See http://btrfs.wiki.kernel.org for more information.

Detected a SSD, turning off metadata duplication.  Mkfs with -m dup if you want to force metadata duplication.
Performing full device TRIM /dev/sdj (223.57GiB) ...
Label:              (null)
UUID:               d6bcba6e-8fd5-41fc-9bb4-79628c5c928c
Node size:          16384
Sector size:        4096
Filesystem size:    223.57GiB
Block group profiles:
  Data:             single            8.00MiB
  Metadata:         single            8.00MiB
  System:           single            4.00MiB
SSD detected:       yes
Incompat features:  extref, skinny-metadata
Number of devices:  1
Devices:
   ID        SIZE  PATH
    1   223.57GiB  /dev/sdxy

/dev/sdxy 应该是一个未使用的磁盘。如果这个磁盘上有任何已存在的数据,可能需要使用以下命令:

root #  mkfs.btrfs -f /dev/sdxy

现在可以像挂载其他 linux 文件系统一样挂载所创建的卷。

root #  mkdir /data
root #  mount /dev/sdxy /data
root #  mount
...
/dev/sdxy on /data type btrfs (rw,relatime,ssd,space_cache,subvolid=5,subvol=/)

要在重启后自动挂载这个卷,需要添加一个简单的 fstab 条目:

/dev/sdxy	/data	btrfs	defaults	0 0

你现在应该已经到了可以开始使用 BTRFS 来完成各种任务的阶段。虽然 BTRFS 的内容比这篇简短的介绍要多得多,但你现在应该对 BTRFS 的基本概念有了很好的理解。