2021年7月
[PVE] 调整虚拟机(VM)的磁盘大小
第一步
通过web ui中调整磁盘大小功能,先设置分配给虚拟机的磁盘空间
第二步
进入虚拟机系统,我这里的系统是CentOS,其他Linux系统应该类似。
查看磁盘信息,可以看到磁盘的总大小已经变化了,但是下边两个分区没有变
fdisk -l
第三步
给 /dev/sda2分区增加空间,注意里边的命令 resizepart 2 100% ,是把剩余的空间全部给到/dev/sda2
parted /dev/sda
print
resizepart 2 100%
quit
第四步
更新物理卷的大小,当然这里前提是使用了LVM
pvresize /dev/sda2
接下来更新逻辑卷的大小
lvresize --extents +100%FREE --resizefs /dev/mapper/centos-root
最后可以看到已经成功了
df -h
原文链接:原文
PVE 6.X更新到7.X
1、在电脑上用Xshell之类的工具登录到PVE的SSH下,输入以下命令(带有#开头内容为注释,不需要输入的,只输入不是#开头的,下同):
#修改PVE源
sed -i 's/buster\/updates/bullseye-security/g;s/buster/bullseye/g' /etc/apt/sources.list
#删除PVE企业源
rm -rf /etc/apt/sources.list.d/pve-install-repo.list
2、输入vi /etc/apt/sources.list ,按 i 进入编辑状态,把原来的内容全部删除,复制以下内容进去粘贴,保存退出;
# debian aliyun source
#deb https://mirrors.tuna.tsinghua.edu.cn/debian bullseye main contrib non-free
#deb https://mirrors.tuna.tsinghua.edu.cn/debian bullseye-updates main contrib non-free
#deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
#deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription
deb http://ftp.debian.org/debian bullseye main contrib
deb http://ftp.debian.org/debian bullseye-updates main contrib
# security updates
deb http://security.debian.org bullseye-security main contrib
deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription
3、输入以下命令更新系统(由于PVE的源在国外服务器,建议全局开飞机,否则更新非常的慢),期间有可能弹出类似下图的提示需要选择的界面,直接无脑的按回车就行:
apt update && apt dist-upgrade -y
4、更新完成,输入 reboot 重启PVE;
5、启动好了以后,继续输入以下命令:
apt autoremove -y
6、敲命令先查看当前系统内核,然后卸载无用的内核,保持系统干净(强迫症发作了):
#查看当前用的内核
uname -a
#查看系统有多少个内核
dpkg --get-selections |grep kernel
7、卸载多余内核
#卸载无用内核,命令后面的pve-kernel-5.3.13-1-pve,是根据上一条命令显示出来的内核,需要修改成你自己PVE显示不用的,后面显示有purge字样的为系统使用中,不可以卸载的,其他的均可以卸载)
dpkg --purge --force-remove-essential pve-kernel-5.3.13-1-pve
dpkg --purge --force-remove-essential pve-kernel-5.3.13-3-pve
dpkg --purge --force-remove-essential pve-kernel-5.3.18-1-pve
dpkg --purge --force-remove-essential pve-kernel-5.3.18-2-pve
dpkg --purge --force-remove-essential pve-kernel-5.3.18-3-pve
dpkg --purge --force-remove-essential pve-kernel-5.4
dpkg --purge --force-remove-essential pve-kernel-5.4.101-1-pve
dpkg --purge --force-remove-essential pve-kernel-5.4.103-1-pve
dpkg --purge --force-remove-essential pve-kernel-5.4.106-1-pve
dpkg --purge --force-remove-essential pve-kernel-5.4.114-1-pve
dpkg --purge --force-remove-essential pve-kernel-5.4.119-1-pve
dpkg --purge --force-remove-essential pve-kernel-5.4.124-1-pve
dpkg --purge --force-remove-essential pve-kernel-5.4.34-1-pve
dpkg --purge --force-remove-essential pve-kernel-5.4.41-1-pve
dpkg --purge --force-remove-essential pve-kernel-5.4.44-1-pve
dpkg --purge --force-remove-essential pve-kernel-5.4.44-2-pve
dpkg --purge --force-remove-essential pve-kernel-5.4.55-1-pve
dpkg --purge --force-remove-essential pve-kernel-5.4.60-1-pve
dpkg --purge --force-remove-essential pve-kernel-5.4.65-1-pve
dpkg --purge --force-remove-essential pve-kernel-5.4.73-1-pve
dpkg --purge --force-remove-essential pve-kernel-5.4.78-1-pve
dpkg --purge --force-remove-essential pve-kernel-5.4.78-2-pve
dpkg --purge --force-remove-essential pve-kernel-5.4.98-1-pve
dpkg --purge --force-remove-essential pve-kernel-5.3.13-1-pve
#把不用的内核删除完成后,更新引导菜单
update-grub
#重启PVE
reboot
8、删除完成后再次查看内核,只有在使用的,没有多余的了;
9、进入PVE以后,系统可能还会自动重启3-4次,属于正常现象,请耐心等候,不要以为机子出了问题。等机器不再重启后,就可以把虚拟机启动起来。
10、优化PVE:
#安装时间同步工具,自动同步时间
apt install chrony -y
#安装网络配置修改后自动应用刷新的工具
apt install ifupdown2 -y
#删除以前的时间同步工具
apt remove systemd-timesyncd -y
apt-get remove --purge systemd-timesyncd
11、再回到网页端,已经更新到7.0-10了
Linux DD windows
秋水逸冰 Windows 10 Pro for Workstations 21H1 DD 镜像:
- 无需 VNC 交互直接无人值守安装,DD 完成后重启系统,稍等片刻即可远程登录桌面
- 关闭 Ctrl + Alt + Del 快捷键登录方式
- 默认开启 Windows 远程桌面
- 默认已屏蔽端口 135,137,138,139,445,预防勒索病毒
- 基于 Dism++ 自带的一些系统优化,如隐藏快捷方式小箭头,启用 Windows 照片查看器等等
- 在 KVM 或 XEN 虚拟化 VPS 上的安装过程
选 CentOS 7 或 Debian 9 系统。内存建议 4GB 起,硬盘建议 30GB 起。用 root 用户 ssh 进去后执行以下的命令,然后静静等待即可。
安装速度取决于网络下载镜像的速度,基本上等待 20 至 90 分钟后,再次打开 VNC 就能看到熟悉的 Windows 登录界面了。
wget -qO DebianNET.sh qiu.sh/dd && bash DebianNET.sh -dd "DD download URL"
注:DebianNET.sh 脚本由 Vicer 开发,参考网址:https://moeclub.org
- 在独立服务器上的安装过程
进入救援模式(rescue)后,以 root 用户 ssh 进去后执行以下的命令,成功完成后,再切换到正常模式重启服务器即可。
wget -O- "DD download URL" | gunzip | dd of=/dev/sda
8.用户密码
用户名: administrator
密码: Teddysun.com
9.镜像链接
https://dl.lamp.sh/iso/cn_windows10_21h1.gz
https://dl.lamp.sh/iso/en_windows10_21h1.gz
https://dl.lamp.sh/iso/ja_windows10_21h1.gz
以上转自秋水逸冰:原文
BETA.GS 一键DD版本:
1.安装重装系统的前提组件:
Debian/Ubuntu:
apt-get install -y xz-utils openssl gawk file wget screen && screen -S os
RedHat/CentOS:
yum install -y xz openssl gawk file glibc-common wget screen && screen -S os
如果出现异常,请刷新Mirrors缓存或更换镜像源。
2.更新
RedHat/CentOS:
yum makecache && yum update -y
Debian/Ubuntu:
apt update -y && apt dist-upgrade -y
3.开始DD使用:
wget --no-check-certificate -O AutoReinstall.sh https://git.io/betags && chmod a+x AutoReinstall.sh && bash AutoReinstall.sh
如为CN主机,可能出现报错或不能下载脚本的问题,可执行以下命令开始安装.
wget --no-check-certificate -O AutoReinstall.sh https://cdn.jsdelivr.net/gh/fcurrk/reinstall@master/AutoReinstall.sh && chmod a+x AutoReinstall.sh && bash AutoReinstall.sh
4.输入Y确认DD后主机自动获取IP,N则自行设置IP 输入N后会自动检测出主机现用IP,如果正确可以按Y确认使用,如不正确则按N自行按正确的输入。
5.镜像密码
25合一系统密码:
1、CentOS 7.7 (已关闭防火墙及SELinux,默认密码Pwd@CentOS)
2、CentOS 7 (默认密码cxthhhhh.com)
3、CentOS 8 (默认密码cxthhhhh.com)
4、CentOS 6 (默认密码Minijer.com)
5、Debian 10 (默认密码Minijer.com)
6、Debian 9 (默认密码Minijer.com)
7、Debian 8 (默认密码Minijer.com)
8、Debian 7 (默认密码Minijer.com)
9、Ubuntu 20.04 (默认密码Minijer.com)
10、Ubuntu 18.04 (默认密码Minijer.com)
11、Ubuntu 16.04 (默认密码Minijer.com)
12、Windows Server 2019 (默认密码cxthhhhh.com)
13、Windows Server 2016 (默认密码cxthhhhh.com)
14、Windows Server 2012 (默认密码cxthhhhh.com)
15、Windows Server 2012 Lite (默认密码nat.ee)
16、Windows Server 2008 (默认密码cxthhhhh.com)
17、Windows Server 2008 Lite (默认密码nat.ee)
18、Windows Server 2003 (默认密码cxthhhhh.com)
19、Windows Server 2003 Lite (默认密码WinSrv2003x86-Chinese)
20、Windows 10 LTSC Lite (默认密码www.nat.ee)
21、Windows 7 x86 Lite (默认密码Windows7x86-Chinese)
22、Windows 7 Ent Lite (默认密码nat.ee)
23、Windows 7 Ent Lite (UEFI支持甲骨文)(默认密码nat.ee)
24、Windows Server 2008 Lite (UEFI支持甲骨文)(默认密码nat.ee)
25、Windows Server 2012 Lite (UEFI支持甲骨文)(默认密码nat.ee)
99、自定义镜像6.注意:
经测试在谷歌云原版系统基础上DD会出现自动获取的子网掩码为255.255.255.255,如出现这种情况需要手工输入改正为正确的如255.255.255.0,否则会安装完成主机可能会离线。
Oracle Cloud(甲骨文云)可选择23-25一键DD,注意基础系统最好选择Ubuntu,如原系统是CentOS可能无法成功。
特别感谢:Vicer、cxt、hiCasper等各位技术大佬的脚本,站长只是脚本的"搬运工"。
以上版本转自:原文