Understand my Ubuntu LVM Environment

Ubuntu Version: 24.04

Desktop Environment (if applicable): Mate

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.

It does appear that among everything shown, you have two LVs called /root & two called ubuntu24.04

Can you show everything using these commands for us to see:

sudo pvs
sudo vgs
sudo lvs
dad@dadubuntu:~$ sudo pvs
  PV             VG   Fmt  Attr PSize   PFree  
  /dev/nvme0n1p2 vg01 lvm2 a--  930.97g 195.97g
dad@dadubuntu:~$ sudo vgs
  VG   #PV #LV #SN Attr   VSize   VFree  
  vg01   1   5   0 wz--n- 930.97g 195.97g
dad@dadubuntu:~$ sudo lvs
  LV          VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home        vg01 -wi-ao---- 400.00g                                                    
  root        vg01 -wi-ao---- 100.00g                                                    
  ubserver    vg01 -wi-a-----  60.00g                                                    
  ubuntu24.04 vg01 -wi-a-----  75.00g                                                    
  win11       vg01 -wi-a----- 100.00g                                                    
dad@dadubuntu:~$ sudo pvdisplay
  --- 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
   
dad@dadubuntu:~$ sudo vgdisplay
  --- Volume group ---
  VG Name               vg01
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  59
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                5
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               930.97 GiB
  PE Size               4.00 MiB
  Total PE              238329
  Alloc PE / Size       188160 / 735.00 GiB
  Free  PE / Size       50169 / 195.97 GiB
  VG UUID               uFamn7-8DjR-GZ3R-jKVA-ScG7-xu3q-0nlr8N
   
dad@dadubuntu:~$ sudo lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg01/root
  LV Name                root
  VG Name                vg01
  LV UUID                vCHy0K-hkyJ-3zEY-jaQh-Ibrh-SHlH-bHIACf
  LV Write Access        read/write
  LV Creation host, time ubuntu-mate, 2025-05-28 15:01:43 +0100
  LV Status              available
  # open                 1
  LV Size                100.00 GiB
  Current LE             25600
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0
   
  --- Logical volume ---
  LV Path                /dev/vg01/home
  LV Name                home
  VG Name                vg01
  LV UUID                z1Aadu-Y4xb-JnJR-IuAB-WsHD-nl3C-g3Qwpm
  LV Write Access        read/write
  LV Creation host, time ubuntu-mate, 2025-05-28 15:02:50 +0100
  LV Status              available
  # open                 1
  LV Size                400.00 GiB
  Current LE             102400
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1
   
  --- Logical volume ---
  LV Path                /dev/vg01/ubserver
  LV Name                ubserver
  VG Name                vg01
  LV UUID                yWXSBZ-J7Cn-vBpR-3qo8-UUsL-r025-9Mn6QK
  LV Write Access        read/write
  LV Creation host, time dadubuntu, 2025-11-16 09:01:02 +0000
  LV Status              available
  # open                 0
  LV Size                60.00 GiB
  Current LE             15360
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:2
   
  --- Logical volume ---
  LV Path                /dev/vg01/ubuntu24.04
  LV Name                ubuntu24.04
  VG Name                vg01
  LV UUID                S031Uh-kZdR-F9Vq-Llsp-cgnD-QU1q-m7Rvon
  LV Write Access        read/write
  LV Creation host, time dadubuntu, 2025-12-02 16:39:45 +0000
  LV Status              available
  # open                 0
  LV Size                75.00 GiB
  Current LE             19200
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:3
   
  --- Logical volume ---
  LV Path                /dev/vg01/win11
  LV Name                win11
  VG Name                vg01
  LV UUID                M1wTnd-wCe5-tiTt-AgoP-IALR-qehe-W38cZx
  LV Write Access        read/write
  LV Creation host, time dadubuntu, 2026-01-25 12:13:09 +0000
  LV Status              available
  # open                 0
  LV Size                100.00 GiB
  Current LE             25600
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:4

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.

1 Like

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.

1 Like

Thank you both - that fully makes it clear to me what has happened.