Create grub2 backup

Kernels & Hardware, configuring network, installing services

Create grub2 backup

Postby fant0mask » 2018-01-30 09:34

I've installed my debian along a version of Windows 10. I have encrypted my debian lvm volume with luks. The grub2 boot file I installed on a USB stick. I would like to make a exact copy of the USB stick containing the grub2 in case if I loose my existing one.
Can anyone guide me how to achieve this, as I have tried numerous tutorials but I was unable to fully complete it.
Thanks
fant0mask
 
Posts: 2
Joined: 2018-01-30 09:25

Re: Create grub2 backup

Postby Head_on_a_Stick » 2018-01-30 10:16

fant0mask wrote:I have tried numerous tutorials but I was unable to fully complete it

You should list all of the methods you have already tried (along with full, verbatim error messages in the case of failure) in order to prevent duplication of effort by those who chose to assist you.

I would use
Code: Select all
# cp /dev/sdX /dev/sdY ; sync

Did you try that?
E Pluribus Unix
User avatar
Head_on_a_Stick
 
Posts: 7777
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Create grub2 backup

Postby fant0mask » 2018-01-30 12:11

Thank you for your reply.
I have tried to execute
Code: Select all
 # cp /dev/sdX /dev/sdY ; sync


After booting, I get the following error:
Code: Select all
error: attempt to read or write outside of partition
Entering rescue mode...
grub rescue>


I have tried to:
Code: Select all
set root=(hd0,msdos1)
set prefix=(hd0,msdos1)/boot/grub
insmod normal


and after I get again the error: attempt to read or write outside of partition
fant0mask
 
Posts: 2
Joined: 2018-01-30 09:25

Re: Create grub2 backup

Postby Head_on_a_Stick » 2018-01-30 17:35

OK, a few things:
  • Did you actually type "/dev/sdX" & "/dev/sdY"? That won't work.
  • Was stick Y at least as big (if not bigger) than stick X?
I've never used LVM or LUKS so I'm probably missing some important detail.

Is your system UEFI?

How _exactly_ did you do this:
The grub2 boot file I installed on a USB stick

If this is a non-UEFI system on an msdos partition table then I think you only need the first 447 bytes of the MBR on the stick to boot.

The `cp` command should do that but you could save time by using dd(1) instead.
E Pluribus Unix
User avatar
Head_on_a_Stick
 
Posts: 7777
Joined: 2014-06-01 17:46
Location: /dev/chair


Return to System configuration

Who is online

Users browsing this forum: No registered users and 7 guests

fashionable