mirror of
https://gitee.com/callmer/pve_toss_notes.git
synced 2026-08-31 05:52:52 +08:00
新增 BTRFS 调整内容
This commit is contained in:
+60
-3
@@ -130,9 +130,9 @@ analyzing CPU 0:
|
|||||||
|
|
||||||
这里面主要关注两个点:
|
这里面主要关注两个点:
|
||||||
|
|
||||||
- driver: `intel_cpufreq` 或 `intel_pstate`
|
- driver: `intel_cpufreq` 或 `intel_pstate`
|
||||||
|
|
||||||
- current policy: `governor "ondemand"` 或 `governor "performance"`
|
- current policy: `governor "ondemand"` 或 `governor "performance"`
|
||||||
|
|
||||||
还有另外一个命令可用来显示 CPU 当前调度器。
|
还有另外一个命令可用来显示 CPU 当前调度器。
|
||||||
|
|
||||||
@@ -570,7 +570,64 @@ $ find /sys/kernel/iommu_groups/ -type l
|
|||||||
/sys/kernel/iommu_groups/9/devices/0000:00:1c.6
|
/sys/kernel/iommu_groups/9/devices/0000:00:1c.6
|
||||||
```
|
```
|
||||||
|
|
||||||
## 6.系统清理
|
## 6. BTRFS 调整
|
||||||
|
|
||||||
|
**额外说明:**
|
||||||
|
|
||||||
|
1. 本节专为 `BTRFS` 单盘 `RAID0`(条带模式)安装的 PVE 系统设计,使用其他安装模式时,请跳过此节。
|
||||||
|
|
||||||
|
2. `BTRFS` 文件系统当前仍为技术预览状态,请谨慎操作。
|
||||||
|
|
||||||
|
3. 有关在 PVE 中使用 `BTRFS` 的详情,请参阅 [Proxmox VE - BTRFS](https://pve.proxmox.com/wiki/BTRFS) 。
|
||||||
|
|
||||||
|
安装 PVE 时,若使用了 `BTRFS` 单盘 `RAID0` 的安装模式,系统默认未启用 swap 和 zstd 压缩,需要手动开启。
|
||||||
|
|
||||||
|
通常情况下,内存与 swap 的 **推荐** 比例为 `1:1` 。本机具有 `16GB` 内存,因此设置 `16GB` swap 空间。
|
||||||
|
|
||||||
|
执行以下命令,在 `BTRFS` 文件系统中创建子卷,并配置激活 swapfile 。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 创建用于存放交换文件的子卷
|
||||||
|
$ btrfs subvolume create /swap
|
||||||
|
|
||||||
|
## 在子卷中创建 16GB 的交换文件
|
||||||
|
$ btrfs filesystem mkswapfile --size 16g --uuid clear /swap/swapfile
|
||||||
|
|
||||||
|
## 激活交换文件
|
||||||
|
$ swapon /swap/swapfile
|
||||||
|
```
|
||||||
|
|
||||||
|
此时还需进一步修改系统的 `fstab` 配置文件,以启用 `BTRFS` 的 zstd 压缩功能并确保 swap 在系统启动时自动激活。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 编辑 fstab 配置文件
|
||||||
|
$ nano /etc/fstab
|
||||||
|
```
|
||||||
|
|
||||||
|
`fstab` 为系统关键配置文件,直接影响系统启动,修改此文件时,请注意以下几点:
|
||||||
|
|
||||||
|
- 仅修改根目录 `/` 对应的挂载选项,添加 `compress=zstd` 参数。
|
||||||
|
|
||||||
|
- 在文件末尾新增一行,添加 swap 的自动挂载。
|
||||||
|
|
||||||
|
- 请 **不要** 修改其余配置参数,尤其是设备的唯一标识符( `UUID` ),切勿修改。
|
||||||
|
|
||||||
|
修改完成后,示例如下。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#### 系统 fstab 示例配置
|
||||||
|
|
||||||
|
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||||
|
|
||||||
|
UUID=<DO-NOT-EDIT-YOUR-UUID> / btrfs defaults,compress=zstd 0 1
|
||||||
|
|
||||||
|
UUID=<YOUR-UUID> /boot/efi vfat defaults 0 1
|
||||||
|
proc /proc proc defaults 0 0
|
||||||
|
|
||||||
|
/swap/swapfile none swap defaults 0 0
|
||||||
|
```
|
||||||
|
|
||||||
|
## 7.系统清理
|
||||||
|
|
||||||
PVE 系统配置完成后,可执行以下命令,对系统进行清理。
|
PVE 系统配置完成后,可执行以下命令,对系统进行清理。
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user