Problem Description: I have a 1T hard drive (/dev/nvme0n1p2) that is configured as complete lvm volume group (vg01) containing a number of logical volumes. Sequentially the logical volumes are root (/), home (/home) and then a number of qemu virtual machines, that are also in their own LVs. I am not sure I’m reading the output of sudo pvdisplay -m /dev/nvme0n1p2 correctly.
--- Physical volume ---
PV Name /dev/nvme0n1p2
VG Name vg01
PV Size 930.97 GiB / not usable 2.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 238329
Free PE 50169
Allocated PE 188160
PV UUID rDFd9y-pLTa-Q39B-iGFf-ERSB-d5XS-EbQRhi
--- Physical Segments ---
Physical extent 0 to 20479:
Logical volume /dev/vg01/root
Logical extents 0 to 20479
Physical extent 20480 to 122879:
Logical volume /dev/vg01/home
Logical extents 0 to 102399
Physical extent 122880 to 138239:
Logical volume /dev/vg01/ubserver
Logical extents 0 to 15359
Physical extent 138240 to 144639:
Logical volume /dev/vg01/ubuntu24.04
Logical extents 0 to 6399
Physical extent 144640 to 165119:
FREE
Physical extent 165120 to 177919:
Logical volume /dev/vg01/ubuntu24.04
Logical extents 6400 to 19199
Physical extent 177920 to 203519:
Logical volume /dev/vg01/win11
Logical extents 0 to 25599
Physical extent 203520 to 208639:
Logical volume /dev/vg01/root
Logical extents 20480 to 25599
Physical extent 208640 to 238328:
FREE
Seems to me I have two sectors (if that is the right term) that are labelled root 0 -
20479 and 203520 - 208639. (I think 0 - 20479 is my real/actual root (/) - I have no idea where 203520 - 208639 came from. The same with ubuntu24.04 (which is a qemu vm), seems I have two of them whereas I believe I only have one. This is what virt manager looks like:
I would like to get rid of these duplicates but no sure whether it is worth it/easy. Obviously as one of these duplicates is / I’m somewhat nervous. Any advice appreciated.
I don’t see a problem here. It is possible for an LV to occupy and use non-contiguous space on the underlying physical volume (i.e. more than one logical segment). This can easily happen over time if you ever extend or reduce an LV, or later create additional LVs on the same PV.
In LMV terminology, extents are akin to sectors (but larger).
Not only can an LV use extents in a PV (partition) that are non-contiguous, it can use extents in more than one PV (partition) if the VG is defined as more than one PV.
For example,
Suppose VG1 might be created from PVs (partitions) 1,3,and 5 on your physical disk. Then LVs in VG1 can use space on more than one PV. So root LV could be on PVs 1 and 5. And you can add another PV to an existing VG on the fly with vgextend command.
This is what makes LVM so flexible. You can add a new non-contiguous partition to a volume group if you need more space for the LVs in it.