This is my hard drive at first:
- /dev/sda1 100MB for bios_grub
- /dev/sda2/ 500MB for /boot
- /dev/sda3 800MB as physical volume for LVM2
myvg
volume group.
I used parted
to delete sda1, and sda2. After that recreated /sda1 (600MB) for /boot. Then used gdisk
to update numbering /dev/sda. so now /dev/sda3 becomes /dev/sda2. The problem is that the when I run pvs
I still get /dev/sda3
as physical voume for myvg
.
How do I update this while keeping the data inside myvg
intact?
For other people who would like to do the same, here are two recommendations:
In this case you have several solutions :
Details below :
I reproduced what you did with the same tools. The disk name and size differ, /dev/sdb instead of /dev/sda.
Before removing the first partitions:
After the deletion:
After creating a new partition 1:
After reorganizing the numbers (gdisk /dev/sdb + s):
But the pvs command show the wrong number
In this case LVM or some parts of the kernel always uses the old table.
After the reboot the new partition numbers were correctly taken into account by the system and by lvm.
I think this is safe for your data, if i'm not mistaken lvm use directly the uuid of disk. These commands are not supposed to change the uuid.
In any case this is certainly safer than changing the numbering of partitions;)