mirror of
https://gitee.com/callmer/pve_toss_notes.git
synced 2026-08-31 22:12:51 +08:00
Compare commits
2
Commits
66df985278
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
126635206a | ||
|
|
d3715eaf4e |
+1
-55
@@ -472,61 +472,7 @@ $ find /sys/kernel/iommu_groups/ -type l
|
|||||||
/sys/kernel/iommu_groups/9/devices/0000:00:14.1
|
/sys/kernel/iommu_groups/9/devices/0000:00:14.1
|
||||||
```
|
```
|
||||||
|
|
||||||
## 5. BTRFS 调整
|
## 5.系统清理
|
||||||
|
|
||||||
**额外说明:**
|
|
||||||
- 本节专为 `BTRFS` 单盘 `RAID0`(条带模式)安装的 PVE 系统设计,使用其他安装模式时,请跳过此节
|
|
||||||
- `BTRFS` 文件系统当前仍为技术预览状态,请谨慎操作
|
|
||||||
- 有关在 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 配置文件
|
|
||||||
$ editor /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
|
|
||||||
```
|
|
||||||
|
|
||||||
## 6.系统清理
|
|
||||||
|
|
||||||
PVE 系统配置完成后,可执行以下命令,对系统进行清理。
|
PVE 系统配置完成后,可执行以下命令,对系统进行清理。
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -102,6 +102,8 @@ $ sudo tee /etc/systemd/resolved.conf.d/10-server-dns.conf >/dev/null <<'EOF'
|
|||||||
DNS=127.0.0.1
|
DNS=127.0.0.1
|
||||||
DNS=::1
|
DNS=::1
|
||||||
DNSStubListener=no
|
DNSStubListener=no
|
||||||
|
LLMNR=no
|
||||||
|
MulticastDNS=no
|
||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -436,7 +438,6 @@ no-hosts
|
|||||||
no-ident
|
no-ident
|
||||||
no-resolv
|
no-resolv
|
||||||
no-round-robin
|
no-round-robin
|
||||||
rebind-localhost-ok
|
|
||||||
stop-dns-rebind
|
stop-dns-rebind
|
||||||
rebind-domain-ok=/fox.internal/
|
rebind-domain-ok=/fox.internal/
|
||||||
|
|
||||||
|
|||||||
+6
-5
@@ -443,6 +443,8 @@ $ sudo tee /etc/systemd/resolved.conf.d/10-server-dns.conf >/dev/null <<'EOF'
|
|||||||
DNS=127.0.0.1
|
DNS=127.0.0.1
|
||||||
DNS=::1
|
DNS=::1
|
||||||
DNSStubListener=no
|
DNSStubListener=no
|
||||||
|
LLMNR=no
|
||||||
|
MulticastDNS=no
|
||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -519,9 +521,8 @@ no-hosts
|
|||||||
no-ident
|
no-ident
|
||||||
no-resolv
|
no-resolv
|
||||||
no-round-robin
|
no-round-robin
|
||||||
rebind-localhost-ok
|
|
||||||
stop-dns-rebind
|
stop-dns-rebind
|
||||||
rebind-domain-ok=/fox.internal/
|
rebind-domain-ok=/fox.internal/ts.net/
|
||||||
|
|
||||||
# DNS Filter
|
# DNS Filter
|
||||||
|
|
||||||
@@ -539,8 +540,8 @@ local=/test/
|
|||||||
|
|
||||||
# DNS Server
|
# DNS Server
|
||||||
|
|
||||||
server=/ts.net/100.100.100.100
|
|
||||||
server=/fox.internal/172.16.1.1
|
server=/fox.internal/172.16.1.1
|
||||||
|
server=/ts.net/100.100.100.100
|
||||||
server=172.16.1.1
|
server=172.16.1.1
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -562,7 +563,7 @@ $ sudo systemctl restart dnsmasq.service
|
|||||||
|
|
||||||
为了在网卡重新上线后自动恢复参数,本文使用 `networkd-dispatcher` 监听 `routable` 状态。
|
为了在网卡重新上线后自动恢复参数,本文使用 `networkd-dispatcher` 监听 `routable` 状态。
|
||||||
|
|
||||||
优化脚本直接使用事件中的 `IFACE`,仅处理由 `systemd-networkd` 配置的底层网卡,并跳过 `tailscale0` 和其他 TUN 设备。
|
优化脚本直接使用事件中的 `IFACE` ,仅处理由 `systemd-networkd` 配置的底层网卡,并跳过 `tailscale0` 和其他 TUN 设备。
|
||||||
|
|
||||||
首先检查 TS 服务器的底层出口网卡。
|
首先检查 TS 服务器的底层出口网卡。
|
||||||
|
|
||||||
@@ -577,7 +578,7 @@ $ NETDEV=$(networkctl list --no-legend --no-pager | awk '$3 == "ether" && $4 ==
|
|||||||
$ networkctl status "$NETDEV"
|
$ networkctl status "$NETDEV"
|
||||||
```
|
```
|
||||||
|
|
||||||
`systemd-networkd` 应显示为 `active`,底层出口网卡应显示为 `State: routable (configured)`。
|
`systemd-networkd` 应显示为 `active` ,底层出口网卡应显示为 `State: routable (configured)` 。
|
||||||
|
|
||||||
检查完成后,创建 `networkd-dispatcher` 的 `routable` 事件脚本。
|
检查完成后,创建 `networkd-dispatcher` 的 `routable` 事件脚本。
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ no-hosts
|
|||||||
no-ident
|
no-ident
|
||||||
no-resolv
|
no-resolv
|
||||||
no-round-robin
|
no-round-robin
|
||||||
rebind-localhost-ok
|
|
||||||
stop-dns-rebind
|
stop-dns-rebind
|
||||||
rebind-domain-ok=/fox.internal/
|
rebind-domain-ok=/fox.internal/
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,8 @@ no-hosts
|
|||||||
no-ident
|
no-ident
|
||||||
no-resolv
|
no-resolv
|
||||||
no-round-robin
|
no-round-robin
|
||||||
rebind-localhost-ok
|
|
||||||
stop-dns-rebind
|
stop-dns-rebind
|
||||||
rebind-domain-ok=/fox.internal/
|
rebind-domain-ok=/fox.internal/ts.net/
|
||||||
|
|
||||||
# DNS Filter
|
# DNS Filter
|
||||||
|
|
||||||
@@ -39,7 +38,7 @@ local=/test/
|
|||||||
|
|
||||||
# DNS Server
|
# DNS Server
|
||||||
|
|
||||||
server=/ts.net/100.100.100.100
|
|
||||||
server=/fox.internal/172.16.1.1
|
server=/fox.internal/172.16.1.1
|
||||||
|
server=/ts.net/100.100.100.100
|
||||||
server=172.16.1.1
|
server=172.16.1.1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user