論理ボリュームの拡張
現在の容量を確認する。
$ df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 6.3G 2.1M 6.3G 1% /run
/dev/nvme0n1p2 937G 22G 868G 3% /
tmpfs 32G 124K 32G 1% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/nvme0n1p1 1.1G 6.1M 1.1G 1% /boot/efi
/dev/mapper/vg00-work 4.0T 3.2T 615G 85% /work
/dev/mapper/vg00-home 4.0T 155G 3.7T 5% /home
tmpfs 6.3G 4.0K 6.3G 1% /run/user/1000
tmpfs 6.3G 4.0K 6.3G 1% /run/user/1001
work には、仮想的に4.0TBのみ与えている。現在、85%の使用率で残り615GBある。
次に大きなデータを入れると入らなくなる可能性があるので、1TBを追加しようと思う。
まず論理ボリュームを確認。
$ sudo lvdisplay
--- Logical volume ---
LV Path /dev/vg00/home
LV Name home
VG Name vg00
LV UUID 0Bnq0L-mE5X-7PEE-npib-Q8BM-AktA-J0gD5e
LV Write Access read/write
LV Creation host, time wasat, 2024-10-07 07:58:29 +0000
LV Status available
# open 1
LV Size 4.00 TiB
Current LE 1048576
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/vg00/work
LV Name work
VG Name vg00
LV UUID Q8kVeF-F49J-d7b3-Iuau-EG29-FRrS-8s6fLy
LV Write Access read/write
LV Creation host, time wasat, 2024-10-07 07:58:44 +0000
LV Status available
# open 1
LV Size 4.00 TiB
Current LE 1048576
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
次のコマンドで拡張を実行する。
$ sudo lvextend -L+1TB /dev/vg00/work
Size of logical volume vg00/work changed from 4.00 TiB (1048576 extents) to 5.00 TiB (1310720 extents).
Logical volume vg00/work successfully resized.
成功した。再度、論理ボリュームを確認する。
$ sudo lvdisplay
--- Logical volume ---
LV Path /dev/vg00/home
LV Name home
VG Name vg00
LV UUID 0Bnq0L-mE5X-7PEE-npib-Q8BM-AktA-J0gD5e
LV Write Access read/write
LV Creation host, time wasat, 2024-10-07 07:58:29 +0000
LV Status available
# open 1
LV Size 4.00 TiB
Current LE 1048576
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/vg00/work
LV Name work
VG Name vg00
LV UUID Q8kVeF-F49J-d7b3-Iuau-EG29-FRrS-8s6fLy
LV Write Access read/write
LV Creation host, time wasat, 2024-10-07 07:58:44 +0000
LV Status available
# open 1
LV Size 5.00 TiB
Current LE 1310720
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
無事、変更されてる。
LVの拡張に合わせてパーティションを拡張すれば、完了である。
$ sudo resize2fs /dev/mapper/vg00-work
resize2fs 1.46.5 (30-Dec-2021)
Filesystem at /dev/mapper/vg00-work is mounted on /; on-line resizing required
old_desc_blocks = 13, new_desc_blocks = 117
The filesystem on /dev/mapper/vg00-work is now 243666944 (4k) blocks long.