Сначала добавляем необходимый объем в Hyper-V

Далее указываем объем который будет после добавления места на диске

И завершаем добавление.
Не забываем тоже самое проделать на резервной ноде для диска реплики, иначе процесс репликации встанет.
Особенность заключается в том, что операционная система «добавленное» место не сможет использовать самостоятельно, так как оно будет не размечено.
# df -hFilesystem Size Used Avail Use% Mounted on/dev/mapper/centos_ansible-root 28G 11G 17G 40% /devtmpfs 911M 0 911M 0% /devtmpfs 921M 0 921M 0% /dev/shmtmpfs 921M 8.5M 912M 1% /runtmpfs 921M 0 921M 0% /sys/fs/cgroup/dev/sda1 497M 277M 221M 56% /boottmpfs 185M 0 185M 0% /run/user/0
Запускаем утилиту fdisk с ключем -l
# fdisk -lDisk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x000bf751Device Boot Start End Blocks Id System/dev/sda1 * 2048 1026047 512000 83 Linux/dev/sda2 1026048 62914559 30944256 8e Linux LVMDisk /dev/mapper/centos_ansible-swap: 2147 MB, 2147483648 bytes, 4194304 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mapper/centos_ansible-root: 29.5 GB, 29490151424 bytes, 57597952 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes
Создаём на диске новый раздел:
# fdisk /dev/sdaWelcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Command (m for help): n # создать новые разделPartition type:p primary (2 primary, 0 extended, 2 free)e extendedSelect (default p): pPartition number (3,4, default 3): 3 # Следующий номерFirst sector (62914560-125829119, default 62914560): 62914560 # Следующий секторLast sector, +sectors or +size{K,M,G} (62914560-125829119, default 125829119): 125829119 # Последний сектор, оставляем по умолчаниюPartition 3 of type Linux and of size 30 GiB is setCommand (m for help): t # изменим тип ФСPartition number (1-3, default 3): 3Hex code (type L to list all codes): 8e # Соответствует Linux LVMChanged type of partition 'Linux' to 'Linux LVM'Command (m for help): pDisk /dev/sda: 64.4 GB, 64424509440 bytes, 125829120 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x000bf751Device Boot Start End Blocks Id System/dev/sda1 * 2048 1026047 512000 83 Linux/dev/sda2 1026048 62914559 30944256 8e Linux LVM/dev/sda3 62914560 125829119 31457280 8e Linux LVMCommand (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 16: Device or resource busy.The kernel still uses the old table. The new table will be used atthe next reboot or after you run partprobe(8) or kpartx(8)Syncing disks.
После этого необходимо перегрузить машинку — # reboot
Теперь создаём физический раздел:
# pvcreate /dev/sda3Physical volume "/dev/sda3" successfully created
Смотрим название группы томов, в который добавляется новый раздел
# vgdisplay--- Volume group ---VG Name centos_ansibleSystem IDFormat lvm2Metadata Areas 1Metadata Sequence No 3VG Access read/writeVG Status resizableMAX LV 0Cur LV 2Open LV 2Max PV 0Cur PV 1Act PV 1VG Size 29.51 GiBPE Size 4.00 MiBTotal PE 7554Alloc PE / Size 7543 / 29.46 GiBFree PE / Size 11 / 44.00 MiBVG UUID B7FEqI-aDzN-G0xX-xUgH-oTpd-TRWc-O9sKMi
Добавляем раздел:
# vgextend centos_ansible /dev/sda3Volume group "centos_ansible" successfully extended
Название логического тома, который нужно расширить:
# lvdisplay--- Logical volume ---LV Path /dev/centos_ansible/rootLV Name rootVG Name centos_ansibleLV UUID cmFknm-2nVO-kREo-tQUr-Y7X5-VBPc-AfWkYRLV Write Access read/writeLV Creation host, time localhost, 2015-05-26 02:03:59 +0300LV Status available# open 1LV Size 27.46 GiBCurrent LE 7031Segments 1Allocation inheritRead ahead sectors auto- currently set to 8192Block device 253:1
Расширяем раздел:
# lvextend -l +100%FREE /dev/centos_ansible/rootSize of logical volume centos_monitor/root changed from 27.46 GiB (7031 extents) to 57.50 GiB (14721 extents).Logical volume root successfully resized.
И последнее
Для CentOS 6
# resize2fs -p /dev/mapper/centos_ansible-rootresize2fs 1.42.9 (28-Dec-2013)Filesystem at /dev/mapper/centos_ansible-root is mounted on /; on-line resizing requiredold desc_blocks = 1, new_desc_blocks = 2Performing an on-line resize of /dev/mapper/centos_ansible-root to 1799936 (4k) blocks.The filesystem on /dev/mapper/centos_ansible-root is now 1799936 blocks long.
Для CentOS 7
# xfs_growfs /dev/mapper/centos_ansible-rootmeta-data=/dev/mapper/centos_ansible-root isize=256 agcount=4, agsize=1799936 blks= sectsz=512 attr=2, projid32bit=1= crc=0 finobt=0data = bsize=4096 blocks=7199744, imaxpct=25= sunit=0 swidth=0 blksnaming =version 2 bsize=4096 ascii-ci=0 ftype=0log =internal bsize=4096 blocks=3515, version=2= sectsz=512 sunit=0 blks, lazy-count=1realtime =none extsz=4096 blocks=0, rtextents=0data blocks changed from 7199744 to 15074304
Проверяем что получилось:
# df -hFilesystem Size Used Avail Use% Mounted on/dev/mapper/centos_ansible-root 58G 11G 47G 19% /devtmpfs 911M 0 911M 0% /devtmpfs 921M 0 921M 0% /dev/shmtmpfs 921M 8.5M 912M 1% /runtmpfs 921M 0 921M 0% /sys/fs/cgroup/dev/sda1 497M 277M 221M 56% /boottmpfs 185M 0 185M 0% /run/user/0
Размер корневой файловой системы увеличился. Прелесть в том, что это расширение производится в online режиме без каких либо live-систем и прочего.
0 Комментарии