Hello, world. This is my first question on Discourse, though I was a longtime lurker and occasional poster on the old Ubuntu Forum.
Ubuntu Version
Not Ubuntu, this time, but Debian 12 (though I expect this will help me out with my next Ubuntu installation, too).
Desktop Environment
Gnome/Wayland
Problem Description
During the initial set-up prior to beginning the installation, I had trouble understanding how to configure my filesystems. This was a fresh installation on a brand new 2TB nvm module.
I ended up with the following.
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 1050623 1048576 512M EFI System
/dev/nvme0n1p2 1050624 2050047 999424 488M Linux filesystem
/dev/nvme0n1p3 2050048 3907028991 3904978944 1.8T Linux filesystem
That 1.8TB Linux filesystem encrypted, containing:
# df -h
Filesystem Size Used Avail Use% Mounted on
udev 7.8G 0 7.8G 0% /dev
tmpfs 1.6G 2.1M 1.6G 1% /run
/dev/mapper/ABCDE--vg-root 23G 9.9G 12G 46% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 5.0M 8.0K 5.0M 1% /run/lock
/dev/nvme0n1p2 456M 84M 348M 20% /boot
/dev/mapper/ABCDE--vg-tmp 1.8G 476K 1.7G 1% /tmp
/dev/mapper/ABCDE--vg-var 9.1G 2.4G 6.3G 28% /var
/dev/nvme0n1p1 511M 5.9M 506M 2% /boot/efi
/dev/mapper/ABCDE--vg-home 1.8T 3.9G 1.7T 1% /home
tmpfs 1.6G 120K 1.6G 1% /run/user/1000
Just from looking at this, I think that / and /var are undersized and /home is oversized. I want to correct that by growing / and /var and by shrinking /home.
# lvdisplay
--- Logical volume ---
LV Path /dev/ABCDE-vg/root
LV Name root
VG Name ABCDE-vg
LV UUID xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx
LV Write Access read/write
LV Creation host, time ABCDE, 2025-03-21 12:58:00 +0100
LV Status available
# open 1
LV Size 23.28 GiB
Current LE 5960
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:1
--- Logical volume ---
LV Path /dev/ABCDE-vg/var
LV Name var
VG Name ABCDE-vg
LV UUID xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx
LV Write Access read/write
LV Creation host, time ABCDE, 2025-03-21 12:58:01 +0100
LV Status available
# open 1
LV Size 9.31 GiB
Current LE 2384
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:2
--- Logical volume ---
LV Path /dev/ABCDE-vg/swap_1
LV Name swap_1
VG Name ABCDE-vg
LV UUID xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx
LV Write Access read/write
LV Creation host, time ABCDE, 2025-03-21 12:58:01 +0100
LV Status available
# open 2
LV Size 976.00 MiB
Current LE 244
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:3
--- Logical volume ---
LV Path /dev/ABCDE-vg/tmp
LV Name tmp
VG Name ABCDE-vg
LV UUID xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx
LV Write Access read/write
LV Creation host, time ABCDE, 2025-03-21 12:58:01 +0100
LV Status available
# open 1
LV Size <1.86 GiB
Current LE 476
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:4
--- Logical volume ---
LV Path /dev/ABCDE-vg/home
LV Name home
VG Name ABCDE-vg
LV UUID xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx
LV Write Access read/write
LV Creation host, time ABCDE, 2025-03-21 12:58:02 +0100
LV Status available
# open 1
LV Size 1.78 TiB
Current LE 467613
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:5
Here, we can see that there is only 1GB of swap. When I first started out with linux, back in 1996, I remember the rule of thumb being that swap should be around double physical RAM. I understand that this is no longer the case (RAM being “as cheap as chips”, nowadays), but that should be around 25% to 40% of physical RAM to be able to use hibernate or suspend; this installation is on a laptop, so I would like to be able to use those features. So I want to increase swap.
I did not create dedicated /usr and /opt filesystems; at the moment the /usr directory contains 9.7GB and /opt only 151MB. I don’t anticipate putting very much into /opt, so I could leave that as is it.
# du -sh /usr /opt
9.7G /usr
151M /opt
So, in summary, I want to change the filsystems inside this volume group:
- shrink /home to about 1TB
- grow /var to 250GB
- grow swap to 4GB
- create /usr to occupy the remaining space
I don’t have a lot of experience setting up LVM (I think I’ve only done this twice, about three years ago and again about two years ago). I don’t have very strong memories of doing it, which makes me think that I probably used default suggested values and never ran into problems or had any worries about running out of space.
So, what tools do I need, and how do I use them to achieve my goal? Any help will be gratefully received.