五郎. 发表于 2019-1-22 08:01:14

CentOS zabbix 3.04 扩容

  查看挂载

  # df -h
  Filesystem                     SizeUsed Avail Use% Mounted on
  /dev/mapper/vg_zabbix-lv_root627G   34G562G   6% /
  tmpfs                        4.9G   76K4.9G   1% /dev/shm
  /dev/sda1                      485M   39M421M   9% /boot
  查看分区

  # 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   IdSystem
  /dev/sda1   *         1          64      512000   83Linux
  Partition 1 does not end on cylinder boundary.
  /dev/sda2            64      5222    41430016   8eLinux LVM
  /dev/sda3            5223       91379   692056102+83Linux
  

  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 命令行给磁盘分区
  # 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   IdSystem
  

  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组
  # 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.
  # 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.
  # df -h
  Filesystem                     SizeUsed Avail Use% Mounted on
  /dev/mapper/vg_zabbix-lv_root627G   34G562G   6% /
  tmpfs                        4.9G   80K4.9G   1% /dev/shm
  /dev/sda1                      485M   39M421M   9% /boot
  # reboot
  




页: [1]
查看完整版本: CentOS zabbix 3.04 扩容