用virtual-manager安装虚拟机
使用virt-manager基本使用
启用机管理主窗口
硬件细节窗口 配置虚拟机启动选项 附加USB设备给虚拟机准备工作 USB重定向
虚拟机图形控制台
添加远程连接
显示虚拟机细节
性能监视
实验准备
操作系统安装介质,is文件
磁盘空间准备
添加新的磁盘
创建LV
创建文件系统及挂载点
再添加新的硬盘时无需重启
[root@kvm1 ~]# cd /sys/class/scsi_host/
[root@kvm1 scsi_host]# ll
total 0
lrwxrwxrwx. 1 root root 0 Jun 1 09:06 host0 -> ../../devices/pci0000:00/0000:00:10.0/host0/scsi_host/host0
lrwxrwxrwx. 1 root root 0 Jun 1 09:06 host1 -> ../../devices/pci0000:00/0000:00:07.1/ata1/host1/scsi_host/host1
lrwxrwxrwx. 1 root root 0 Jun 1 09:06 host2 -> ../../devices/pci0000:00/0000:00:07.1/ata2/host2/scsi_host/host2
[root@kvm1 scsi_host]# echo "- - -"> /sys/class/scsi_host/host0/scan
[root@kvm1 scsi_host]# echo "- - -"> /sys/class/scsi_host/host1/scan
[root@kvm1 scsi_host]# echo "- - -"> /sys/class/scsi_host/host2/scan
[root@kvm1 scsi_host]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000ba179
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM
Disk /dev/sdb: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
分区lvm管理
[root@kvm1 scsi_host]# fdisk /dev/sdb
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-419430399, default 2048): 2048
Last sector, +sectors or +size{K,M,G} (2048-419430399, default 419430399): 419430399
Partition 1 of type Linux and of size 200 GiB is set
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@kvm1 scsi_host]# fdisk -l
Disk /dev/sdb: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x1fe1f288
Device Boot Start End Blocks Id System
/dev/sdb1 2048 419430399 209714176 8e Linux LVM
pv vg lv
[root@kvm1 scsi_host]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created.
[root@kvm1 scsi_host]# vgcreate vmvg /dev/sdb1
Volume group "vmvg" successfully created
[root@kvm1 scsi_host]# lvcreate -l 100%VG -n lvvm1 vmvg
Logical volume "lvvm1" created.
创建文件系统
[root@kvm1 scsi_host]# lvscan
ACTIVE '/dev/vmvg/lvvm1' [<200.00 GiB] inherit
ACTIVE '/dev/centos/swap' [2.00 GiB] inherit
ACTIVE '/dev/centos/root' [<17.00 GiB] inherit
[root@kvm1 scsi_host]# mkfs.ext4 /dev/vmvg/lvvm1
mount点
[root@kvm1 scsi_host]# mkdir /vm
[root@kvm1 scsi_host]# mount /dev/vmvg/lvvm1 /vm
[root@kvm1 scsi_host]# vi /etc/fstab
lts 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
/
用winscp传输镜像
[root@kvm1 scsi_host]# mkdir /iso
[root@kvm1 scsi_host]# cd /iso
[root@kvm1 iso]# ll
total 883640
-rw-r--r--. 1 root root 373293056 May 11 15:35 CentOS-6.10-i386-minimal.iso
-rw-r--r--. 1 root root 531554304 May 17 17:12 virtio-win-0.1.217.iso
[root@kvm1 iso]#
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)