[PLUG] Grub 0.97: convert VM with two disk to VM with single bootable disk

Robert Citek robert.citek at gmail.com
Fri Apr 26 20:42:25 UTC 2019


Thanks, David.  I'll give that a shot later today. - Robert

On Fri, Apr 26, 2019 at 8:12 AM David Bridges <dbridges at austin.rr.com>
wrote:

> There are many variables and unknowns related to what you want to do
> depending on how the original VM was built and installed.  I have used
> the guidelines below to do the same sort of things you are wanting to
> do.
>
> Modify the /etc/fstab entries so that they point to the correct new
> locations.  Some locations probably use labels (LABEL=/boot etc) and
> from what I gather from your email you are no longer using LVM and are
> only using 1 partition.  If this is correct you would need to comment
> out old the entry that point to /home and modify the line for / so that
> it points to the correct device (/dev/vdy1).  You didn't mention what
> you are doing about swap so that is an exercise left up to you.
>
> Shutdown the VM and connect a CentOS 6 CD to it and boot it using the
> CD and enter rescue mode.  You'll be asked a few questions to get
> things started.  When prompted to scan for existing installations
> yes/ok.  If you have things copied over and have corrected the fstab
> file it should find the install and mount it all under /mnt/sysimage.
> If the install was found and mounted you should be able to install grub
> using the following.
>
> At the shell prompt type the following
> chroot /mnt/sysimage
> grub-install --no-floppy --recheck /dev/vdy
>
> If the grub-install command is successful type exit to leave the chroot
> and exit 1 more time to reboot.  In theory the VM should be able to
> successfully boot using the new image file but there could be some
> issues depending on how things got copied from the old system.
>
> In cases similar to what you have I usually just spin up a new VM make
> a copy of the /etc directory on the new system to /etc.old then use
> rsync to copy everything from the old VM excluding things like /proc,
> /sys, /dev, /var/log, and /boot (unless you really need something in
> it).  Once the rsync completes I restore the /etc/fstab file and things
> like the /etc/sysconfig/network-scripts/ifcfg* files from the /etc.old
> directory.  If you did rsync /boot you should probably run the same
> sort of grub-install command listed above before rebooting.  This
> usually works like a charm for any distribution as long as you know
> what crucial files that need to be restored.
>
> Good luck
>
> --
> David
>
> On Tue, 2019-04-23 at 15:05 -0700, Robert Citek wrote:
> > Greetings,
> >
> > How can I turn a VM with two virtual disks into a VM with a single
> > virtual
> > disk that boots?
> >
> > I have a VM with two virtual disks, running CentOS 6.10.  The first
> > disk
> > (vda) has the MBR and all the boot files, i.e. vda1 is eventually
> > mounted
> > at /boot.  The second disk (vdb) has an LVM partition at vdb1 and
> > contains
> > three LVs: lv_root (/), lv_home (/home), and swap.  What I want is a
> > single
> > disk (e.g. vdy) that contains all the files on a single partition
> > (vdy1)
> > and can boot.  And I almost have that.
> >
> > That is, I detached all the disks from the original VM, created a
> > separate
> > temporary VM with a new disk (vdy), and attached and mounted the
> > disks from
> > the original VM.  I then partitioned, formatted, and mounted vdy1 at
> > /mnt/vdy1/.  All the lv_root files were copied to /mnt/vdy1.  All the
> > lv_home files were copied to /mnt/vdy1/home.  And all the /boot files
> > were
> > copied to /mnt/vdy1/boot.  Given that the system is CentOS 6.1 and
> > runs
> > grub 0.97, how can I install Grub at vdy from this temporary VM?
> >
> > I imagine I have to modify /boot/grub/device.map,
> > /boot/grub/grub.conf, and
> > /etc/fstab on the /mnt/vdy1 filesystem, and then run some grub
> > commands.
> >
> > Thanks in advance for any pointers and guidance.
> >
> > Regards,
> > - Robert
> > _______________________________________________
> > PLUG mailing list
> > PLUG at pdxlinux.org
> > http://lists.pdxlinux.org/mailman/listinfo/plug
>
> _______________________________________________
> PLUG mailing list
> PLUG at pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>



More information about the PLUG mailing list