Hyper-V側で仮想HDDを拡張
ゲストOSにチェックポイントが設定されていると、最終的にディスク編集ができません。チェックポイントを削除する必要があります。
ゲストOSを選択し、右サイドバーの「操作」から「ディスクの編集」をクリック
ゲストOSのVHDXファイルを選択します。
拡張を選択
拡張後の仮想HDDのサイズを入力
完了をクリックし、物理HDDに仮想HDD領域を確保します。
ゲストOSのパーティションを確認
sudo fdisk -l
Disk /dev/sda: 127 GiB, 136365211648 bytes, 266338304 sectors
Disk model: Virtual Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: E709E64B-C0D4-4152-BAFB-C381967535DF
Device Start End Sectors Size Type
/dev/sda1 2048 2203647 2201600 1G EFI System
/dev/sda2 2203648 6397951 4194304 2G Linux filesystem
/dev/sda3 6397952 266336255 259938304 123.9G Linux filesystem
Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 61.97 GiB, 66542632960 bytes, 129966080 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk model: Virtual Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: E709E64B-C0D4-4152-BAFB-C381967535DF
Device Start End Sectors Size Type
/dev/sda1 2048 2203647 2201600 1G EFI System
/dev/sda2 2203648 6397951 4194304 2G Linux filesystem
/dev/sda3 6397952 266336255 259938304 123.9G Linux filesystem
Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 61.97 GiB, 66542632960 bytes, 129966080 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
ゲストOSのパーティションを編集
sudo parted
GNU Parted 3.6
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)print
Warning: Not all of the space available to /dev/sda appears to be used, you canfix the GPT to use all of the space (an extra 606085120 blocks) or continue with the current setting?
Fix/Ignore? Fix
Model: Msft Virtual Disk (scsi)
Disk /dev/sda: 136GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 1128MB 1127MB fat32 boot, esp
2 1128MB 3276MB 2147MB ext4
3 3276MB 136GB 133GB
(parted)resizepart 3
End? [136GB]? 300GB
(parted)q
sudo lvdisplay
--- Logical volume ---
LV Path /dev/ubuntu-vg/ubuntu-lv
LV Name ubuntu-lv
VG Name ubuntu-vg
LV UUID Li6Css-BOTE-NzKj-Z8Hz-bgNx-csSY-TAn16D
LV Write Access read/write
LV Creation host, time ubuntu-server, 2025-05-17 06:32:40 +0000
LV Status available
# open 1
LV Size 61.97 GiB
Current LE 15865
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)print
Warning: Not all of the space available to /dev/sda appears to be used, you canfix the GPT to use all of the space (an extra 606085120 blocks) or continue with the current setting?
Fix/Ignore? Fix
Model: Msft Virtual Disk (scsi)
Disk /dev/sda: 136GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 1128MB 1127MB fat32 boot, esp
2 1128MB 3276MB 2147MB ext4
3 3276MB 136GB 133GB
(parted)resizepart 3
End? [136GB]? 300GB
(parted)q
sudo lvdisplay
--- Logical volume ---
LV Path /dev/ubuntu-vg/ubuntu-lv
LV Name ubuntu-lv
VG Name ubuntu-vg
LV UUID Li6Css-BOTE-NzKj-Z8Hz-bgNx-csSY-TAn16D
LV Write Access read/write
LV Creation host, time ubuntu-server, 2025-05-17 06:32:40 +0000
LV Status available
# open 1
LV Size 61.97 GiB
Current LE 15865
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
#フルサイズに拡張できない場合 以下を追加
sudo growpart /dev/sda 3
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
sudo growpart /dev/sda 3
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
0 件のコメント:
コメントを投稿