LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-15-2011, 01:44 AM   #1
danost
LQ Newbie
 
Registered: Jun 2007
Location: Canada & Israel
Posts: 7

Rep: Reputation: 0
How to Backup GRUB


Looking for a GUI based tool to backup and restore GRUB to / from another hard drive, or CD, or USB stick. I have a few Linux distros on one hard drive.

Thank you
Dan
 
Old 05-15-2011, 02:34 AM   #2
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora
Posts: 1,841

Rep: Reputation: 260Reputation: 260Reputation: 260
I'm not aware of any tool like that. Usually, you just reinstall grub. There isn't much to it. You might back up the /boot/grub directory to external media. There could be some use to that.
 
Old 05-15-2011, 04:29 AM   #3
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 291Reputation: 291Reputation: 291
See this tutorial for how to reinstall grub2 to the master bot recordd (MBR) from the Ubuntu live CD:
https://help.ubuntu.com/community/Gr...ing%20GRUB%202
The first method there titled simplest should work just fine.
Read the entire tutorial to learn just about everything you would ever want to know about grub2.

Last edited by tommcd; 05-15-2011 at 04:31 AM.
 
Old 05-16-2011, 03:15 AM   #4
danost
LQ Newbie
 
Registered: Jun 2007
Location: Canada & Israel
Posts: 7

Original Poster
Rep: Reputation: 0
Thank you for this. My concern remains, what it seems that is referred to at the link your provided is for the boot info for a particular a particular Linux install. I have several installs on one hard drive, so I've set things such that the boot info is in the MBR of the hard drive, not in a particular Linux install. Thus I presume that backing up from inside a particular Linux install will not backup the MBR for all installs.
If you have any ideas on this, please do post again.
Thanks again
Dan
 
Old 05-16-2011, 05:38 AM   #5
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
When you install grub it should list all the distros, but may not in some cases. The best thing is to make a copy of your grub.cfg file.
 
Old 05-16-2011, 09:41 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by danost View Post
I have several installs on one hard drive, so I've set things such that the boot info is in the MBR of the hard drive, not in a particular Linux install.
Are you using GRUB or GRUB2? Assuming GRUB, there's a nice explanation here which describes how the MBR is only 446 bytes long so can do very little; it contains GRUB stage 1; when GRUB stage 1 is installed to the MBR it is configured with the block address of the file to load for the next stage of GRUB (stage 1.5 when the root file system is an "exotic" type, directly to stage 2 otherwise). This is why the usual advice is to "re-install GRUB".

A conventional arrangement is to have a single /boot file system for GRUB. It contains files the GRUB stages beyond 1 and the GRUB configuration, including "the boot info". For convenience the /boot file system can be mounted by all the installs, allowing you to read/modify it when they are running but it does not have to be this way -- just as long the file system used by GRUB is a "non-exotic" file system type (from GRUB's perspective).

The difficulty about backing up GRUB is that stage 1, in the MBR, needs to know the block address of the file for the next stage. If that file is restored by a file-level restore, it is unlikely to be put in the same place, that is at the same block address on the HDD.

In theory (not tested), one way to do this, assuming a separate /boot file system at the start of the drive, is a block level copy of the HDD from the beginning to the end of the /boot file file system using dd. Normally dd cannot be used to backup mounted file systems because they may be changing while they are copied and an inconsistent image would be recorded. In the case of the /boot file system this should (TM) not apply because it is only changed during kernel installs and GRUB customisation.

Such a block-level copy would also copy the partition table; if the partition table was changed between the copy and the restore then it would point to some wrong locations. In practice the chances of this happening could be mitigated (not eliminated!) by an automated backup run frequently or by sysadmin discipline to run the backup immediately after changing the partitions.
 
Old 05-18-2011, 01:17 AM   #7
danost
LQ Newbie
 
Registered: Jun 2007
Location: Canada & Israel
Posts: 7

Original Poster
Rep: Reputation: 0
This is a reply to "catkin". Many thanks for your well thought out reply. I do not know which version of GRUB I have, its what ever comes with Ubuntu 10.10. If this is GRUB2, then my question still remains on how to back up the complete GRUB, for the two distributions that I have on the one hard drive.

Thank you
Dan
 
Old 05-18-2011, 01:48 AM   #8
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 291Reputation: 291Reputation: 291
Ubuntu 10.10 uses grub2.
You may want to have a look at Super Grub2 Disk: http://www.bootproblems.com/super-grub2-disk/
This is a live CD that can detect and repair and reinstall grub2 for any operating system.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
backup GRUB Windows to Linux Linux - General 3 12-25-2008 10:57 PM
How can i backup and install GRUB styles24 Linux - Newbie 15 03-31-2007 12:08 AM
Backup Grub to USB Stick Jongi Linux - General 6 08-25-2006 09:17 AM
grub floppy backup and restoration chocloman Linux - Software 3 02-02-2006 04:06 PM
How to Backup Grub mayagenesis Linux - Software 1 08-30-2003 01:27 PM


All times are GMT -5. The time now is 03:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration