help-grub
[Top][All Lists]
Advanced

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

Re: How to install grub onto an added drive?


From: sashab
Subject: Re: How to install grub onto an added drive?
Date: Mon, 18 Nov 2019 20:44:25 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

Hi Chris,

fist of all: A fresh install will be much less pain ;)

If you'd like to do it all manually,
let's assume you have
    /dev/sda - "old" SSD
    /dev/sda1 - /boot
    /dev/sda2 - /
    /dev/nvme0 - "new" SSD

Moving '/' to new device:
You'll have to boot a "live system" from a CD,
to copy your rootfs.
It would be better to create a new fs on /dev/nvme0p?
and rsync all files.
After this you look the UUID of your "new" rootfs up
(e.g. with blkid) and change the /-mount in /etc/fstab accordingly.
sync, reboot and if it comes up and you see "/dev/nvme0p? ... on /" in
`mount`, your're gold.


If you have no separate boot partition, you'll have to create one and
mark it bootable and create a fs on it (ext2 is sufficient).
Then, rsync the contents of /boot to the new fs (especially kernel and
initramfs).
After doing so, create an appropriate entry in /etc/fstab and mount the
partition.
If we assume it's /dev/sda1, then you have to
    grub-install --target i386-pc /dev/sda
    grub-mkconfig
If both commands give you no warnings/errors,
the system should be able to boot from your newly created partition.
However, you'll need to
    dpkg-reconfigure grub-pc
(or however the package's name is on xubuntu)
so that future updates of grub get installed on the right drive.

Hth
    sashab

On 11/18/19 10:55 AM, Chris Green wrote:
> On Sun, Nov 17, 2019 at 03:27:36PM -0800, Randy Goldenberg wrote:
>> On Sunday November 17, 2019, Chris Green wrote:
>>
>> [...]
>>
>>> I want to add a new SSD to my current desktop system.  This in itself
>>> isn't a major problem, I've done similar things before without
>>> problems (in fact I did this already with the current small and
>>> relatively slow SATA SSD that has the / filesystem on it).  The issue
>>> is that I suspect the motherboard won't be able to boot from the new
>>> NVME/PCIe SSD so I'm aiming to have a small, bootable drive to just
>>> provide the boot files and have everything except for /boot on the
>>> new, fast, SSD.
>>>
>>> So, I can move all the required OS files to the new hard disk but how
>>> do I get grub installed on whatever I have as a 'small' boot disk?
>>
>> Someone willing to help would need to know if you're using legacy BIOS
>> booting, or UEFI.
> 
> Ah, oops, yes a rather basic piece of information.  It's traditional
> BIOS.  Doesn't the BIOS need to be 'UEFI aware' if one is going UEFI?
> 
> 
>>>
>>> Basic questions:-
>>>
>>>    Presumably the disk where the /boot filesystem is has to be marked
>>>    bootable using fdisk.
>>
>> That depends on how you're booting.  Legacy, or UEFI?
> 
> Legacy.
> 
> 
>>>
>>>    How do grub-install and grub-mkconfig relate to each other?  Which
>>>    do I run first?  Do I need to run both?  What do I need to tell
>>>    them (parameter-wise)?
>>
>> grub-install installs grub.  grub-mkconfig writes a grub.cfg file, read by
>> grub at boot time.  Parameters are explained in "info grub".
> 
> Yes, I have worked through "info grub" quite a bit, the details are
> there but there's not much overview as it were.
> 
> 
>>>
>>>    Is there anything else I need to do?
>>>
>>>    I guess I need to run grub-install and grub-mkconfig on the system
>>>    as I want it configured, i.e. with the new/small disk waiting for
>>>    grub to be installed on /boot.  So, this feels a bit risky as,
>>>    until grub has been installed there the system won't [re]boot.
>>>    What's the best way to make sure I have a 'get out' if it all goes
>>>    pear shaped?
>>
>> Back up your system.
>>
>> https://www.clonezilla.org/
> 
> My data is well backed up, if it all goes *really* pear shaped I will
> simply re-install the OS from scratch and restore all my data.  I was
> hoping for 'intermediate' disaster recovery to get back to a bootable
> system without having to restore everything.
> 
>>>
>>> Yes, I know that question about grub-install and grub-mkconfig seems
>>> rather naive but I have to say none of the tutorials, man pages or
>>> other help that I could find actually clarified this.
>>
>> See "info grub".
>>
> See above! :-)
> 
> 
>> Your description of your situation suggests that you are using legacy BIOS
>> booting.  If that is the case, in the absence of limiting circumstances, I
>> strongly recommend moving to UEFI.
>>
> As I asked above, does the BIOS have to be UEFI aware to move to UEFI?
> 



reply via email to

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