使用 BtrFS 快照 (SLES 或类似系统) 估算文件系统规划的公式或经验法则

使用 BtrFS 快照 (SLES 或类似系统) 估算文件系统规划的公式或经验法则

SLES 的根文件系统采用 BtrFS,并在更新前后自动执行(“编号”)快照。如果您的系统出现故障,您可以从较旧的快照启动(使用较旧的内核)。

理论上这一切都很好,但我有一些实际问题/疑问:

  1. 文件系统应该有多大(例如,假设您不会“使用”超过 20GB 的空间)?
  2. 当也想使用“时间线”快照时,建议使用哪些设置来使快照磁盘使用率保持在“界限内”?

例如,我使用以下快照设置:

# grep '^[^#]' /etc/snapper/configs/root
SUBVOLUME="/"
FSTYPE="btrfs"
QGROUP="1/0"
SPACE_LIMIT="0.5"
FREE_LIMIT="0.2"
ALLOW_USERS=""
ALLOW_GROUPS=""
SYNC_ACL="no"
BACKGROUND_COMPARISON="yes"
NUMBER_CLEANUP="yes"
NUMBER_MIN_AGE="1800"
NUMBER_LIMIT="2-10"
NUMBER_LIMIT_IMPORTANT="4-10"
TIMELINE_CREATE="yes"
TIMELINE_CLEANUP="yes"
TIMELINE_MIN_AGE="1800"
TIMELINE_LIMIT_HOURLY="10"
TIMELINE_LIMIT_DAILY="5"
TIMELINE_LIMIT_WEEKLY="3"
TIMELINE_LIMIT_MONTHLY="3"
TIMELINE_LIMIT_YEARLY="2"
EMPTY_PRE_POST_CLEANUP="yes"
EMPTY_PRE_POST_MIN_AGE="1800"

我的意思是:理想情况下,我希望将计划磁盘使用量的 50% 用于快照,那么我应该如何调整设置呢?

以下是创建的快照的示例(该列表可能会随着时间的推移而增长):

# snapper list
    # | Type   | Pre # | Date                     | User | Used Space | Cleanup  | Description              | Userdata
------+--------+-------+--------------------------+------+------------+----------+--------------------------+--------------
   0  | single |       |                          | root |            |          | current                  |
   1* | single |       | Tue Jan 24 12:35:33 2023 | root | 144.00 KiB |          | first root filesystem    |
  27  | single |       | Thu Jan 26 10:14:39 2023 | root | 325.28 MiB |          | Installation DP CM 11.02 |
  42  | single |       | Thu Feb  2 14:00:01 2023 | root | 492.13 MiB | timeline | timeline                 |
