[root@localhost ~]# virsh list
Id Name State
----------------------------------------------------
1 study01 running
You have new mail in /var/spool/mail/root
[root@localhost ~]# virsh shutdown study01
Domain study01 is being shutdown
[root@localhost ~]# virsh list --all
Id Name State
----------------------------------------------------
- study01 shut off
[root@localhost ~]#
然后执行以下命令进行克隆:
[root@localhost ~]# virt-clone --original study01 --name study02 --file /kvm_data/study02.img
Allocating 'study02.img' | 10 GB 00:00:42
Clone 'study02' created successfully. # 克隆成功
[root@localhost ~]# ls /kvm_data/
lost+found study01.img study02.img
[root@localhost ~]# ls /etc/libvirt/qemu/
networks study01.xml study02.xml
[root@localhost ~]# virsh list --all
Id Name State
----------------------------------------------------
- study01 shut off
- study02 shut off
[root@localhost ~]# virsh start study02
Domain study02 started
[root@localhost ~]#
[root@localhost ~]# qemu-img info /kvm_data/study01.img
image: /kvm_data/study01.img
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 1.1G
cluster_size: 65536
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
2 1520520513 0 2018-03-08 22:48:33 00:00:00.000
Format specific information:
compat: 1.1
lazy refcounts: true
[root@localhost ~]#
创建一个2G大小的raw格式的虚拟磁盘,-f选项用于指定虚拟磁盘的格式:
[root@localhost ~]# qemu-img create -f raw /kvm_data/study01_2.img 2G
Formatting '/kvm_data/study01_2.img', fmt=raw size=2147483648
[root@localhost ~]# qemu-img info /kvm_data/study01_2.img
image: /kvm_data/study01_2.img
file format: raw
virtual size: 2.0G (2147483648 bytes)
disk size: 0
[root@localhost ~]#
我们可以把raw格式的磁盘转换为qcow2格式,-O选项指定转换的目标格式:
[root@localhost ~]# qemu-img convert -O qcow2 /kvm_data/study01_2.img /kvm_data/study01_2.qcow2
[root@localhost ~]# ls /kvm_data/study01_2*
/kvm_data/study01_2.img /kvm_data/study01_2.qcow2
[root@localhost ~]# qemu-img info /kvm_data/study01_2.qcow2
image: /kvm_data/study01_2.qcow2
file format: qcow2
virtual size: 2.0G (2147483648 bytes)
disk size: 196K
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
[root@localhost ~]#
[root@localhost /kvm_data]# virsh list
Id Name State
----------------------------------------------------
2 study02 running
[root@localhost /kvm_data]# virsh shutdown study02
Domain study02 is being shutdown
[root@localhost /kvm_data]# qemu-img convert -O raw /kvm_data/study02.img /kvm_data/study02_3.raw
[root@localhost /kvm_data]# ls -l
total 3531020
drwx------ 2 root root 16384 Mar 7 20:56 lost+found
-rw-r--r-- 1 root root 2147483648 Mar 8 23:02 study01_2.img
-rw-r--r-- 1 root root 197120 Mar 8 23:05 study01_2.qcow2
-rw------- 1 root root 10739515904 Mar 8 22:51 study01.img
-rw-r--r-- 1 root root 10737418240 Mar 8 23:45 study02_3.raw # 此时的属组属主为root
-rw------- 1 root root 1209008128 Mar 8 23:38 study02.img
[root@localhost /kvm_data]# virsh edit study02 # 更改格式和文件路径,修改如下内容即可
[root@localhost /kvm_data]# virsh start study02
Domain study02 started
[root@localhost /kvm_data]# ls -l # 可以发现启动状态的虚拟机的磁盘文件的属组属主会发生改变
total 3531020
drwx------ 2 root root 16384 Mar 7 20:56 lost+found
-rw-r--r-- 1 root root 2147483648 Mar 8 23:02 study01_2.img
-rw-r--r-- 1 root root 197120 Mar 8 23:05 study01_2.qcow2
-rw------- 1 root root 10739515904 Mar 8 22:51 study01.img
-rw-r--r-- 1 qemu qemu 10737418240 Mar 8 23:45 study02_3.raw # 此时的属组属主为qemu
-rw------- 1 root root 1209008128 Mar 8 23:38 study02.img
[root@localhost /kvm_data]#
此时如果要给study02制作快照就会报如下错误:
[root@localhost /kvm_data]# virsh snapshot-create study02
error: unsupported configuration: internal snapshot for disk vda unsupported for storage type raw
[root@localhost /kvm_data]#
磁盘扩容(raw)
以上介绍了虚拟磁盘格式的,以及如何转换虚拟磁盘格式,下面我们来看看如何进行磁盘扩容:
[root@localhost ~]# ls -lh /kvm_data/study02_3.raw
-rw-r--r-- 1 qemu qemu 10G Mar 9 01:00 /kvm_data/study02_3.raw
[root@localhost ~]# qemu-img resize /kvm_data/study02_3.raw +2G
Image resized.
[root@localhost ~]# ls -lh /kvm_data/study02_3.raw
-rw-r--r-- 1 qemu qemu 12G Mar 9 01:00 /kvm_data/study02_3.raw
[root@localhost ~]#
如上可以看到,原本的10G变成12G了,但是此时进入虚拟机中会发现磁盘依旧是10G:
[root@localhost ~]# virsh console study02
[root@localhost ~]# fdisk -l
磁盘 /dev/vda:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x00003436
设备 Boot Start End Blocks Id System
/dev/vda1 * 2048 1026047 512000 83 Linux
/dev/vda2 1026048 3123199 1048576 82 Linux swap / Solaris
/dev/vda3 3123200 20971519 8924160 83 Linux
[root@localhost ~]#
[root@localhost ~]# qemu-img info /kvm_data/study01.img
image: /kvm_data/study01.img
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 1.1G
cluster_size: 65536
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
2 1520520513 0 2018-03-08 22:48:33 00:00:00.000
Format specific information:
compat: 1.1
lazy refcounts: true
[root@localhost ~]# qemu-img resize /kvm_data/study01.img +2G # 会报如下错误
qemu-img: Can't resize an image which has snapshots
qemu-img: This image does not support resize
[root@localhost ~]#
[root@localhost ~]# virsh list --all
Id Name State
----------------------------------------------------
5 study02 running
- study01 shut off
[root@localhost ~]# virsh start study01
Domain study01 started
[root@localhost ~]#
[root@localhost ~]# virsh list
Id Name State
----------------------------------------------------
5 study02 running
6 study01 running
[root@localhost ~]# virsh shutdown study01
Domain study01 is being shutdown
[root@localhost ~]#
冒泡排序
public static void sort(Integer[] param) {
for (int i = param.length - 1; i > 0; i--) {
for (int j = 0; j < i; j++) {
int current = param[j];
int next = param[j + 1];
方法一:
public class Zhidao {
public static void main(String args[]) {
String s = "sdf灭礌 kjl d{';\fdsjlk是";
int n=0;
for(int i=0; i<s.length(); i++) {
n = (int)s.charAt(i);
if((
IF OBJECT_ID('tempdb..#ABC') is not null
drop table tempdb..#ABC
create table #ABC
(
PATHNAME NVARCHAR(50)
)
insert into #ABC
SELECT N'/ABCDEFGHI'
UNION ALL SELECT N'/ABCDGAFGASASSDFA'
UNION ALL
http://www.sdn.sap.com/irj/boc/business-objects-for-sap-faq
Besides, I care that how to integrate tightly.
By the way, for BW consultants, please just focus on Query Designer which i
结构
继承关系
public static final class Manifest.permission_group extends Object
java.lang.Object
android. Manifest.permission_group 常量
ACCOUNTS 直接通过统计管理器访问管理的统计
COST_MONEY可以用来让用户花钱但不需要通过与他们直接牵涉的权限
D