一、卸载已经挂载的 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

















