После расширения диска в виртуальной машине KVM необходимо создать новый раздел.
Например, у нас был диск размером 43 ГБ, добавили 10:
# fdisk -l Disk /dev/vda: 53.7 GB, 53687091200 bytes 255 heads, 63 sectors/track, 6527 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: 0x0004fd07 Device Boot Start End Blocks Id System /dev/vda1 * 1 5091 40892224 83 Linux /dev/vda2 5091 5222 1048576 82 Linux swap / Solaris
Создадим раздел на неиспользуемом пространстве.
# fdisk /dev/vda 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): n Command action e extended p primary partition (1-4) p Partition number (1-4): 3 First cylinder (5222-6527, default 5222): Using default value 5222 Last cylinder, +cylinders or +size{K,M,G} (5222-6527, default 6527): Using default value 6527 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 16: Device or resource busy. 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.
Здесь мы вошли в утилиту fdisk, ввели команду n (создать раздел), затем ввели p (primary-раздел), затем номер раздела 3. Завершили работу записью изменений, нажав w.
Перезагружаемся, чтобы перечитать таблицу разделов.
Теперь у нас есть новый раздел vda3.
Создадим файловую систему
mkfs.ext4 /dev/vda3 -j
Монтируем
mount /dev/vda3 /mnt
Правим файл /etc/fstab
/dev/vda3 /mnt ext4 defaults 1 1