FIX Ubuntu LVM : extend volume - Duplicate UUID of disk

 



-- problem --

while you wanna extend your vg to bigger size, and you find an error like this bellow, then we probably in the same server of problem.

root@darKonsole:~# lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
  WARNING: Not using lvmetad because duplicate PVs were found.
  WARNING: Use multipath or vgimportclone to resolve duplicate PVs?
  WARNING: After duplicates are resolved, run "pvscan --cache" to enable lvmetad.
  WARNING: PV MHz3Ac-7ShK-2j8s-6u58-dnpf-1rrC-e3q4Kc on /dev/sda3 was already found on /dev/md126p3.
  WARNING: PV MHz3Ac-7ShK-2j8s-6u58-dnpf-1rrC-e3q4Kc prefers device /dev/md126p3 because device is used by LV.
  Size of logical volume ubuntu-vg/ubuntu-lv changed from <112.52 GiB (28805 extents) to <225.04 GiB (57610 extents).
  Cannot update volume group ubuntu-vg with duplicate PV devices.

in my case the problem exist on ubuntu 18.4 distro, using lvm . DellEMC poweredge T40 with raid1


-- root couse --

As the message that mentioned on error command, we figure it out that UID of pv are duplicate.
maked sure with this command :

root@darKonsole:~# lsblk -f
NAME                        FSTYPE          LABEL UUID                                   MOUNTPOINT
sda                         isw_raid_member
├─sda1                      vfat                  ADB1-9283
├─sda2                      ext4                  37eb5c71-bf90-4580-9f99-65db5a549521
├─sda3                      LVM2_member           MHz3Ac-7ShK-2j8s-6u58-dnpf-1rrC-e3q4Kc
└─md126
  ├─md126p1                 vfat                  ADB1-9283                              /boot/efi
  ├─md126p2                 ext4                  37eb5c71-bf90-4580-9f99-65db5a549521   /boot
  └─md126p3                 LVM2_member           MHz3Ac-7ShK-2j8s-6u58-dnpf-1rrC-e3q4Kc
    └─ubuntu--vg-ubuntu--lv ext4                  4f96b7ce-67a3-483a-bc83-c0e5bbf93bcd   /
sdb                         isw_raid_member
└─md126
  ├─md126p1                 vfat                  ADB1-9283                              /boot/efi
  ├─md126p2                 ext4                  37eb5c71-bf90-4580-9f99-65db5a549521   /boot
  └─md126p3                 LVM2_member           MHz3Ac-7ShK-2j8s-6u58-dnpf-1rrC-e3q4Kc
    └─ubuntu--vg-ubuntu--lv ext4                  4f96b7ce-67a3-483a-bc83-c0e5bbf93bcd   /
sr0
hope you got what i mean .. :)

-- solusion and fixing --

we have the problem and we know the root couse, now we go to the trying for the solusion.
and the solusion we try is  to add filter in lvm.conf to not scan the disk that we not used.

edit  lvm.conf under etc and add filter in general section .
root@darKonsole:~# vi /etc/lvm/lvm.conf

#penambahan
filter = [ "a/dev/mapper/.*/", "r/dev/sd.*/" ]
note :
- Don't forget to include anything else that should be there (e.g. maybe dda1 was the internal disk on which my LVM for root and other filesystems existed, for mine no need).

fyi :

