如何对 btrfs 根文件系统进行快照(/ 的快照)?

lin*_*dhe 2 linux fedora filesystems snapshot btrfs

我有 Fedora 20,当我安装它时,我选择使用 btrfs 作为文件系统,原因有很多,但主要是为了有可用的快照。

但我似乎无法创建/. 我可以像这样对我的主文件夹(也是 btrfs)btrfs subvolume snapshot /home/ /snap/home进行快照,但是当我尝试/通过编写btrfs subvolume snapshot / /snap它来进行快照时只输出ERROR: incorrect snapshot name ('/').

我确定 / 是 btrfs。 分道扬镳

列出子卷输出:

# btrfs subvolume list /
ID 256 gen 9562 top level 5 path home
ID 258 gen 9562 top level 5 path root
ID 306 gen 9517 top level 258 path snap/home/2014-08-15_00:44:00
Run Code Online (Sandbox Code Playgroud)

是否无法对根文件夹进行快照,即使它使用的是 btrfs?

小智 9

您需要在 /snap 下为快照提供一个名称,例如

$ btrfs subvolume snapshot / /snap/root
Run Code Online (Sandbox Code Playgroud)

如果您不提供名称,btrfs 将使用源子卷的名称。在您的情况下,源子卷被调用/,它不是快照的有效名称。

usage: btrfs subvolume snapshot [-r] <source> <dest>|[<dest>/]<name>

    btrfs subvolume snapshot [-r] [-i <qgroupid>] <source> <dest>|[<dest>/]<name>

    Create a snapshot of the subvolume
    Create a writable/readonly snapshot of the subvolume <source> with
    the name <name> in the <dest> directory.  If only <dest> is given,
    the subvolume will be named the basename of <source>.

    -r             create a readonly snapshot
    -i <qgroupid>  add the newly created snapshot to a qgroup. This
                   option can be given multiple times.
Run Code Online (Sandbox Code Playgroud)

  • 对于 Linux 4.3.3 上的 `btrfs-progs` 4.3.1,如果 `&lt;dest&gt;` 是现有目录,也会发生此错误(错误消息可能更有帮助,报告为 https://bugzilla.kernel.org /show_bug.cgi?id=109981)。 (2认同)