问题: zabbix_appliance直接加载虚拟机来部署zabbix是很方便的办法, 下载配置好后, 监控一段时间会提示mysql存储空间不足, 进去系统df一看才4G多, 只好自已手动扩容.

思路:虚拟机上直接扩容磁盘,恢复正常运行。
原zabbix数据库(容量:4G):             /var/lib/mysql/zabbix  (/dev/sda5 <--  /var/lib/mysql)
扩容后zabbix数据库(容量:491G): /var/lib/mysql/zabbix  (/dev/sda5 <--  /var/lib/mysql)

1、vmware扩容

vmware编辑虚拟机设置——硬盘——扩展——500G——扩展

重新开机

2、 对硬盘调整分区容量,重启

[root@appliance ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        1.9G     0  1.9G   0% /dev
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           2.0G   17M  1.9G   1% /run
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda2       4.0G  993M  3.1G  25% /
/dev/sda3      1014M   40M  975M   4% /tmp
/dev/sda5       4.5G  913M  3.6G  20% /var/lib/mysql
/dev/sda1       488M   50M  402M  11% /boot
tmpfs           393M     0  393M   0% /run/user/0


[root@appliance ~]# fdisk /dev/sda

Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): d
Partition number (1-5, default 5):

Partition 5 has been deleted.

Command (m for help): d
Partition number (1-4, default 4):

Partition 4 has been deleted.


Command (m for help): n
Partition type
   p   primary (3 primary, 0 extended, 1 free)
   e   extended (container for logical partitions)
Select (default e): e

Selected partition 4
First sector (11536384-1048575999, default 11536384):
Last sector, +sectors or +size{K,M,G,T,P} (11536384-1048575999, default 1048575999):

Created a new partition 4 of type 'Extended' and of size 494.5 GiB.

Command (m for help): n
All primary partitions are in use.
Adding logical partition 5
First sector (11538432-1048575999, default 11538432):
Last sector, +sectors or +size{K,M,G,T,P} (11538432-1048575999, default 1048575999):

Created a new partition 5 of type 'Linux' and of size 494.5 GiB.
Partition #5 contains a xfs signature.

Do you want to remove the signature? [Y]es/[N]o: y

The signature will be removed by a write command.

Command (m for help): w
The partition table has been altered.
Failed to update system information about partition 4: Device or resource busy

The kernel still uses the old partitions. The new table will be used at the next reboot.
Syncing disks.

3、扩展mysql文件使用全盘、检查,扩容完成

[root@appliance ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        1.9G     0  1.9G   0% /dev
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           2.0G   17M  1.9G   1% /run
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda2       4.0G  993M  3.1G  25% /
/dev/sda5       4.5G  914M  3.6G  20% /var/lib/mysql
/dev/sda3      1014M   40M  975M   4% /tmp
/dev/sda1       488M   50M  402M  11% /boot
tmpfs           393M     0  393M   0% /run/user/0
[root@appliance ~]# xfs_growfs /var/lib/mysql
meta-data=/dev/sda5              isize=512    agcount=4, agsize=294784 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1    bigtime=0 inobtcount=0
data     =                       bsize=4096   blocks=1179136, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 1179136 to 129629696
[root@appliance ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        1.9G     0  1.9G   0% /dev
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           2.0G   17M  1.9G   1% /run
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda2       4.0G  993M  3.1G  25% /
/dev/sda5       495G  4.4G  491G   1% /var/lib/mysql
/dev/sda3      1014M   40M  975M   4% /tmp
/dev/sda1       488M   50M  402M  11% /boot
tmpfs           393M     0  393M   0% /run/user/0
[root@appliance ~]#

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