[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Migrating to a new disk.



On Sun, 30 Aug 2020 02:44:02 -0700
"Rick Thomas" <rick.thomas@pobox.com> wrote:

> OK, I've got a Debian computer where the system disk is showing signs
> of flakiness.  I want to replace it with a new disk and retire the
> old one.
> 
> Before I do it for real, I'm doing a dry-run on a vmware virtual
> machine.  I don't *think* the fact that it's virtual should affect my
> results.  But I put it out there, just incase.
> 
> Here's what I've done so far:
> 
> *) Set up a VM with one virtual SATA disc drive, and installed Buster
> on it.  The system has a MBR partitioning with /boot in /dev/sda1 and
> the rest of the disk as an LVM volume-group ("tryout-vg") partition
> in /dev/sda5 with root, swap, and home as LVs.
> 
> *) Added a virtual SATA disk drive and partitioned it the same as
> above -- /dev/sdb1 is boot and /dev/sdb5 is the LVM partition.
> However, in order to have both disks available for mounting (see
> below) at the same time, the new drive's LVM volume-group had to have
> a different name ("new-vg").
> 
> *) Used rsync to copy the contents of the boot, root, and home
> partitions from the original disk to the new one.
> 
> *) Modified the /etc/fstab on the new disk to reflect the names and
> uuid's of the partitions on the new disk.
> 
> *) Booted the Buster install DVD in rescue mode and ran "reinstall
> boot loader" for the new disk.
> 
> *) Rebooted and told the BIOS to boot from the new disk.  It went to
> the grub screen and proceeded to boot.
> 
> *) To my surprise, after it booted, I logged in and saw that the
> root, swap, home and boot partitions that were mounted were all from
> the original disk!
> 
> So what am I missing?  How do I tell grub on the new disk to use the
> root partition and volume-group on the new disk?
> 
> Thanks for any help!

The stage you missed was to chroot into the new disk root and update
grub from there. This is most painlessly done by booting the installer
medium and choosing rescue, either graphical or otherwise. When you
reach the screen that asks you where the root of the installed OS is,
pick the new root drive, mount the efi/boot partition if you're on efi,
then chroot into the root directory. Run update-grub from there.

The alternative with just boot or non-Debian rescue media is to boot
it, mount the new root somewhere in the rescue filesystem, then chroot
to it, again then update grub. Here's one description:
https://howtoubuntu.org/how-to-repair-restore-reinstall-grub-2-with-a-ubuntu-live-cd

-- 
Joe


Reply to: