fix: 添加webvirtcloud扩展硬盘大小的方法

This commit is contained in:
spiritlhl
2025-07-02 12:04:15 +00:00
parent c68fa3114e
commit 0da4ea90c2
4 changed files with 87 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@@ -103,15 +103,56 @@ The default login for the image is:
- **Username**: `root`
- **Password**: `password` or `oneclickvirt`
After booting, you will find that the hard disk is only the size of the original image, at this time you need to adjust the size of the hard disk, you need to shut down the computer again, at this time, you can see the buttons on the following page is available and the size of the hard disk is also recognized.
Without the first boot, the size of the hard disk is not recognized, recognition can not be modified, so the first switch is necessary.
![resize](images/resize.jpg)
After the modification and restart the virtual machine, you will find that there is new disk space unallocated, at this time you need to follow the following method broad disk.
Check the disk path and remaining blank space unallocated:
```shell
lsblk
```
Then use the following command to broaden the disk
```shell
fdisk /dev/vda
```
Do this in the following order:
Type ```d``` to delete the old partition (yes, you need to delete the old vda1, no data will be lost as it will not be formatted later).
Type ```n``` and enter to create a new partition.
Select primary for type (default p) and just enter.
Partition number is also ```1```.
The start position must be the same as the old partition (default is right), just press enter.
Show if you want to erase fingerprints, type ```Y``` and enter.
Press enter at the end position to use all the remaining space.
Type ```w``` to save and exit.
At this point, use ```lsblk``` to confirm that the new free disk has been successfully allocated.
## Disadvantages
Networking is not auto-configured — not as smart as the previous project — you still need to configure it manually.
You need to be in the VNC of the opened VM, logged in and execute
```shell
systemctl start cloud-init
systemctl enable cloud-init
reboot
```
Enable the configuration manually.
Manually enable the configuration to self-start after reboot, then reboot the server and you have internet.

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@@ -110,6 +110,46 @@ chmod 777 debian12.qcow2
镜像的默认登录的用户名是```root```,密码是```password```或者是 ```oneclickvirt```。
开机后,你会发现硬盘只有原始镜像的大小,此时需要调整硬盘大小,需要再次关机,此时能见到下图页面的按钮可用且硬盘大小也识别出来了。
没有经过首次开机,硬盘的大小是识别不出来的,识别不出来就不能进行修改,所以首次开关机是必须的。
![resize](images/resize.jpg)
修改后重启虚拟机,会发现有新的盘空间未分配,此时需要按照下面的方法阔盘。
查看盘路径和剩余空白空间未分配的:
```shell
lsblk
```
然后使用下述命令阔盘
```shell
fdisk /dev/vda
```
按以下顺序操作:
输入```d```删除旧的分区(是的,需要删除旧的 vda1数据不会丢失因为后面不会格式化
输入```n```后回车新建一个分区。
类型选 primary默认 p直接回车就行
分区号同样选```1```
起始位置必须和旧分区一样(默认是对的)按回车就行
显示是否需要擦除指纹,输入```Y```回车
结束位置直接按回车,使用全部剩余空间
输入```w```保存并退出。
此时再使用```lsblk```可确认新的空闲硬盘被分配成功了。
## 缺点
网络还是没有自动配置,不如上一个项目智能,还得手动配置一下。
@@ -117,7 +157,8 @@ chmod 777 debian12.qcow2
需要在已经开好的虚拟机的VNC中登录后执行
```shell
systemctl start cloud-init
systemctl enable cloud-init
reboot
```
手动启用配置。
手动启用配置为重启后自启动,然后重启服务器,就有网了