OS関連
目次
Ubuntu 24のストレージ関連の操作。
仮想化基盤側の操作により、仮想マシンのディスクサイズを拡張する。
現在のパーティションテーブルを確認。
# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 200G 0 disk ├─sda1 8:1 0 1M 0 part ├─sda2 8:2 0 2G 0 part /boot └─sda3 8:3 0 48G 0 part └─ubuntu--vg-ubuntu--lv 252:0 0 48G 0 lvm / sr0 11:0 1 1024M 0 rom
# fdisk -l GPT PMBR size mismatch (104857599 != 419430399) will be corrected by write. The backup GPT table is not on the end of the device. Disk /dev/sda: 200 GiB, 214748364800 bytes, 419430400 sectors Disk model: Virtual disk 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: gpt Disk identifier: F8547988-1B15-4886-89C0-175EED4F1211 Device Start End Sectors Size Type /dev/sda1 2048 4095 2048 1M BIOS boot /dev/sda2 4096 4198399 4194304 2G Linux filesystem /dev/sda3 4198400 104855551 100657152 48G Linux filesystem
/dev/sda3の容量を48GB→198GBに拡張。
# growpart /dev/sda 3 CHANGED: partition=3 start=4198400 old: size=100657152 end=104855551 new: size=415231967 end=419430366
# lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv Size of logical volume ubuntu-vg/ubuntu-lv changed from <48.00 GiB (12287 extents) to <198.00 GiB (50687 extents). Logical volume ubuntu-vg/ubuntu-lv successfully resized.
# resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv resize2fs 1.47.0 (5-Feb-2023) Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required old_desc_blocks = 6, new_desc_blocks = 25 The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 51903488 (4k) blocks long.