1. 程式人生 > >CentOS zabbix 3.04 擴容

CentOS zabbix 3.04 擴容

centos zabbix 擴容

查看掛載

[[email protected] ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/vg_zabbix-lv_root 627G 34G 562G 6% /

tmpfs 4.9G 76K 4.9G 1% /dev/shm

/dev/sda1 485M 39M 421M 9% /boot

查看分區

[[email protected] ~]# fdisk -l


Disk /dev/sda: 751.6 GB, 751619276800 bytes

255 heads, 63 sectors/track, 91379 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: 0x000bee4c


Device Boot Start End Blocks Id System

/dev/sda1 * 1 64 512000 83 Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2 64 5222 41430016 8e Linux LVM

/dev/sda3 5223 91379 692056102+ 83 Linux


Disk /dev/mapper/vg_zabbix-lv_root: 683.1 GB, 683134681088 bytes

255 heads, 63 sectors/track, 83053 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/vg_zabbix-lv_swap: 4160 MB, 4160749568 bytes

255 heads, 63 sectors/track, 505 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

執行 fdisk /dev/xvdb ,進入 fdisk 命令行給磁盤分區

[[email protected] ~]# fdisk /dev/sda3

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with disk identifier 0x33e33bd5.

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): p


Disk /dev/sda3: 708.7 GB, 708665448960 bytes

255 heads, 63 sectors/track, 86157 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: 0x33e33bd5


Device Boot Start End Blocks Id System


Command (m for help): n

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-86157, default 1):

Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-86157, default 86157):

Using default value 86157


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): w

The partition table has been altered!


Calling ioctl() to re-read partition table.


WARNING: Re-reading the partition table failed with error 22: Invalid argument.

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.

我們依次輸入以下命令:

p 查看已有分區,由於這個分區是新的,所以為空

n 新建分區:

  p 新建主分區

1 輸入分區號,因為之前沒有分區,所以這是第一個分區,分區號為1

接下來 First cylinder 和 Last cylinder 我們直接點擊回車,默認使用全部空間

t 改變分區類型

8e 改變分區類型為 LVM

w 寫入改變

此時系統將改變分區,然後退出 fdisk 命令行。如果沒有自動退出,輸入 q 退出。

用 mkfs 命令對分區進行格式化

mkfs -t ext4 /dev/sda3

添加 LVM到原來的 LVM組

[[email protected] ~]# lvm

lvm> pvcreate /dev/sda3

Physical volume "/dev/sda3" successfully created

lvm> vgextend vg_zabbix /dev/sda3

Volume group "vg_zabbix" successfully extended

lvm> lvextend -L +600G /dev/mapper/vg_zabbix-lv_root

Extending logical volume lv_root to 36.22 GiB

Logical volume lv_root successfully resized

lvm> quit

Exiting.

[[email protected] ~]# resize2fs /dev/mapper/vg_zabbix-lv_root

resize2fs 1.41.12 (17-May-2010)

Filesystem at /dev/mapper/vg_zabbix-lv_root is mounted on /; on-line resizing required

old desc_blocks = 3, new_desc_blocks = 3

Performing an on-line resize of /dev/mapper/vg_zabbix-lv_root to 9494528 (4k) blocks.

The filesystem on /dev/mapper/vg_zabbix-lv_root is now 9494528 blocks long.

[[email protected] ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/vg_zabbix-lv_root 627G 34G 562G 6% /

tmpfs 4.9G 80K 4.9G 1% /dev/shm

/dev/sda1 485M 39M 421M 9% /boot

[[email protected] ~]# reboot


本文出自 “11261335” 博客,謝絕轉載!

CentOS zabbix 3.04 擴容