Commit ff686f

2025-04-21 16:45:11 Mayekkuzu: Added Extend Partition
monitoring/zabbix.md ..
@@ 90,3 90,105 @@
```
На сервере заббикс добавляем хост по аналогии, но во вкладке Encryption добавляем ключ и ставим галочки как на скриншоте ниже
![](/Self-Hosted/Zabbix/encription-psk-zabbix.jpg)
+ ## Расширение раздела /dev/sda5 с /var/lib/mysql
+
+ Если инсталяция была путем раскатки готового образа с appliance, то рано или поздно можете столкнуться с тем что место на разделе с бд может закончится
+
+ Сначала добавляем +5GB или сколько вам необходимо накинуть
+
+ Сперва стопим службу mysql, далее на примере с пояснениями
+
+ ```bash
+ [root@appliance ~]# fdisk /dev/sda # Запускаем fdisk
+
+ 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): p # Выводим список разделов
+ Disk /dev/sda: 15 GiB, 16106127360 bytes, 31457280 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
+ Disklabel type: dos
+ Disk identifier: 0x0e3fcdb2
+
+ Device Boot Start End Sectors Size Id Type
+ /dev/sda1 * 2048 1050623 1048576 512M 83 Linux
+ /dev/sda2 1050624 9439231 8388608 4G 83 Linux
+ /dev/sda3 9439232 11536383 2097152 1G 83 Linux
+ /dev/sda4 11536384 20971519 9435136 4.5G 5 Extended
+ /dev/sda5 11538432 20971519 9433088 4.5G 83 Linux
+
+ Command (m for help): d # Удаляем раздел
+ Partition number (1-5, default 5): 5 # Пятый который с бд
+
+ Partition 5 has been deleted.
+
+ Command (m for help): d # Удаляем раздел
+ Partition number (1-4, default 4): 4 # Четвертый (он Extended)
+
+ 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): # тыкаем Enter или E
+
+ Using default response e.
+ Selected partition 4
+ First sector (11536384-31457279, default 11536384): 11536384 # Смотрим стартовый сектор в /dev/sda4
+ Last sector, +sectors or +size{K,M,G,T,P} (11536384-31457279, default 31457279): # Тыкаем Enter
+
+ Created a new partition 4 of type 'Extended' and of size 9.5 GiB.
+
+ Command (m for help): n # Создаем новый ЛОГИЧЕСКИЙ раздел
+ All primary partitions are in use.
+ Adding logical partition 5
+ First sector (11538432-31457279, default 11538432): 11538432 # Смотрим стартовый сектор в /dev/sda5
+ Last sector, +sectors or +size{K,M,G,T,P} (11538432-31457279, default 31457279): # Тыкаем Enter
+
+ Created a new partition 5 of type 'Linux' and of size 9.5 GiB.
+ Partition #5 contains a xfs signature.
+
+ Do you want to remove the signature? [Y]es/[N]o: N # Обязательно тыкаем N потому что можем развалить раздел
+
+ 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.
+
+ [root@appliance ~]# reboot
+ ```
+ После рестарта снова подключаемся к машине и расширяем раздел
+
+ ```
+ [root@appliance ~]# sudo 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 2489856
+ ```
+ Проверяем разделы
+ ```
+ [root@appliance ~]# lsblk
+ NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
+ sda 8:0 0 15G 0 disk
+ ├─sda1 8:1 0 512M 0 part /boot
+ ├─sda2 8:2 0 4G 0 part /
+ ├─sda3 8:3 0 1G 0 part /tmp
+ ├─sda4 8:4 0 1K 0 part
+ └─sda5 8:5 0 9.5G 0 part /var/lib/mysql
+ ```
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9