PVE 系统下虚拟机数据盘从IDE转换为VIRIO

一、卸载已经挂载的 IDE 数据盘

root@localhost \~# df -h

文件系统 容量 已用 可用 已用% 挂载点

/dev/mapper/centos-root 29G 897M 29G 4% /

devtmpfs 909M 0 909M 0% /dev

tmpfs 920M 0 920M 0% /dev/shm

tmpfs 920M 8.5M 912M 1% /run

tmpfs 920M 0 920M 0% /sys/fs/cgroup

/dev/sda1 1014M 143M 872M 15% /boot

tmpfs 184M 0 184M 0% /run/user/0

/dev/sdb1 32G 49M 30G 1% /data

root@localhost /# cd /data

root@localhost data# touch xiaoyf.txt

root@localhost data# vi xiaoyf.txt

root@localhost data# cat xiaoyf.txt

2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test

root@localhost \~# umount /dev/sdb1 /data

umount: /data:未挂载

二、登录 PVE 选择需要转换的虚拟机

1.1 、选择虚拟机数据盘并 Detach

1.2 选择卸载的磁盘

1.3 修改为 VirIO Block

1.4 add 这块磁盘

三、检验

原来的数据盘变为vda, 分区自动变为vda1 (IDE的时候是sdb , 分区是 sdb1)

root@localhost \~# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

sda 8:0 0 32G 0 disk

├─sda1 8:1 0 1G 0 part /boot

└─sda2 8:2 0 31G 0 part

├─centos-root 253:0 0 29G 0 lvm /

└─centos-swap 253:1 0 2G 0 lvm SWAP

sr0 11:0 1 792M 0 rom

vda 252:0 0 32G 0 disk

└─vda1 252:1 0 32G 0 part

把这个分区还是mount 在/data目录, 数据没有丢失

root@localhost \~# mount /dev/vda1 /data

root@localhost data# cat xiaoyf.txt

2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test2023.4.17 test

转换成功

相关推荐
欧米欧6 分钟前
Linux基础指令上
linux·运维·服务器
ARM|X86+FPGA工业主板厂家1 小时前
基于嵌入式 GPU 的智能服务机器人
linux·运维·arm开发·fpga开发·机器人
sulikey1 小时前
Linux 粘滞位(Sticky Bit)完全指南:为什么共享目录需要“防删除“?
linux·服务器
mengge.cloud1 小时前
网络技术基础小白教程
linux·服务器·网络·云计算
学代码的CJY2 小时前
Linux 重定向、管道与环境变量
linux·spring boot·spring
treacle田2 小时前
达梦数据库-Linux DM数据守护主备集群缩改为单机-记录总结
linux·服务器·数据库·主备集群改单机
IT大白鼠3 小时前
CentOS 7.9 自建 Yum 源服务器搭建指南
linux·服务器·centos
LaughingZhu3 小时前
Product Hunt 每日热榜 | 2026-09-02
java·ide·intellij-idea
高亦真3 小时前
今天是学习嵌入式的第34天
linux·学习·算法
cuijiecheng20184 小时前
从 GinormoTime 到 Rocky Linux:25fps LTC 完整搭建与验证实战
linux·运维·服务器