You have 150GB of unpartitioned space on your disk (/dev/sda
). To resize ubuntu--vg-ubuntu--lv
and make use of this space, follow these steps:
- Open a terminal and start
fdisk
:sudo fdisk /dev/sda
- Create a new primary partition:
- Press
n
(new partition) - Select
p
(primary) - Choose the default partition number
- Press
Enter
to accept the default start sector - Press
Enter
to accept the default end sector (using all available space)
- Press
- Change partition type to LVM:
- Press
t
(change partition type) - Select the new partition number
- Type
8e
(Linux LVM)
- Press
- Write the changes and exit:
- Press
w
(write changes and exit)
- Press
Run:
sudo partprobe
If partprobe is not available, reboot the system.
sudo pvcreate /dev/sda4
(Assuming the new partition is /dev/sda4
, adjust if needed.)
sudo vgextend ubuntu-vg /dev/sda4
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
For EXT4 filesystem:
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
For XFS filesystem:
sudo xfs_growfs /
df -h
Now, your logical volume should have the additional 150GB available. Let me know if you need any modifications! 🚀
No, you do not need to modify /etc/fstab
or run mount -a
for these changes to persist across reboots. Here’s why:
-
LVM Changes Persist Automatically
- The new partition (
/dev/sda4
→ LVM) is added to the volume group (ubuntu-vg
). - Logical volume (
ubuntu--vg-ubuntu--lv
) is resized. - These changes are stored in the LVM metadata and persist across reboots.
- The new partition (
-
Filesystem Resizing is Permanent
- The
resize2fs
(for EXT4) orxfs_growfs
(for XFS) command permanently resizes the filesystem.
- The
After a reboot, verify the changes using:
df -h # Check available space
lsblk # Confirm the volume sizes
sudo vgs # Check volume group size
sudo lvs # Check logical volume size
You only need to modify /etc/fstab
if:
- You created a new partition outside LVM (not applicable here).
- You want to mount an additional partition separately.
- You need to change mount options (e.g., adding
noatime
,discard
for SSDs).
Since you're expanding an existing LVM volume, there's no need to update /etc/fstab
. 🚀