After reading your answer more carefully I got the following idea:

How do you see if I boot the system (this is a desktop computer and the old
and the new drive are both NVMe SSD) from USB Linux and then just do a 'dd'
for the entire drive (in block level, bit-by-bit). Then I remove the old
disk out of the system. Shouldn't it boot normally now ?

Then I will create a new partition for the all unused space (1.5GB) on new
disk which I then will add to the LVM as a new Physical Volume (PV) in
pc3_vg group. Then I  just need to configure the Logical Volume to use that
new added storage space.

If this is possible I think it would be a bit simpler way to do this.

What do you think about this method ?

ma 28. elok. 2023 klo 19.31 Roska Postit (roskapostit99...@gmail.com)
kirjoitti:

> Thank you very much for your time. This was very very helpful.
>
> ma 28. elok. 2023 klo 18.34 Stuart D Gathman (stu...@gathman.org)
> kirjoitti:
>
>> On Sun, 27 Aug 2023, Roska Postit wrote:
>>
>> > What is the most proper way to swap my 500GB SSD drive to the bigger
>> 2TB SSD
>> > drive in the following LLVM configuration ?
>> >
>> > nvme0n1            259:0    0 465,8G  0 disk
>> > ├─nvme0n1p1        259:1    0   512M  0 part  /boot/efi
>> > ├─nvme0n1p2        259:2    0   488M  0 part  /boot
>> > └─nvme0n1p3        259:3    0 464,8G  0 part
>> >   ├─pc3--vg-root   254:0    0 463,8G  0 lvm   /
>> >   └─pc3--vg-swap_1 254:1    0   980M  0 lvm   [SWAP]
>>
>> Since you are not mirroring, just add the new drive.
>>
>> If this is a laptop, and you can only have one drive, then I suggest
>> you mount the new drive via USB (note there are at least 2 kinds of
>> nvme interface and you have to get a matching USB enclosure).
>>
>> Use dd to copy the partition table (this also often contains boot code)
>> to the new disk on USB.
>> Then use dd to copy the smaller partitions (efi,boot).
>> Now use cfdisk to delete the 3rd partition.
>> Expand the boot partition to 1G (you'll thank me later).
>> Allocate the entire rest of the disk to p3.
>> Create a new vg with a different name.  Allocate root and swap on
>> new VG the same sizes.
>> Take a snapshot of current root (delete swap on old drive since you
>> didn't leave yourself any room), and use partclone to efficiently
>> copy the filesystem over to new root.
>>
>> Either a) edit grub and fstab on new drive to use new vg name  or
>>         b) boot from a live media to rename old and new vg or
>>         c) rename vg just before shutting down to remove drive -
>>            I think LVM can operate with dup VG name, but I've never
>>            navigated the details.
>>
>> Swap drives after powerdown.
>>
>> A modern filesystem like ext2, xfs, btrfs, etc can expand as you expand
>> the root LV.  Leave yourself some working room in the
>> VG._______________________________________________
>> linux-lvm mailing list
>> linux-lvm@redhat.com
>> https://listman.redhat.com/mailman/listinfo/linux-lvm
>> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
>>
>
_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

Reply via email to