#检查raw格式磁盘
[root@node71 vm]# qemu-img info ./oel3/oel3_raw.img
image: ./oel3/oel3_raw.img
file format: raw
virtual size: 20G (21474836480 bytes)
disk size: 20G
[root@node71 vm]# virsh list
Id 名称 状态
----------------------------------------------------
14 oel3 running
#采用dd命令扩展镜像
[root@node71 vm]# dd if=/dev/zero bs=1024M count=5 >> ./oel3/oel3_raw.img
记录了5+0 的读入
记录了5+0 的写出
5368709120字节(5.4 GB)已复制,11.2163 秒,479 MB/秒
[root@node71 vm]# qemu-img info ./oel3/oel3_raw.img
image: ./oel3/oel3_raw.img
file format: raw
virtual size: 25G (26843545600 bytes)
disk size: 28G
[root@node71 vm]# virsh console oel3
连接到域 oel3
换码符为 ^]
Oracle Linux Server release 6.6
Kernel 3.8.13-44.1.1.el6uek.x86_64 on an x86_64
localhost.localdomain login: root
Password:
Last login: Wed Oct 12 04:00:22 on tty1
[root@localhost ~]# fdisk -l /dev/vda
#这里是看不到扩容后的磁盘
Disk /dev/vda: 21.5 GB, 21474836480 bytes
16 heads, 63 sectors/track, 41610 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: 0x00031a78
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 41611 20458496 8e Linux LVM
Partition 2 does not end on cylinder boundary.
[root@localhost ~]#
#重启一下vm
[root@node71 ~]# virsh list
Id 名称 状态
----------------------------------------------------
15 oel3 running
[root@node71 ~]# virsh console oel3
连接到域 oel3
换码符为 ^]
Oracle Linux Server release 6.6
Kernel 3.8.13-44.1.1.el6uek.x86_64 on an x86_64
localhost.localdomain login: root
Password:
Last login: Thu Oct 13 23:15:49 on ttyS0
[root@localhost ~]# fdisk -l /dev/vda
Disk /dev/vda: 26.8 GB, 26843545600 bytes
16 heads, 63 sectors/track, 52012 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: 0x00031a78
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 41611 20458496 8e Linux LVM
Partition 2 does not end on cylinder boundary.
#上面可以查看到磁盘大小已经发生变化
#接下来是对磁盘分区,接着扩展vg,lv,
#在fdisk可以看到扩展后的容量,但是分区时cylinder对比显示不对,可能需要重启vm试试看
[root@localhost ~]# fdisk /dev/vda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): p
Disk /dev/vda: 26.8 GB, 26843545600 bytes
16 heads, 63 sectors/track, 52012 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: 0x00031a78
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 41611 20458496 8e Linux LVM
Partition 2 does not end on cylinder boundary.
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (1-52012, default 1): 41612
Last cylinder, +cylinders or +size{K,M,G} (41612-52012, default 52012):
Using default value 52012
Command (m for help): p
Disk /dev/vda: 26.8 GB, 26843545600 bytes
16 heads, 63 sectors/track, 52012 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: 0x00031a78
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 41611 20458496 8e Linux LVM
Partition 2 does not end on cylinder boundary.
/dev/vda3 41612 52012 5242104 83 Linux
Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 8e
Changed system type of partition 3 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/vda: 26.8 GB, 26843545600 bytes
16 heads, 63 sectors/track, 52012 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: 0x00031a78
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 41611 20458496 8e Linux LVM
Partition 2 does not end on cylinder boundary.
/dev/vda3 41612 52012 5242104 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@localhost ~]# partx -a /dev/vda
BLKPG: Device or resource busy
error adding partition 1
BLKPG: Device or resource busy
error adding partition 2
[root@localhost ~]# partx -a /dev/vda
BLKPG: Device or resource busy
error adding partition 1
BLKPG: Device or resource busy
error adding partition 2
BLKPG: Device or resource busy
error adding partition 3
[root@localhost ~]# fdisk -l | grep /dev/vd[a-z]
Disk /dev/vda: 26.8 GB, 26843545600 bytes
/dev/vda1 * 3 1018 512000 83 Linux
/dev/vda2 1018 41611 20458496 8e Linux LVM
/dev/vda3 41612 52012 5242104 8e Linux LVM
[root@localhost ~]#
#接着pv,vg,lv......
3、直接扩展qcow2格式的磁盘
#qcow2格式磁盘采用qemu-img方式扩展
[root@node71 ~]# virsh domblklist oel1
目标 源
------------------------------------------------
vda /home/data/vm/oel1/oel1_qcow2.img
[root@node71 ~]# qemu-img info /home/data/vm/oel1/oel1_qcow2.img
image: /home/data/vm/oel1/oel1_qcow2.img
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 2.4G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
[root@node71 ~]# virsh start oel1
域 oel1 已开始
#vm在开机情况下扩展磁盘,增加2G
[root@node71 ~]# qemu-img resize /home/data/vm/oel1/oel1_qcow2.img +2G
Image resized.
[root@node71 ~]# qemu-img info /home/data/vm/oel1/oel1_qcow2.img
image: /home/data/vm/oel1/oel1_qcow2.img
file format: qcow2
virtual size: 22G (23622320128 bytes)
disk size: 2.4G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
[root@node71 ~]# virsh console oel1
连接到域 oel1
换码符为 ^]
Oracle Linux Server release 6.6
Kernel 3.8.13-44.1.1.el6uek.x86_64 on an x86_64
localhost.localdomain login: root
Password:
Last login: Thu Oct 13 22:14:45 on ttyS0
#console连接到vm,查看不到磁盘增加,应该是可以支持在线扩展磁盘容量
[root@localhost ~]# fdisk -l /dev/vda
Disk /dev/vda: 21.5 GB, 21474836480 bytes
16 heads, 63 sectors/track, 41610 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: 0x00031a78
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 41611 20458496 8e Linux LVM
Partition 2 does not end on cylinder boundary.
[root@localhost ~]#
#尝试重启vm,在virsh下,如果是在vm系统下,reboot,貌似没有用,
[root@node71 ~]# virsh shutdown oel1
域 oel1 被关闭
[root@node71 ~]# virsh list --all
Id 名称 状态
----------------------------------------------------
- oel1 关闭
- oel2 关闭
- oel3 关闭
- oel4 关闭
- win7 关闭
[root@node71 ~]# virsh start oel1
域 oel1 已开始
[root@node71 ~]# virsh console oel1
连接到域 oel1
换码符为 ^]
mount: mount point /proc/bus/usb does not exist
Welcome to Oracle Linux Server
Starting udev: [ OK ]
Setting hostname localhost.localdomain: [ OK ]
Setting up Logical Volume Management: 2 logical volume(s) in volume group "VolGroup" now active
[ OK ]
Checking filesystems
Checking all file systems.
[/sbin/fsck.ext4 (1) -- /] fsck.ext4 -a /dev/mapper/VolGroup-lv_root
/dev/mapper/VolGroup-lv_root: clean, 22727/1215840 files, 504495/4859904 blocks
[/sbin/fsck.ext4 (1) -- /boot] fsck.ext4 -a /dev/vda1
/dev/vda1: clean, 44/128016 files, 81219/512000 blocks
[ OK ]
Remounting root filesystem in read-write mode: [ OK ]
Mounting local filesystems: [ OK ]
Enabling /etc/fstab swaps: [ OK ]
Entering non-interactive startup
Starting monitoring for VG VolGroup: 2 logical volume(s) in volume group "VolGroup" monitored
[ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0:
Determining IP information for eth0... done.
[ OK ]
Starting auditd: [ OK ]
Starting system logger: [ OK ]
Starting kdump:[FAILED]
Mounting filesystems: [ OK ]
Starting acpi daemon: [ OK ]
Retrigger failed udev events[ OK ]
Starting sshd: [ OK ]
Starting postfix: [ OK ]
Starting crond: [ OK ]
Oracle Linux Server release 6.6
Kernel 3.8.13-44.1.1.el6uek.x86_64 on an x86_64
localhost.localdomain login: root
Password:
Last login: Fri Oct 14 04:29:09 on ttyS0
[root@localhost ~]#
[root@localhost ~]# fdisk -l /dev/vda
#查看到磁盘容量已经扩大
Disk /dev/vda: 25.8 GB, 25769803776 bytes
16 heads, 63 sectors/track, 49932 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: 0x00031a78
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 41611 20458496 8e Linux LVM
Partition 2 does not end on cylinder boundary.
#对磁盘进行分区
[root@localhost ~]# fdisk /dev/vda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): p
Disk /dev/vda: 25.8 GB, 25769803776 bytes
16 heads, 63 sectors/track, 49932 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: 0x00031a78
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 41611 20458496 8e Linux LVM
Partition 2 does not end on cylinder boundary.
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (1-49932, default 1): 41612
Last cylinder, +cylinders or +size{K,M,G} (41612-49932, default 49932):
Using default value 49932
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@localhost ~]# partx -a /dev/vda
BLKPG: Device or resource busy
error adding partition 1
BLKPG: Device or resource busy
error adding partition 2
[root@localhost ~]# partx -a /dev/vda
BLKPG: Device or resource busy
error adding partition 1
BLKPG: Device or resource busy
error adding partition 2
BLKPG: Device or resource busy
error adding partition 3
[root@localhost ~]# fdisk -l /dev/vd[a-z]
Disk /dev/vda: 25.8 GB, 25769803776 bytes
16 heads, 63 sectors/track, 49932 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: 0x00031a78
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 41611 20458496 8e Linux LVM
Partition 2 does not end on cylinder boundary.
/dev/vda3 41612 49932 4193784 83 Linux
[root@localhost ~]#
#已经分区完
4、通过新增加一块磁盘对vm进行扩容
#增加一块磁盘,然后在编辑vm的xml配置文件添加磁盘
[root@node71 ~]# qemu-img create -f qcow2 /home/data/vm/oel1/oel1_qcow2_1.img 5G
Formatting '/home/data/vm/oel1/oel1_qcow2_1.img', fmt=qcow2 size=5368709120 encryption=off cluster_size=65536 lazy_refcounts=off
[root@node71 ~]# virsh edit oel1
编辑了域 oel1 XML 配置。
#需要重新像kvm注册vm的配置信息
[root@node71 ~]# virsh define /etc/libvirt/qemu/oel1.xml
定义域 oel1(从 /etc/libvirt/qemu/oel1.xml)
#启动虚拟机检查
[root@node71 ~]# virsh start oel1
域 oel1 已开始
[root@node71 ~]# virsh console oel1
连接到域 oel1
换码符为 ^]
Oracle Linux Server release 6.6
Kernel 3.8.13-44.1.1.el6uek.x86_64 on an x86_64
localhost.localdomain login: root
Password:
Last login: Fri Oct 14 04:31:00 on ttyS0
[root@localhost ~]# fdisk -l /dev/vd[a-b]
Disk /dev/vda: 25.8 GB, 25769803776 bytes
16 heads, 63 sectors/track, 49932 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: 0x00031a78
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 41611 20458496 8e Linux LVM
Partition 2 does not end on cylinder boundary.
/dev/vda3 41612 49932 4193784 83 Linux
Disk /dev/vdb: 5368 MB, 5368709120 bytes
16 heads, 63 sectors/track, 10402 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
[root@localhost ~]#
#以上可以看到新添加的磁盘已经被vm识别到,可以进行pv,vg,lv扩展
在客户端访问subversion版本库时出现这个错误:
svnserve.conf:12: Option expected
为什么会出现这个错误呢,就是因为subversion读取配置文件svnserve.conf时,无法识别有前置空格的配置文件,如### This file controls the configuration of the svnserve daemon, if you##
什么是Akka
Message-Driven Runtime is the Foundation to Reactive Applications
In Akka, your business logic is driven through message-based communication patterns that are independent of physical locatio
zabbix_api网上比较多的写法是python或curl。上次我用java--http://bossr.iteye.com/blog/2195679,这次用perl。for example: #!/usr/bin/perl
use 5.010 ;
use strict ;
use warnings ;
use JSON :: RPC :: Client ;
use
package com.test;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
public class TestMap {
public static v
MySQL server has gone away 问题解决方法,需要的朋友可以参考下。
应用程序(比如PHP)长时间的执行批量的MYSQL语句。执行一个SQL,但SQL语句过大或者语句中含有BLOB或者longblob字段。比如,图片数据的处理。都容易引起MySQL server has gone away。 今天遇到类似的情景,MySQL只是冷冷的说:MySQL server h
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml&