KVM中Linux虚拟机的硬盘添加方法
[root@cache01 ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
ext4 8.3G 937M 7.0G 12% /
tmpfs tmpfs 119M 0 119M 0% /dev/shm
/dev/vda1 ext4 477M 33M 419M 8% /boot
[root@cache01 ~]#
生成一块新的硬盘
[root@bass virhost]# qemu-img create -f raw o5cache.add.disk.raw 2G
Formatting '05cache.add.disk.raw', fmt=raw size=2147483648
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<source file='/home/virhost/05cache.add.disk.raw'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</disk>
[root@bass virhost]# virsh start 05cache
Domain 05cache started [root@bass virhost]# virsh attach-disk 05cache /home/virhost/05cache.add.disk.raw vdb --cache none
Disk attached successfully
virsh edit 05cache---------------->
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<source file='/home/virhost/05cache.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<disk type='block' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='hdc' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk>
[root@cache01 ~]# fdisk -l Disk /dev/vda: 10.7 GB, 10737418240 bytes
16 heads, 63 sectors/track, 20805 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c1fb8 Device Boot Start End Blocks Id System
/dev/vda1 * 3 1018 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2 1018 20806 9972736 8e Linux LVM
Partition 2 does not end on cylinder boundary. Disk /dev/vdb: 2147 MB, 2147483648 bytes #挂上的新的硬盘
16 heads, 63 sectors/track, 4161 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000 Disk /dev/mapper/VolGroup-lv_root: 9168 MB, 9168748544 bytes
255 heads, 63 sectors/track, 1114 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000 Disk /dev/mapper/VolGroup-lv_swap: 1040 MB, 1040187392 bytes
255 heads, 63 sectors/track, 126 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
在虚拟机中对硬盘进行格式化
[root@cache01 ~]# mkfs.ext4 /dev/vdb
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
131072 inodes, 524288 blocks
26214 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912 Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
接下来建一个目录来挂载新的硬盘:
[root@cache01 ~]# mkdir /nd
[root@cache01 ~]# mkdir /nd
[root@cache01 ~]# mount /dev/vdb /nd/
#获取硬盘的UUID
[root@cache01 ~]# blkid /dev/vdb
/dev/vdb: UUID="a35e0890-3aa6-47a7-921c-c2cb9dd431e6" TYPE="ext4"
将挂载添加到开机启动中:
[root@cache01 ~]# cat /etc/fstab #
# /etc/fstab
# Created by anaconda on Tue Jun 28 08:57:38 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VolGroup-lv_root / ext4 defaults 1 1
UUID=04e8e77f-2604-4683-833b-a06a7300c7a3 /boot ext4 defaults 1 2
/dev/mapper/VolGroup-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
UUID=a35e0890-3aa6-47a7-921c-c2cb9dd431e6 /nd ext4 defaults 1 2
[root@cache01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
8.3G 644M 7.3G 9% /
tmpfs 119M 0 119M 0% /dev/shm
/dev/vda1 477M 33M 419M 8% /boot
/dev/vdb 2.0G 3.0M 1.9G 1% /nd
KVM中Linux虚拟机的硬盘添加方法的更多相关文章
- VMWare中Linux虚拟机设置静态IP上网的设置方法
VMWare中Linux虚拟机设置静态IP上网的设置方法 标签: vmwareLinux虚拟机securecrt静态IP上网 2016-05-18 02:30 702人阅读 评论(0) 收藏 举报 ...
- VirtualBox中Linux虚拟机与主机共享文件夹
VirtualBox中Linux虚拟机与主机共享文件夹 一.Linux虚拟机安装增强功能 二.点击虚拟机 设置-->选择 共享文件夹-->点击右侧的带加号的文件夹图标,执行下面的操作1. ...
- 在VMware上克隆Linux虚拟机及其网卡配置方法
最近在搭建Hadoop集群,1个Master,3个Workers.使用VMware workstations创建Linux虚拟机,版本是CentOS7.安装完成并做了相应的网络配置后,使用VMware ...
- [linux]vmware中linux虚拟机扩容 标签: vmware虚拟机linux 2016-09-05 08:03 315人阅读 评
扩容原因 现阶段,虚拟机的标配都是1G内存和20G硬盘,大部分时候是够用的,但是也会出现虚拟机里面东西放多了硬盘不够用的情况,这种情况下,除了清理垃圾,另外就只能给虚拟机扩容了.因为window扩容相 ...
- VMware Esxi5.5中嵌套虚拟机的网络设置方法
环境: Esxi5.5服务器->虚拟机(WinServer2008R2)->VMware WorkStation(Win7虚拟机) 网络问题: VMware WorkStation中的虚拟 ...
- VMware中Linux虚拟机与Windows主机共享文件夹
VMware下Linux虚拟机与Windows主机共享文件夹 1. 安装vm-tool 2. 开启共享文件夹 虚拟机->设置->选项->共享文件夹"右边选择"总是 ...
- vmware中linux虚拟机使用NAT模式不能连接外网解决
linux虚拟机一直配置的桥接模式,今天改成NAT模式发现不能上外网 环境:VMware12,CentOS 6.8,NAT模式 ①电脑实际ip:192.168.1.100 ②NAT使用虚拟网卡网关: ...
- Vbox中Linux虚拟机网络配置(比较实用)
好久没写过东西了,主要大部分都是来自对生活的感悟,很少有实实在在的关于学得有成就感的技术可以“炫耀”,所以也就懒得在这个上面登了. 实验室很早就有位师兄曾在吃饭的路上问过我们这群小弟,你们知道Vbox ...
- xenserver中linux虚拟机修改启动顺序
xenserver是思杰的一款类似于vmware ESXI的虚拟化平台,或者说虚拟化操作系统,上面可以安装许多虚拟机,但是当你装完linux虚拟机,你会发现一个问题,不能像windows vm那样直接 ...
随机推荐
- ExtJS入门教程05,grid的异步加载数据
上一篇演示了extjs grid的基本用法,并加载了本地数据.今天我们将演示如何加载异步数据. 所谓异步,就是通过ajax的方式将服务器端的数据加载到我们的grid中.为了提供数据,我们先定义一个数据 ...
- Spring学习7-Spring整合Hibernate
一.Springl为什么要整合Hibernate 二者的整合主要是把hibernate中核心的一些类型交给spring管理,这些类型主要包括sessionFactory. transactionM ...
- JavaScript模块化学习基础
http://www.ruanyifeng.com/blog/2012/10/javascript_module.html 一.原始写法 模块就是实现特定功能的一组方法. 不同函数简单放在一起就算一个 ...
- nuget pack
nuget spec nuget setApiKey yourkeynuget pack PluginMvc.Framework.csproj -Prop Configuration=Releasen ...
- WCF 客户端解决大数据量传输配置
1. 服务端返回数据给客户端报错 在客户端配置文件中,主要是配置maxReceivedMessageSize <system.serviceModel> <bindings> ...
- 数据库的设计(E-R图,数据库模型图,三大范式)
一.数据库设计的概念 数据库设计是将数据库中的数据实体及这些数据实体之间的关系,进行规划和结构化的过程. 二.数据库设计的重要性 如果一个数据库没有进行一个良好的设计,那么这个数据库完成之后他的缺点是 ...
- HDU 4925 Apple Tree(模拟题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4925 解题报告:给你n*m的土地,现在对每一块土地有两种操作,最多只能在每块土地上进行两种操作,第一种 ...
- Bridge 使用
- git参考资料
个人博客 http://www.iwangzheng.com/ $git log --graph $git reset --hard 67889898... $ssh-add $git pull -- ...
- 暑假热身 B. 下载测速
最近,nono终于结束了每年一次的为期12个月的冬眠,醒来的第一件事就是——看电影!!nono发现最近一年出现了各种很好很强大的电影,例如这个.这个.还有这个. 于是nono直接把这些电影全部扔进了下 ...