help-grub
[Top][All Lists]
Advanced

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

Re: How to change /boot disk?


From: Nathan Stratton Treadway
Subject: Re: How to change /boot disk?
Date: Fri, 10 Jan 2020 16:16:17 -0500
User-agent: Mutt/1.5.20 (2009-06-14)

On Fri, Jan 10, 2020 at 21:22:22 +0100, Pascal-liste wrote:
> Le 10/01/2020 à 13:27, Simon Hobson a écrit :
> >Chris Green <address@hidden> wrote:
> >>
> >>So what's the easiest/simplest way to move /boot from one SATA drive
> >>to another?  In my case I want to move it from /dev/sda1 to /dev/sdb1.
> >>There's nothing on either sda1 or sdb1 that needs to be preserved.
> >
> >Several ways cone to mind, but probably what I'd do is :
> >
> >??? partition your current sdb so it has an appropriately sized boot 
> >partition on it - setting flags accordingly (bootable, active, whatever)
> >??? create a new filesystem on it
> >??? copy all the files from your current /boot
> >For this, I'd normally use rsync - a bit overkill but it's my tool for 
> >choice for copies that involve large amounts of stuff or enclosed 
> >directories. "rsync -av /boot /mnt" assuming your new boot is mounted on /mnt
> >??? Get the new UID for the filesystem and edit your fstab
> >
> >Shutdown the system cleanly, remove your old spinning disk, see if it boots
> 
> It won't boot, because GRUB is not installed on the new boot disk
> and grub.cfg is not updated with the new /boot UUID. Several steps
> are required before rebooting.
> 
> Unmount the old /boot.
> Mount the new /boot.
> Install GRUB on the new boot disk with grub-install /dev/sdb.
> Update grub.cfg with update-grub.
> Now you can reboot.


(Chris), since you are running Xbuntu, I think you can replace those
grub-install and update-grub steps with "dpkg-reconfigure grub-pc", to
allow Ubuntu's package-install script to both install the grub
bootloader and to update the grub.cfg file (while also making sure the
package is configured to update the correct drive when the grub package
is upgraded in the future).

You would do this after copying the old /boot filesystem to the new
filesystem, then unmounting the old one and mounting the new one on top
of /boot (and updating /etc/fstab to reflect the UUID of the new
filesystem).

(Before running the reconfigure I'd save a copy of /boot/grub/grub.cfg
to grub.cfg_from_500Gb_SATA_drive or whatever you want to name it.)

The config script should prompt you for a list of devices onto which
Grub should be installed; in your case you want to make sure the device
currently referred to as sdb (the 120GB drive) is selected (since that
will be your only BIOS-recognized disk once you remove the sda drive). 
This should install grub on the MBR in such a way that it will
auto-detect the (new) /boot filesystem by UUID no matter whether it's on
the "first" or "second" BIOS drive.... and also update the grub.cfg file
so the entries to reference the new boot partition instead of the old
one.

When that's done, compare the new grub.cfg with your
grub.cfg_from_500Gb_SATA_drive copy and make sure the changes make
sense... then try rebooting (making sure that the BIOS boots from the
120GB drive rather than the 500GB drive).  If that works, then
(hopefully) you are set to remove the 500GB from the system.

                                                Nathan

----------------------------------------------------------------------------
Nathan Stratton Treadway  -  address@hidden  -  Mid-Atlantic region
Ray Ontko & Co.  -  Software consulting services  -   http://www.ontko.com/
 GPG Key: http://www.ontko.com/~nathanst/gpg_key.txt   ID: 1023D/ECFB6239
 Key fingerprint = 6AD8 485E 20B9 5C71 231C  0C32 15F3 ADCD ECFB 6239



reply via email to

[Prev in Thread] Current Thread [Next in Thread]