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/

Reply via email to