Edit Commands.md & Snippets.md
Deploy / deploy (push) Successful in 52s

This commit is contained in:
cattom committed 2026-11-07 21:55:05 +08:00
1 parent 290876138a
commit 99fee504de
2 files changed
+95 -61

No files matched your search

@@ -387,6 +387,97 @@ lsmod | grep bbr
(待施工)
## NFS 配置
```bash
# Install
sudo apt -y update && sudo apt -y install nfs-kernel-server nfs-common
# Modify firewall on host
sudo ufw allow from [client_ip] to any port nfs
# Create mount point on client
sudo mkdir -p [/path/on/client]
# Mount directories on client
sudo mount [host_ip]:[/path/on/host] [/path/on/client]
# Check stats on client
sudo df -h
# Mount the directories at boot
sudo echo "[host_ip]:[/path/on/host] [/path/on/client] nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0" >> /etc/fstab
# Unmount NFS
sudo umount [/path/on/client]
```
## macOS 恢复挂载网络存储(Samba)
macOS 完成更新后,依照以下流程恢复挂载 NFS:
- 添加挂载点:
```bash
sudo su
echo "/System/Volumes/Data/mnt/CTS2 auto_mount_config -nosuid,noowners" >> /etc/auto_master
```
- 确认挂载配置有效性:
```bash
cat /etc/auto_mount_config
```
- 恢复挂载并验证:
```bash
automount -vc
ls -al /System/Volumes/Data/mnt/CTS2
```
## rsync
rsync 参数解释:
- `-a`: 归档模式,保留文件的权限、时间戳、软链接、属主和属组。
- `-v`: 详细模式,输出同步过程中的文件名。
- `-z`: 在传输时进行压缩。
- `-P`: 等同于 `--partial` `--progress`。`--progress` 会显示每个文件的传输进度,`--partial` 允许断点续传。
- `--delete`: 删除目标目录中,源目录内已不存在的文件,即完全镜像同步。
rsync 对路径末尾的斜杠敏感:
- `/local/source/folder/` (有斜杠): 只同步文件夹里面的**内容**到目标目录。
- `/local/source/folder` (无斜杠): 将 `folder` 这个**目录本身连同里面的内容**,整个放入目标目录中。
### 推送文件
```bash
# 将本地文件推送到远程服务器 (Push)
rsync -avP /root/backup/grafana-storage.tar.gz root@100.97.10.99:/root/backup/
```
### 同步文件夹
```bash
# 远程服务器与本地文件夹保持同步 (Push)
rsync -avzP --delete /local/source/folder/ [server_id]:/remote/destination/folder/
# 本地文件夹与远程服务器保持同步 (Pull)
rsync -avzP --delete [server_id]:/local/source/folder/ /remote/destination/folder/
```
## tar
**压缩**:
```bash
# 先进入 [target] 的父目录
cd /root/backrest/tmp/grafana-storage-backrest-restore
tar -czpf /root/backup/grafana-storage.tar.gz grafana-storage
```
**解压缩**:
```bash
# 先进入进行解压缩的目录
cd /root/backup
tar -xzpf grafana-storage.tar.gz
# 解压缩产物: /root/backup/grafana-storage/
```
## TCP ping 与 UDP ping
**TCP ping**:
@@ -413,25 +504,6 @@ ssh -L [local-port]:[lan-ip]:[lan-port] [username]@[remote-ip]
ssh -L 8007:192.168.1.6:8007 cattom@100.116.56.77
```
## NFS 配置
``` bash
# Install
sudo apt -y update && sudo apt -y install nfs-kernel-server nfs-common
# Modify firewall on host
sudo ufw allow from [client_ip] to any port nfs
# Create mount point on client
sudo mkdir -p [/path/on/client]
# Mount directories on client
sudo mount [host_ip]:[/path/on/host] [/path/on/client]
# Check stats on client
sudo df -h
# Mount the directories at boot
sudo echo "[host_ip]:[/path/on/host] [/path/on/client] nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0" >> /etc/fstab
# Unmount NFS
sudo umount [/path/on/client]
```
## 进入 Docker 容器的终端
```bash
@@ -440,46 +512,6 @@ sudo docker exec -it [container_name] /bin/bash
sudo docker exec -it [container_name] /bin/sh
```
## rsync 同步文件
rsync 参数解释:
- `-a`: 归档模式,保留文件的权限、时间戳、软链接、属主和属组。
- `-v`: 详细模式,输出同步过程中的文件名。
- `-z`: 在传输时进行压缩。
- `-P`: 等同于 `--partial` `--progress`。`--progress` 会显示每个文件的传输进度,`--partial` 允许断点续传。
rsync 对路径末尾的斜杠敏感:
- `/local/source/folder/` (有斜杠): 只同步文件夹里面的**内容**到目标目录。
- `/local/source/folder` (无斜杠): 将 `folder` 这个**目录本身连同里面的内容**,整个放入目标目录中。
``` bash
# 将本地文件夹推送到远程服务器 (Push)
rsync -avzP --delete /local/source/folder/ [server_id]:/remote/destination/folder/
# 从远程服务器拉取文件夹到本地 (Pull)
rsync -avzP --delete [server_id]:/local/source/folder/ /remote/destination/folder/
```
## macOS 恢复挂载网络存储
macOS 完成更新后,依照以下流程恢复挂载 NFS:
- 添加挂载点:
```bash
sudo su
echo "/System/Volumes/Data/mnt/CTS2 auto_mount_config -nosuid,noowners" >> /etc/auto_master
```
- 确认挂载配置有效性:
```bash
cat /etc/auto_mount_config
```
- 恢复挂载并验证:
```bash
automount -vc
ls -al /System/Volumes/Data/mnt/CTS2
```
## 参考
[用于 GitHub Actions 的 SSH](https://github.com/appleboy/ssh-action/blob/master/README.zh-cn.md)
+4 -2
View File
@@ -131,7 +131,9 @@ services:
镜像链接: [Index of /groups/virt/virtio-win/direct-downloads/archive-virtio](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/?C=M;O=D)
(2026年3月23日)目前推荐下载版本 `virtio-win-0.1.271-1`,更新或过旧的版本都出现了[兼容性问题](https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers#Troubleshooting)。
!!! warning "注意!"
部分版本出现了[兼容性问题](https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers#Troubleshooting)。
### 下载与挂载镜像
@@ -226,7 +228,7 @@ code Documents/Code/VSCODE.code-workspace # 通过终端启动 Visual Studio Cod
但是上述问题在 Windows 端并未出现,所以到底是哪个环节出了问题?犹未可知。
## macOS Tahoe 26.4 挂载网络存储
## macOS Tahoe 26 挂载网络存储
创建挂载文件夹。