- This setting accepts all /dev/mapper/* devices and rejects all the /dev/sd* devices while scanning the LVM disks. Refer to the LVM2 user guide for further details. If the root device is also a multipathed LVM device, then make change(s) to /etc/lvm/lvm.conf before creating a new initrd image. Where “multipath on root” is required, the lvm.conf is needed in the initrd image, which requires the initrd to be re-made.

save the config and : Stop any applications/services that access LVM managed devices/filesystems, Unmount all LVM-based filesystems, Deactivate all Volume Groups, rescan vg, reactivate bla bla bla
simply task, mine  reboot the server

and .........

result :
login to server and check the UUID of the volume disk

Welcome to Ubuntu 18.04.6 LTS (GNU/Linux 5.4.0-132-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Tue Nov 29 09:17:58 UTC 2022

  System load:  1.35               Processes:           207
  Usage of /:   7.3% of 110.19GB   Users logged in:     1
  Memory usage: 3%                 IP address for eno1: xx.xx.xx.xx
  Swap usage:   0%


0 updates can be applied immediately.
Last login: Tue Nov 29 08:48:15 2022 from xx.xx.xx.xx
sama@darKonsole:~$ lsblk -f
NAME                        FSTYPE          LABEL UUID                                   MOUNTPOINT
sda                         isw_raid_member
└─md126
  ├─md126p1                 vfat                  ADB1-9283                              /boot/efi
  ├─md126p2                 ext4                  37eb5c71-bf90-4580-9f99-65db5a549521   /boot
  └─md126p3                 LVM2_member           MHz3Ac-7ShK-2j8s-6u58-dnpf-1rrC-e3q4Kc
    └─ubuntu--vg-ubuntu--lv ext4                  4f96b7ce-67a3-483a-bc83-c0e5bbf93bcd   /
sdb                         isw_raid_member
└─md126
  ├─md126p1                 vfat                  ADB1-9283                              /boot/efi
  ├─md126p2                 ext4                  37eb5c71-bf90-4580-9f99-65db5a549521   /boot
  └─md126p3                 LVM2_member           MHz3Ac-7ShK-2j8s-6u58-dnpf-1rrC-e3q4Kc
    └─ubuntu--vg-ubuntu--lv ext4                  4f96b7ce-67a3-483a-bc83-c0e5bbf93bcd   /
sr0
sama@darKonsole:~$ sudo -i
root@darKonsole:~# lsblk -f
NAME                        FSTYPE          LABEL UUID                                   MOUNTPOINT
sda                         isw_raid_member
└─md126
  ├─md126p1                 vfat                  ADB1-9283                              /boot/efi
  ├─md126p2                 ext4                  37eb5c71-bf90-4580-9f99-65db5a549521   /boot
  └─md126p3                 LVM2_member           MHz3Ac-7ShK-2j8s-6u58-dnpf-1rrC-e3q4Kc
    └─ubuntu--vg-ubuntu--lv ext4                  4f96b7ce-67a3-483a-bc83-c0e5bbf93bcd   /
sdb                         isw_raid_member
└─md126
  ├─md126p1                 vfat                  ADB1-9283                              /boot/efi
  ├─md126p2                 ext4                  37eb5c71-bf90-4580-9f99-65db5a549521   /boot
  └─md126p3                 LVM2_member           MHz3Ac-7ShK-2j8s-6u58-dnpf-1rrC-e3q4Kc
    └─ubuntu--vg-ubuntu--lv ext4                  4f96b7ce-67a3-483a-bc83-c0e5bbf93bcd   /
sr0

try to extend the lvm

now we have to extend the LV capacity of ubuntu_lv

root@darKonsole:~# lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
  Size of logical volume ubuntu-vg/ubuntu-lv changed from <112.52 GiB (28805 extents) to <225.04 GiB (57610 extents).
  Logical volume ubuntu-vg/ubuntu-lv successfully resized.


root@darKonsole:~# df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                               7.7G     0  7.7G   0% /dev
tmpfs                              1.6G  1.5M  1.6G   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  111G  8.1G   97G   8% /
tmpfs                              7.8G  100K  7.8G   1% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/md126p2                       974M  169M  739M  19% /boot
/dev/md126p1                       511M  4.5M  507M   1% /boot/efi
tmpfs                              1.6G  8.0K  1.6G   1% /run/user/1000

root@darKonsole:~#  resize2fs -p /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required
old_desc_blocks = 15, new_desc_blocks = 29
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 58992640 (4k) blocks long.

VOILA.....

root@darKonsole:~# df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                               7.7G     0  7.7G   0% /dev
tmpfs                              1.6G  1.5M  1.6G   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  221G  8.1G  203G   4% /
tmpfs                              7.8G  100K  7.8G   1% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/md126p2                       974M  169M  739M  19% /boot
/dev/md126p1                       511M  4.5M  507M   1% /boot/efi
tmpfs                              1.6G  8.0K  1.6G   1% /run/user/1000
root@darKonsole:~#


 /* Your warranty is now void. * 
* I am not responsible for bricked devices, dead service / server
* thermonuclear war, or you getting fired because the  app/service failed. 
*Please do some research if you have any concerns about this. 
* Do at your own risk 
*/


Next
This is the current newest page
Previous
Next Post »

comment please ... ConversionConversion EmoticonEmoticon

Thanks for your comment