5181  | single |       | Fri Sep  1 00:00:01 2023 | root | 172.21 MiB | timeline | timeline                 |
5274  | pre    |       | Mon Sep  4 11:26:42 2023 | root | 102.06 MiB | number   | zypp(ruby.ruby2.5)       | important=yes
5275  | post   |  5274 | Mon Sep  4 11:29:41 2023 | root | 194.42 MiB | number   |                          | important=yes
5917  | single |       | Sun Oct  1 00:00:01 2023 | root |  13.92 MiB | timeline | timeline                 |
6172  | pre    |       | Wed Oct 11 14:51:34 2023 | root |   1.23 MiB | number   | yast online_update       |
6175  | pre    |       | Wed Oct 11 14:53:16 2023 | root |  97.12 MiB | number   | zypp(ruby.ruby2.5)       | important=yes
6176  | post   |  6175 | Wed Oct 11 14:56:43 2023 | root | 304.00 KiB | number   |                          | important=yes
6177  | post   |  6172 | Wed Oct 11 14:56:54 2023 | root | 256.00 KiB | number   |                          |
6178  | pre    |       | Wed Oct 11 14:58:37 2023 | root | 928.00 KiB | number   | zypp(zypper)             | important=yes
6179  | post   |  6178 | Wed Oct 11 14:58:47 2023 | root |   1.30 MiB | number   |                          | important=yes
6621  | single |       | Mon Oct 30 00:00:01 2023 | root |   6.52 MiB | timeline | timeline                 |
6669  | single |       | Wed Nov  1 00:00:01 2023 | root |   6.50 MiB | timeline | timeline                 |
6789  | single |       | Mon Nov  6 00:00:01 2023 | root |   6.47 MiB | timeline | timeline                 |
6933  | single |       | Sun Nov 12 00:00:01 2023 | root |   6.20 MiB | timeline | timeline                 |
6957  | single |       | Mon Nov 13 00:00:01 2023 | root |   5.84 MiB | timeline | timeline                 |
6981  | single |       | Tue Nov 14 00:00:01 2023 | root |   3.48 MiB | timeline | timeline                 |
7005  | single |       | Wed Nov 15 00:00:01 2023 | root |   2.91 MiB | timeline | timeline                 |
7029  | single |       | Thu Nov 16 00:00:01 2023 | root | 464.00 KiB | timeline | timeline                 |
7032  | single |       | Thu Nov 16 03:00:01 2023 | root |  16.00 KiB | timeline | timeline                 |
7033  | single |       | Thu Nov 16 04:00:01 2023 | root |  16.00 KiB | timeline | timeline                 |
7034  | single |       | Thu Nov 16 05:00:01 2023 | root |  64.00 KiB | timeline | timeline                 |
7035  | single |       | Thu Nov 16 06:00:01 2023 | root |  16.00 KiB | timeline | timeline                 |
7036  | single |       | Thu Nov 16 07:00:01 2023 | root |  16.00 KiB | timeline | timeline                 |
7037  | single |       | Thu Nov 16 08:00:01 2023 | root |  32.00 KiB | timeline | timeline                 |
7038  | single |       | Thu Nov 16 09:00:01 2023 | root |  80.00 KiB | timeline | timeline                 |
7039  | single |       | Thu Nov 16 10:00:01 2023 | root | 128.00 KiB | timeline | timeline                 |
7040  | single |       | Thu Nov 16 11:00:01 2023 | root | 272.00 KiB | timeline | timeline                 |
7041  | pre    |       | Thu Nov 16 11:50:58 2023 | root | 512.00 KiB | number   | yast online_update       |
7042  | pre    |       | Thu Nov 16 11:52:45 2023 | root |   1.27 MiB | number   | zypp(ruby.ruby2.5)       | important=yes
7043  | post   |  7042 | Thu Nov 16 11:56:35 2023 | root | 560.00 KiB | number   |                          | important=yes
7044  | post   |  7041 | Thu Nov 16 11:56:42 2023 | root | 464.00 KiB | number   |                          |
7045  | pre    |       | Thu Nov 16 11:58:15 2023 | root | 768.00 KiB | number   | zypp(zypper)             | important=yes
7046  | post   |  7045 | Thu Nov 16 11:58:27 2023 | root | 320.00 KiB | number   |                          | important=yes
7047  | single |       | Thu Nov 16 12:00:01 2023 | root | 176.00 KiB | timeline | timeline                 |
7048  | single |       | Thu Nov 16 13:00:01 2023 | root |  32.00 KiB | timeline | timeline                 |

答案1

官方部署指南建议“所有模式”的最小磁盘空间如下安装范围大小为 4 GB:

  • 建议最低配置(无 Btrfs 快照):10 GB
  • 最低要求(包含 Btrfs 快照):16 GB
  • 建议最低配置(包含 Btrfs 快照):32 GB

之间的比率建议最低(无快照)至安装范围尺寸:

10 GB / 4 GB = 2,5

之间的比率最低要求(附快照)至建议最低(无快照):

16 GB / 10 GB = 1,6

之间的比率建议最低(附快照)至最低要求(附快照):

32 GB / 16 GB = 2

公式必需的最低限度(附快照):

f(x) = x * 2,5 * 1,6 = x * 4
x = Installation Scope size

Example: x = 20 GB
f(x) = 20 GB * 4 = 80 GB

公式受到推崇的最低限度(附快照):

f(x) = x * 2,5 * 1,6 * 2 = x * 8
x = Installation Scope size

Example: x = 20 GB
f(x) = 20 GB * 8 = 160 GB

相关内容