计划使用zabbix监控管理全单位的PC的基本硬件信息,由于开始的规划的硬盘比较小,担心监控时磁盘不够。
在些先考虑能过LVM增容zabbix的数据库存储空间。
System Center 2012–VMM(virtral machine manager)-简称为:VMM
1.打开VMM管理台,找到增容的设备-右键属性-硬件配置-磁盘(增加)自定义需要增加的容量后,点击:确认
2.SSH连接Centos虚拟机器,查看新增硬盘设备
[[email protected] ~]# dmesg | grep “sd 1”
sd 1:0:0:0: Attached scsi generic sg1 type 0
sd 1:0:0:0: [sdb] 167772160 512-byte logical blocks: (85.8 GB/80.0 GiB)
sd 1:0:0:0: [sdb] Write Protect is off
sd 1:0:0:0: [sdb] Mode Sense: 0f 00 10 00
sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, supports DPO and FUA
sdb: unknown partition table
sd 1:0:0:0: [sdb] Attached SCSI disk
已经在线增加硬盘完成。那么下面开始扩容LVM
3.开始创建分区
[[email protected] ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x5ebe1b5d.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won‘t be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
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): n #创建分区
Command action
e extended
p primary partition (1-4)
p #主分区
Partition number (1-4): 1 #主分区为第一主分区
First cylinder (1-10443, default 1): 1 #磁盘的起始位置
Last cylinder, +cylinders or +size{K,M,G} (1-10443, default 10443): #默认全部都
Using default value 10443
Command (m for help): p #查看创建的分区
Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 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: 0x5ebe1b5d
Device Boot Start End Blocks Id System
/dev/sdb1 1 10443 83882373+ 83 Linux #需要修改分区类型到LVM
修改分区类型:使用t 选项
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
查看一下分区类型并保存退出。
Command (m for help): p
Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 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: 0x0d3c2108
Device Boot Start End Blocks Id System
/dev/sdb1 1 10443 83883366 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
创建PV并查看PV,使用命令:pvcreate 与 pvdisplay
[[email protected] ~]# pvcreate /dev/sdb1
dev_is_mpath: failed to get device for 8:17
Physical volume "/dev/sdb1" successfully created
[[email protected] ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup
PV Size 19.51 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 4994
Free PE 0
Allocated PE 4994
PV UUID qOY1yW-Ynm7-2d1g-2nMH-G6nN-evtl-Cjp02F
"/dev/sdb1" is a new physical volume of "80.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb1
VG Name
PV Size 80.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID Um4a9O-gFHb-Gg70-2gxB-v50x-mmuZ-XyYymh
扩展新硬盘到VG组中
[[email protected] ~]# vgextend VolGroup /dev/sdb1
Volume group "VolGroup" successfully extended
[[email protected] ~]# vgdisplay
--- Volume group ---
VG Name VolGroup
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 99.50 GiB
PE Size 4.00 MiB
Total PE 25473
Alloc PE / Size 4994 / 19.51 GiB
Free PE / Size 20479 / 80.00 GiB
VG UUID iprcvl-yS2E-Z9t0-diqk-LaNC-rXqX-1Rd9VI
增容到LV中
[[email protected] ~]# lvextend -L +80G /dev/VolGroup/lv_root
Extending logical volume lv_root to 97.57 GiB
Insufficient free space: 20480 extents needed, but only 20479 available #报错 告诉我可用的容量为20479
[[email protected] ~]# lvextend -L +79G /dev/VolGroup/lv_root
Extending logical volume lv_root to 96.57 GiB
Logical volume lv_root successfully resized
查看了一下LV容量
[ro[email protected] ~]# lvdisplay
--- Logical volume ---
LV Path /dev/VolGroup/lv_root
LV Name lv_root
VG Name VolGroup
LV UUID BJWEPf-lBb5-2hqB-om6A-UP31-mPI0-qPRxWZ
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2015-05-29 23:23:23 +0800
LV Status available
# open 1
LV Size 96.57 GiB #成功增容
Current LE 24722
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
更新文件系统
resize2fs -f /dev/VolGroup/lv_root
-f 强制
[[email protected] ~]# resize2fs -f /dev/VolGroup/lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/VolGroup/lv_root is mounted on /; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 7
Performing an on-line resize of /dev/VolGroup/lv_root to 25315328 (4k) blocks.
The filesystem on /dev/VolGroup/lv_root is now 25315328 blocks long.
df 查看一下增容的文件系统
[[email protected] ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 96G 8.8G 82G 10% /
[[email protected] ~]#