Online expansion of the CentOS hard drive based on system Center 2012–VMM (virtral Machine Manager).

Source: Internet
Author: User
Tags uuid hex code

Plan to use Zabbix monitoring to manage the basic hardware information for a whole unit of PC, because the start of the planned hard drive is relatively small, worrying about insufficient disk when monitoring.

In some of the first consider the ability to over LVM capacity Zabbix database storage space.

System Center 2012–vmm (virtral Machine Manager)-referred to as: VMM

1. Open the VMM Management console and find the device with additional capacity-right-click Properties-Hardware configuration-disk (increase) after customizing the required volume, click: Confirm

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/80/04/ Wkiom1c0rd6gaz4jaacekwg0vau493.png "" 244 "height=" 182 "/>

2.SSH Connect a CentOS virtual machine to see the new hard drive device

[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

The drive has been added online to complete. Then the following starts the expansion of LVM

3. Start creating partitions

[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'll remain in memory only, until the decide to write them.
After that, of course, the previous content won ' t is recoverable.

Warning:invalid flag 0x0000 of partition Table 4 would be a 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, Sectors/track, 10443 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x5ebe1b5d

Device Boot Start End Blocks Id System
/DEV/SDB1 1 10443 83882373+ Linux #需要修改分区类型到LVM
To modify a partition type: Use the t option

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)

Look at the partition type and save the exit.

Command (M for help): P

disk/dev/sdb:85.9 GB, 85899345920 bytes
255 heads, Sectors/track, 10443 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): 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.

Create PV and view PV, using commands: Pvcreate and 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

Extend the new hard drive to the VG group

[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

Add to 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 #报错 tell me the usable capacity is 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
Look at the LV capacity

[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

Update file system

Resize2fs-f/dev/volgroup/lv_root

-F Mandatory
[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 Check the file system for increased capacity

[Email protected] ~]# df-h
Filesystem Size used Avail use% mounted on
/dev/mapper/volgroup-lv_root 96G 8.8G 82G 10%/
[Email protected] ~]#

Online expansion of the CentOS hard drive based on system Center 2012–VMM (virtral Machine Manager).

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.