By accessing the website and accepting the Cookie Policy, you agree to use the cookies provided by the Site in accordance with to analyze traffic, remember your preferences, and optimize your experience.

分类 - PVE

pve    2023-12-08 15:04:59    213    0    0

目前这个需求已经有人开发了工具,可以直接结合Proxmox VE 内部的备份工具,可以在Backup Log 中看到Rclone 的相关Log,搭配Proxmoe VE 内建CRON 自动备份到各种网路空间,非常方便:

安装Rclone

在Proxmox VE 中以root 身份登入,直接使用指令安装rclone

apt update
apt install rclone -y

或到Rclone 的官网下载安装:

初始化 Rclone

请务必仔细跟着设定,或是你自己去研究rclone 的config

# rclone config
2021/10/08 02:03:49 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> gd-backup_crypt # 务必使用这个名字,或是之后改脚本
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
~~
15 / Google Drive
\ "drive"
~~
Storage> 15
Google Application Client Id
Setting your own is recommended.
See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
If you leave this blank, it will use an internal key which is low performance.
Enter a string value. Press Enter for the default ("").
client_id> 123456789-xxx
pve    2023-12-08 15:04:59    93    0    0

之前用卷组的方法也可以,而且其实性能是一样的。

此方法只适用于Linux,而windows上应该是没办法的,至少我没想到什么办法通过DD的方式来整个软raid 0出来。

过程如下:

 

cat /proc/mdstat

mdadm /dev/md2 --fail /dev/sdb2

mdadm /dev/md2 --remove /dev/sdb2

wipefs -a /dev/sdb2

mdadm --grow /dev/md2 --level=0
mdadm --grow /dev/md2 --level=0 --raid-devices=2 --add /dev/sdb2

watch cat /proc/mdstat
# 等待重建完毕

mdadm --misc --detail /dev/md2

resize2fs /dev/md2


df -h

其中等待的那个过程非常非常漫长,比拜登那漫长而响亮的屁要漫长的多,建议睡觉前运行,睡醒了可能会做好。

最终结果如下:



2023-12-08 15:04:59    148    0    0

K3s、ZFS

不幸的是,在从 ext4 迁移到 ZFS 之后,我发现k3s由于缺少对overlayfsZFS 的支持而导致崩溃。

在解决这个问题之前,我升级到 Debian bullseye。

k3s, ZFS 和 overlayfs

k3s​目前不支持 ZFS 快照程序。可以通过三种方法解决此问题:

  • 使用外部 containerd 和 ZFS 快照程序(containerd​支持 ZFS)。然而,我就没那么幸运了,几个小时后我就放弃了。
  • 使用native​ snapshotter,它速度较慢并且消耗更多磁盘(将产生很多重复文件),但它可以工作。

    • 只需编辑/etc/systemd/system/k3s.service​并添加--snapshotter native​到k3s server​项目之后。
  • 为k3s ”agent” 创建专用的ext4分区格式的ZVOL卷 。这是我最终选择的解决方案,因为它速度更快且占用空间更少。

为k3s创建ZVOL

我们将利用 ZFS 的 ZVOL 功能来创建一个 ext4 卷以用作 overlayfs 的后端。ZVOL 是 ZFS 可以向系统公开的块设备(与作为 ZFS 文件系统的数据集相反)。这些 ZVOL 可以像普通块设备一样使用:我们将创建其中一个,用 ext4 格式化它并用它来托管 k3s agent目录。

  1. # use zfs list see the zfs root path name and the space of disk, in my server which on PVE7 it's "rpool"
  2. zfs list
  3. # Create a sparse (-s) zvol (-V).
  4. # "Sparse" means that the volume will be allocated as data is written into the
  5. # volume. So this ZVOLs will grow over time, when needed, until 90G
  6. zfs create -s -V 90GB rpool/k3s-agent
  7. # Format the ZVOL as ext4
  8. mkfs.ext4 /dev/zvol/rpool/k3s-agent
  9. # Now you nee
pve    2023-12-08 15:04:59    112    0    0

1、合并存储 删除local-lvm存储空间

lvremove
lvremove pve/data lvextend -l +100%FREE -r pve/root


2、web界面删除local-lvm

数据中心-存储-删除local-lvm 编辑local,内容里添加 磁盘映像和容器​