Re: [linux-lvm] Swapping LLVM drive
Stuart D Gathman writes: > 1. Unnecessary copying. 2. You lose your free backup of the system on > the old drive, >which should be carefully labeled and kept handy for a year. >(After that, SSDs start to run the risk of data retention issues.) You also have unnecessary copying with dd, but yea, partclone can save on that. If you want to keep the free backup with LVM, then instead of pvmove you can lvconvert the volumes to mirrors, then split the mirrors. The nice thing about doing it with LVM is that it can happen in the background while you still use the computer instead of having to boot from removable media and wait hours and hours for the copy. >> Don't forget you'll need to reinstall grub on the new drive for it to >> boot. > > And that is the most important reason. "Just reinstall grub" is a > much larger learning curve than "dd" IMO. Maybe a bit larger, but something that is always good to know and worth learning. ___ 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/
Re: [linux-lvm] Swapping LLVM drive
On Mon, 28 Aug 2023, Roska Postit wrote: 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 ? That would work, yes, but you don't expand /boot - which you really should do. Also, copying the entire filesystem is not only less efficient, but involves needless writes to an SSD (where they are a more limited resource than on magnetic drives). 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 That is pointless when you can just expand the partition (which is trivial when it is the last one). You don't want more PVs unless they are actually physical volumes - or there is some special circumstance that prevents just expanding the partition. ___ 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/
Re: [linux-lvm] Swapping LLVM drive
On Mon, 28 Aug 2023, Phillip Susi wrote: Why would you use dd/partclone instead of just having LVM move everything to the new drive on the fly? Partition the new drive, use pvcreate to initialize the partition as a pv, vgextend to add the pv to the existing vg, pvmove to evacuate the logical volumes from the old disk, then vgreduce to remove it from the vg. 1. Unnecessary copying. 2. You lose your free backup of the system on the old drive, which should be carefully labeled and kept handy for a year. (After that, SSDs start to run the risk of data retention issues.) Don't forget you'll need to reinstall grub on the new drive for it to boot. And that is the most important reason. "Just reinstall grub" is a much larger learning curve than "dd" IMO. ___ 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/
Re: [linux-lvm] Swapping LLVM drive
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 ? > > > > nvme0n1259:00 465,8G 0 disk > > ├─nvme0n1p1259:10 512M 0 part /boot/efi > > ├─nvme0n1p2259:20 488M 0 part /boot > > └─nvme0n1p3259:30 464,8G 0 part > > ├─pc3--vg-root 254:00 463,8G 0 lvm / > > └─pc3--vg-swap_1 254:10 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/
Re: [linux-lvm] Swapping LLVM drive
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 ? >> > >> > nvme0n1259:00 465,8G 0 disk >> > ├─nvme0n1p1259:10 512M 0 part /boot/efi >> > ├─nvme0n1p2259:20 488M 0 part /boot >> > └─nvme0n1p3259:30 464,8G 0 part >> > ├─pc3--vg-root 254:00 463,8G 0 lvm / >> > └─pc3--vg-swap_1 254:10 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/
Re: [linux-lvm] Swapping LLVM drive
Stuart D Gathman writes: > 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. Why would you use dd/partclone instead of just having LVM move everything to the new drive on the fly? Partition the new drive, use pvcreate to initialize the partition as a pv, vgextend to add the pv to the existing vg, pvmove to evacuate the logical volumes from the old disk, then vgreduce to remove it from the vg. Don't forget you'll need to reinstall grub on the new drive for it to boot. ___ 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/
Re: [linux-lvm] Swapping LLVM drive
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] Swapping LLVM drive
What is the most proper way to swap my 500GB SSD drive to the bigger 2TB SSD drive in the following LLVM configuration ? nvme0n1259:00 465,8G 0 disk ├─nvme0n1p1259:10 512M 0 part /boot/efi ├─nvme0n1p2259:20 488M 0 part /boot └─nvme0n1p3259:30 464,8G 0 part ├─pc3--vg-root 254:00 463,8G 0 lvm / └─pc3--vg-swap_1 254:10 980M 0 lvm [SWAP] btw. You don't need to give me step by step instructions just some directions and ideas would be just fine. ___ 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/