0

Attempting to change swap size,

  • vgchange returns nothing
  • lvreduce returns "invalid path for Logical Volume" (not because I missed hidden characters)
  • vgs -v, vgscan -v, vgdisplay -v and lvdisplay -v returns "No volume groups found", and ls /dev/mapper contains only control like here

Why? Can I do anything about it, what?

lvmdiskscan returns 0 disks, 4 partitions, 0 LVM physical volume whole disks and 0 LVM physical volumes. Does this suggest I have to create the volumes?

Notice, I am able to check the filesystem and to change its size using e2fsck and resize2fs.

Failures to detect/show volumes occur when I boot from USB with Debian bullseye in rescue mode and boot from the installed bullseye. I ran apt install lvm2 to run the commands.

Is there an alternative way to change partition sizes? Debian wiki writes that LVM has "full support".

As per comment:

$ sudo lsblk
[sudo] password for ahan: 
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
nvme0n1     259:0    0 476.9G  0 disk 
├─nvme0n1p1 259:1    0   512M  0 part /boot/efi
├─nvme0n1p2 259:2    0 475.5G  0 part /
└─nvme0n1p3 259:3    0   976M  0 part [SWAP]
2
  • 1
    "0 LVM physical volume whole disks and 0 LVM physical volumes" doesn't seem like your setup involves LVM. Are you trying to shrink the swap partition or expand it? What is the partition layout of your disk? (lsblk is useful for this)
    – Torin
    May 29, 2023 at 14:18
  • @Torin thanks for helping out. I am trying to decrease the partition size of nvme0n1p2 in order to increase the size of the swap partition nvme0n1p3.
    – Johan
    May 29, 2023 at 14:36

1 Answer 1

2

0 LVM physical volume whole disks and 0 LVM physical volumes.

It doesn't look like you're using LVM, therefore the LVM tools can't help you with these partitions.

LVM uses a system where "logical volumes" are stored in "volume groups", which span one or more partitions/disks. Some installers may end up creating this setup when installing the system, but it sounds like your setup is just using a normal partition table with the swap and filesystems directly on those partitions.

LVM makes resizing logical volumes very convenient since they don't need to be contiguous on the disk, but in your case it's a bit more awkward.

In your other question, your partitions layout was mentioned:

Device             Start        End   Sectors   Size Type
/dev/nvme0n1p1      2048    1050623   1048576   512M EFI System
/dev/nvme0n1p2   1050624  998215679 997165056 475.5G Linux filesystem
/dev/nvme0n1p3 998215680 1000214527   1998848   976M Linux swap

Fortunately this is fairly straightforward if you're looking to resize just the root partition. You can delete the swap partition (disable it first with swapoff), and then resize the root filesystem (how you do this depends on if you're looking to expand or shrink it, but shrinking may require booting into a LiveCD if your filesystem does not support online shrinking). After this, a new swap partition can be created with the remaining space.

Edit: The basic flow for shrinking a root partition is:

  1. Backup any data you care about
  2. Boot into a live cd or another system where the target filesystem isn't mounted.
  3. Shrink the filesystem+partition. Tools like gparted make this easier, but if you're doing it manually, you will need to shrink the filesystem before the partition. Both need to be shrunk by the same amount (double check with tools that they are using the same units of storage, since GB might mean two different quantities, GiB is unambiguous).
  4. Create the swap partition with the remaining space and format it as a swap partition. It may be worth reformatting the swap partition with the same UUID as it had previously (see mkswap(1)'s --uuid flag), otherwise you might need to update references in /etc/fstab and regenerate the initrd.
1
  • Thanks @Torin! How can I shrink the root partition? I have come to understand that I have to boot from USB because the filesystem has to be unmounted. Feel free to suggest the solution on the other question :-)
    – Johan
    May 29, 2023 at 14:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .