Your hardrive became full, so you bought a new one, but how do you add the empty space of the new harddrive to your existing tree of files?
fdisk -l [...] Disk /dev/sdb: 3.64 TiB, 4000787030016 bytes, 7814037168 sectors Disk model: Samsung SSD 870 Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes [...]
The name was
/dev/sdb
sudo pvcreate /dev/sdb
lvdisplay --- Logical volume --- LV Path /dev/gpu-monster-vg/root LV Name root VG Name gpu-monster-vg
gpu-monster-vg
is the name of the volume group (VG).
sudo vgextend gpu-monster-vg /dev/sdb
Give all new space to root
(the only other logical volume was swap
).
By including the option -r
the filesystem on the device is also resized, this works even when the "partition" is mounted.
sudo lvm lvextend -r -l +100%FREE /dev/gpu-monster-vg/root Size of logical volume gpu-monster-vg/root changed from 107,14 GiB (27428 extents) to 3,74 TiB (981299 extents). Logical volume gpu-monster-vg/root successfully resized. resize2fs 1.47.0 (5-Feb-2023) Filesystem at /dev/mapper/gpu--monster--vg-root is mounted on /; on-line resizing required old_desc_blocks = 14, new_desc_blocks = 480 The filesystem on /dev/mapper/gpu--monster--vg-root is now 1004850176 (4k) blocks long.
That's it, enjoy your new larger filesystem.