Ampliar disco de ROOT Zabbix Appliance

From Zabbix-ES
Jump to navigation Jump to search
# apt-get install scsitools
# apt-get install gdisk
# cat /proc/partitions
# rescan-scsi-bus 
# cat /proc/partitions
# fdisk /dev/sdb w
# fdisk /dev/sdb m, n, p, <ENTER>, <ENTER>, 8E00, w, y
# df -hT
# lsblk
# pvcreate /dev/sdb1
# vgextend zabbix-vg /dev/sdb1
# lvextend -l +100%FREE /dev/mapper/zabbix--vg-root
# resize2fs /dev/mapper/zabbix--vg-root
# df -h

Ampliacion FS de ROOT ZABBIX procedimiento DETALLADO

Nota: Ampliamos el disco desde el VMWARE de 10GB a 60GB

Reescaneamos los discos para que el SO lo vea

  root@zabbix:~# egrep scsi_device /var/log/*
  root@zabbix:~# echo 1 >/sys/class/scsi_device/1\:0\:0\:0/device/rescan 
  root@zabbix:~# echo 1 >/sys/class/scsi_device/2\:0\:0\:0/device/rescan 
  root@zabbix:~# partprobe
  root@zabbix:~# fdisk -l
  root@zabbix:~# lsblk
  NAME                         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
  sda                            8:0    0    60G  0 disk 
  ├─sda1                         8:1    0   243M  0 part /boot
  ├─sda2                         8:2    0     1K  0 part 
  └─sda5                         8:5    0   9.5G  0 part 
    ├─zabbix--vg-root (dm-0)   252:0    0   7.5G  0 lvm  /
    └─zabbix--vg-swap_1 (dm-1) 252:1    0     2G  0 lvm  [SWAP]
  sr0                           11:0    1  1024M  0 rom     

Ampliamos la particion con PARTED (Version de linea de comando del GPARTD)

  root@zabbix:~# parted /dev/sda
  GNU Parted 2.3
  Using /dev/sda
  Welcome to GNU Parted! Type 'help' to view a list of commands.
  
  (parted) p
  Model: VMware Virtual disk (scsi)
  Disk /dev/sda: 64.4GB
  Sector size (logical/physical): 512B/512B
  Partition Table: msdos
  
  Number  Start   End     Size    Type      File system  Flags
   1      1049kB  256MB   255MB   primary   ext2         boot
   2      257MB   10.5GB  10.2GB  extended
   5      257MB   10.5GB  10.2GB  logical                lvm
  
  (parted) resize 2
  WARNING: you are attempting to use parted to operate on (resize) a file system.
  parted's file system manipulation code is not as robust as what you'll find in
  dedicated, file-system-specific packages like e2fsprogs.  We recommend
  you use parted only to manipulate partition tables, whenever possible.
  Support for performing most operations on most types of file systems
  will be removed in an upcoming release.
  Start?  [257MB]? <ENTER>
  End?  [10.5GB]? 64.4GB
  (parted) p
  Model: VMware Virtual disk (scsi)
  Disk /dev/sda: 64.4GB
  Sector size (logical/physical): 512B/512B
  Partition Table: msdos
  
  Number  Start   End     Size    Type      File system  Flags
   1      1049kB  256MB   255MB   primary   ext2         boot
   2      257MB   64.4GB  64.2GB  extended                     <--- Ya vemos el espacio nuevo en la particion extendida
   5      257MB   10.5GB  10.2GB  logical                lvm
  
  (parted) resize 5
  End?  [10.5GB]? 64.4GB
  (parted) p
  Model: VMware Virtual disk (scsi)
  Disk /dev/sda: 64.4GB
  Sector size (logical/physical): 512B/512B
  Partition Table: msdos
  
  Number  Start   End     Size    Type      File system  Flags
   1      1049kB  256MB   255MB   primary   ext2         boot
   2      257MB   64.4GB  64.2GB  extended
   5      257MB   64.4GB  64.1GB  logical                lvm  <--- Ya vemos el espacio nuevo en la partición logica
  (parted) w
  root@zabbix:~# fdisk -l
  
  Disk /dev/sda: 64.4 GB, 64424509440 bytes
  255 heads, 63 sectors/track, 7832 cylinders, total 125829120 sectors
  Units = sectors of 1 * 512 = 512 bytes
  Sector size (logical/physical): 512 bytes / 512 bytes
  I/O size (minimum/optimal): 512 bytes / 512 bytes
  Disk identifier: 0x0006dab1
  
     Device Boot      Start         End      Blocks   Id  System
  /dev/sda1   *        2048      499711      248832   83  Linux
  /dev/sda2          501758   125829119    62663681    5  Extended
  /dev/sda5          501760   125781250    62639745+  8e  Linux LVM
  root@zabbix:~# pvs
    PV         VG        Fmt  Attr PSize PFree
    /dev/sda5  zabbix-vg lvm2 a--  9.52g    0 
  root@zabbix:~# lsblk
  NAME                         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
  sda                            8:0    0    60G  0 disk 
  ├─sda1                         8:1    0   243M  0 part /boot
  ├─sda2                         8:2    0     1K  0 part 
  └─sda5                         8:5    0  59.8G  0 part             <--- Vemos que el espacio se ve a nivel de particion logica
    ├─zabbix--vg-root (dm-0)   252:0    0   7.5G  0 lvm  /
    └─zabbix--vg-swap_1 (dm-1) 252:1    0     2G  0 lvm  [SWAP]
  sr0                           11:0    1  1024M  0 rom  
  root@zabbix:~# lvextend -l +100%FREE /dev/zabbix-vg/root 
    Extending logical volume root to 57.73 GiB
    Logical volume root successfully resized
  root@zabbix:~# df -hT
  Filesystem     Type      Size  Used Avail Use% Mounted on
  udev           devtmpfs  2.0G  8.0K  2.0G   1% /dev
  tmpfs          tmpfs     396M  676K  395M   1% /run
  /dev/dm-0      ext4      7.3G  7.0G     0 100% /
  none           tmpfs     4.0K     0  4.0K   0% /sys/fs/cgroup
  none           tmpfs     5.0M     0  5.0M   0% /run/lock
  none           tmpfs     2.0G     0  2.0G   0% /run/shm
  none           tmpfs     100M     0  100M   0% /run/user
  /dev/sda1      ext2      236M  124M  101M  56% /boot
  root@zabbix:~# resize2fs /dev/dm-0
  resize2fs 1.42.9 (4-Feb-2014)
  Filesystem at /dev/dm-0 is mounted on /; on-line resizing required
  old_desc_blocks = 1, new_desc_blocks = 4
  The filesystem on /dev/dm-0 is now 15134720 blocks long.
  root@zabbix:~# df -h
  Filesystem      Size  Used Avail Use% Mounted on
  udev            2.0G  8.0K  2.0G   1% /dev
  tmpfs           396M  676K  395M   1% /run
  /dev/dm-0        57G  7.0G   48G  13% /                  <--- El espacio ya se ve a nivel de FS
  none            4.0K     0  4.0K   0% /sys/fs/cgroup
  none            5.0M     0  5.0M   0% /run/lock
  none            2.0G     0  2.0G   0% /run/shm
  none            100M     0  100M   0% /run/user
  /dev/sda1       236M  124M  101M  56% /boot