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.
2023-12-08 15:04:59    1109    0    0

一:zfs arc缓存介绍

zfs的raid,就像软raid,通过计算机的计算来实现raid,但是缓存从哪里来?内存啊,速度比硬盘快的多,而sun的 Solaris,以前就是怪物一样的超级大内存,所以ZFS在设计的时候,就很耗内存,移植到linux之后还带着这样的基因,占用50%的物理内存做zfs缓存。


二:检查内存占用

我的32G内存,就占了一半多一点,系统还得占点。

arcstat,pve管理界面,这些地方都能看到。


三:设置arc最大内存

这就是ZFS允许减小允许使用ARC大小的最大大小的原因。此设置在/etc/modprobe.d/zfs.conf文件中完成。

例如,如果您希望ARC永远不要超过32 GB,请添加以下行:

options zfs zfs_arc_max=34359738368
# 设置为1G
options zfs zfs_arc_max=1073741824

简单设置命令为:

echo "options zfs zfs_arc_max=1073741824" >> /etc/modprobe.d/zfs.conf

根据你的物理内存,自己计算吧,1G:1*1024*1024*1024*1024

如果根文件系统也使用了ZFS,你必须在每次修改该参数后更新initramfs,如下:

update-initramfs -u

四:测试效果

内存占用从16G多变成1G多了。

你就自己看arcstat或PVE的管理界面吧。

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

启动救援模式,开启qemu虚拟机挂载本机系统

apt -y update
apt -y install qemu qemu-kvm

wget http://download.proxmox.com/iso/proxmox-ve_7.1-1.iso

qemu-system-x86_64 \
-enable-kvm \
-nodefaults \
-cdrom /root/proxmox-ve_7.1-1.iso \
-hda /dev/sda \
-hdb /dev/sdb \
-cpu host \
-smp 4 \
-m 8G \
-net nic \
-net user \
-vga std \
-vnc 0.0.0.0:0 \
-usbdevice tablet \
-k en-us​

使用VNC连接ip:5900,通过root登陆后排出故障项


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

图片[1]-KIMSUFI使用proxmox开【IPv4nat+IPv6】小鸡-科技密码

活动昨天跟风入手了KIMSUFI-LE独服,配置和价格都很不错。唯一槽点是机器只有下行是G口,上行被限制在了100M。听说有几率中奖开到上下都是G口,还听说有几率IPV6的上下行都是G口(仅IPV4限速)。结果我开的机器2个奖都没中(′⌒`)。

 

写这个教程主要是给IPV6中奖者开小鸡一个参考。IPv4设置较简单,这里只设置了小鸡可以访问IPv4外网,并没有给小鸡分配端口转发(

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

当创建kvm虚拟机后忘记密码、某些文件丢失或损坏无法继续使用虚拟机,宿主机挂载镜像来解决这样的难题。

1 raw格式

方法一

对于未分区镜像文件直接使用loop:

第一步:

file image.img 查看什么格式

第二步:
mount -o loop p_w_picpath.img /mnt/p_w_picpath

lxc容器在这一步,已经可以直接挂载文件到指定位置了

已分区的镜像文件:
如果已知分区的起始位置
mount -o loop,offset=32256 p_w_picpath.img /mnt/p_w_picpath
方法二:

使用losetup + kpartx
losetup /dev/loop0 p_w_picpath.img
kpartx -a /dev/loop0
mount /dev/mapper/loop0p1 /mnt/p_w_picpath
kpartx命令的作用,是让Linux内核读取一个设备上的分区表,然后生成代表相应分区的设备。
kpartx -l p_w_picpathfile 可以查看一个映像文件中的分区,使用 kpartx -a p_w_picpathfile 命令后,就可以通过 /dev/mapper/loop0pX (其中X是 分区号)来访问映像。

2 qcow2格式
对于qcow2格式需要使用qemu-nbd这个工具,如果没有请用yum安装.
modprobe nbd max_part=63
qemu-nbd -c /dev/nbd0 p_w_picpath.img
mount /dev/nbd0p1 /mnt/p_w_picpath

3 如果是LVM格式的镜像:
vgscan
vgchange -ay
mount /dev/VolGroupName/LogVolName /mnt/p_w_picpath

4 最后使用结束需释放资源:
umount /mnt/p_w_picpath
vgchange -an VolGroupName
killall qemu-nbd
kpartx -d /dev/loop0
losetup -d /dev/loop0

 

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

默认LXC容器不允许docker嵌套。要启动虚拟化嵌套功能,需要按照以下步骤在proxmox的母鸡上进行后续操作。

本教程使用新创建的虚拟机进行讲解 (假设创建了 CT100) :

cd /etc/pve/lxc

需要先停止lxc容器,之后对配置文件进行修改

nano 100.conf

在cores字段下加入以下代码:

features: nesting=1,fuse=1,
2022-10-25 17:28:41    1379    0    0

备份现有apt源配置
mv /etc/apt/sources.list /etc/apt/sources.list.old​

替换源

替换为默认官方源

# 全部复制后,直接粘贴并按下回车执行
cat > /etc/apt/sources.list << EOF
deb http://deb.debian.org/debian/ bullseye main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye main contrib non-free

deb http://deb.debian.org/debian/ bullseye-updates main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye-updates main contrib non-free

deb http://deb.debian.org/debian/ bullseye-backports main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye-backports main contrib non-free

deb http://deb.debian.org/debian-security/ bullseye-security main contrib non-free
deb-src http://deb.debian.org/debian-security/ bullseye-security main contrib non-free
EOF

替换为腾讯云内网源

cat > /etc/apt/sources.list << EOF
deb http://mirrors.tencentyun.com/debian/ bullseye main contrib non-free
deb-src http://mirrors.tencentyun.com/debian/ bullseye main contrib non-free

deb http://mirrors.tencentyun.com/debian/ bullseye-updates main
2022-10-25 17:12:12    230    0    0

网络配置

配置网卡

修改 /etc/network/interfaces 添加如下

#号后面是注释文字
 
auto eth0 #开机自动激活
iface eth0 inet static #静态IP
address 192.168.0.56 #本机IP
netmask 255.255.255.0 #子网掩码
gateway 192.168.0.254 #路由网关
 
#因为我是通过路由上网的,所以配置为静态IP和网关

如果是用 DHCP 自动获取,请在配置文件里添加如下:

iface eth0 inet dhcp

设置IPv6

#IPV6静态地址配置
auto eth0 #开机自动激活
iface eth0 inet6 static
pre-up modprobe ipv6
address 2607:f0d0:2001:000a:0000:0000:0000:0002 #本机IPv6
netmask 64 #子网掩码网段
gateway 2607:f0d0:2001:000a:0000:0000:0000:0001 #网关IPv6

设置 DNS

# IPv4专用
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
# IPv6专用
echo "nameserver 2001:4860:4860::8888" >> /etc/resolv.conf
#请设置为你当地的DNS

到这里配置好以后,重启一下网络。

重启网络

service networking restart

网卡配置

ifup 命令 用于激活指定的网络接口。

# 启动网卡eth1
ifup eth1

ifdown 命令 用于禁用指定的网络接口。

# 停止网卡eth1
ifdown eth1

问题处理

问题描述:

配置完 /etc/networking/interfaces 后,使用 /etc/init.d/networking restart 出现启动失败,根据提示输入 systemctl status networking.service 发现不认识 /etc/networking/interfaces 中配置的虚拟网卡 (或者是因为虚拟机的重新移动导致的设备不匹配问题等)

解决方法:

首先可以查看 etc/udev/rules.d/70-persistent-net.rules 是否存在,如果存在,则删