LWN.net Logo

Grub From the Ground Up (Troubleshooters.com)

Troubleshooters.com takes a look at Grub. "Grub is a world-class boot loader with insufficient documentation. In many ways it blows the doors of LILO. For instance, it's MUCH easier to use Knoppix to rebuild a grub boot loader than to rebuild a LILO boot loader. However, until you're comfortable with grub, it might seem just the opposite. All too often grub dumps you at a grub> prompt with no hint of what you should do. You might have heard that a successful reboot is just three commands away, but which commands? The state of grub's documentation is such that you can't figure it out unless you already know grub."
(Log in to post comments)

Grub From the Ground Up (Troubleshooters.com)

Posted Mar 14, 2005 21:50 UTC (Mon) by roskegg (subscriber, #105) [Link]

Grub was the first bootloader to make it easy to migrate your system from your old hard drive to a newer hard drive without going and doing a fresh install. Find out how to do a disk migration without using any floppy disk, cdrom drive, or special bit fiddling in the article here: http://reactor-core.org/disk-migration.html

Grub From the Ground Up (Troubleshooters.com)

Posted Mar 14, 2005 23:21 UTC (Mon) by JoeBuck (subscriber, #2330) [Link]

Looks like the guy who wrote that document doesn't know about GNU tar's --one-file-system flag (so he thinks he needs to build exclusion lists to keep from copying the proc filesystem and mounted disks).

Grub From the Ground Up (Troubleshooters.com)

Posted Mar 14, 2005 23:41 UTC (Mon) by ballombe (subscriber, #9523) [Link]

Look like you are a GNU/Linux afficionado then: this document state that:

"The version of GNU Tar that comes with the BSD's and any recent GNU/Linux will work; other tars may, but I have not tested them. GNU/Linux afficionados will note that some of the zoomier features of GNU tar are not used here; that is because the free BSD's use an older version of GNU tar."

(This document is dated Oct. 2000.)

Grub From the Ground Up (Troubleshooters.com)

Posted Mar 15, 2005 0:02 UTC (Tue) by roskegg (subscriber, #105) [Link]

Look closer; the example disk migration in the article assumed there were three different partitions that needed copying. At one filesystem per partition, that is hardly a candidate for use of the --one-filesystem option to tar.

Back in the old days, we used separate partitions for stuff; we didn't have one huge gigantic root partition.

Grub From the Ground Up (Troubleshooters.com)

Posted Mar 15, 2005 0:39 UTC (Tue) by JoeBuck (subscriber, #2330) [Link]

I don't understand your criticism. You want to copy each source partition to a different destination partition. To do this, you can use one tar command for each partition copy.

Grub From the Ground Up (Troubleshooters.com)

Posted Mar 15, 2005 0:49 UTC (Tue) by roskegg (subscriber, #105) [Link]

Sure. You can do multiple tar commands. Or you make up the list of excludes once, then reuse it each time you upgrade your harddrive. Fewer commands to type means fewer commands to mess up.

Grub From the Ground Up (Troubleshooters.com)

Posted Mar 15, 2005 1:46 UTC (Tue) by brouhaha (subscriber, #1698) [Link]

Sure, but if you want to do a single tar of three filesystems, it's even easier to just say something like "tar -clf - /etc /usr /var".

Grub From the Ground Up (Troubleshooters.com)

Posted Mar 15, 2005 7:53 UTC (Tue) by kasperd (guest, #11842) [Link]

Why even use tar? I find a simple cp -a easier to use. (Unless I need to transfer it across a network, in which case tar is my prefered way to serialize the data).

Grub From the Ground Up (Troubleshooters.com)

Posted Mar 15, 2005 17:34 UTC (Tue) by ceswiedler (subscriber, #24638) [Link]

Aren't there some issues with permissions, devices, setuid bits, etc when using cp -a? I've been bit by that stuff before. I think tar handles these cases better.

Grub From the Ground Up (Troubleshooters.com)

Posted Mar 17, 2005 21:46 UTC (Thu) by kael (subscriber, #1599) [Link]

I have cloned many a system (Linux with Gnu tools) over the years.

Works fine.

Grub From the Ground Up (Troubleshooters.com)

Posted Mar 18, 2005 22:53 UTC (Fri) by haraldt (guest, #961) [Link]

Look up the man pages of "cp". The "-a" switch covers a lot, but you may want to add some more.
One silly little detail: "cp" isn't allowed to copy all the settings when not running as root.

Grub From the Ground Up (Troubleshooters.com)

Posted Mar 17, 2005 15:27 UTC (Thu) by grouch (guest, #27289) [Link]

>"Grub was the first bootloader to make it easy to migrate your system from your old hard drive to a newer hard drive without going and doing a fresh install."

Does GRUB pre-date LILO, then? Why would you do a fresh install just to migrate from one hard drive to another?

See http://www.tldp.org/HOWTO/Hard-Disk-Upgrade/index.html

I've used that since the days when it was a mini-HOWTO on the old linuxdocs site.

Good to know: Grub boots from sw-raid1 ...

Posted Mar 15, 2005 10:11 UTC (Tue) by kaeptnb (subscriber, #14098) [Link]

Just wanted to mention that grub is capable of booting from a md-device (sw-raid), if it's a raid1 ...

Thats great, because otherwise you had to make /boot and e.g. /boot2 on both of you're harddisks, and somehow syncronize these whenever a new kernels comes into /boot...

Thanks to GRUB :)

Good to know: Grub boots from sw-raid1 ...

Posted Mar 15, 2005 17:57 UTC (Tue) by stuart (subscriber, #623) [Link]

And LILO has been able to do this for years....big deal.

Grub From the Ground Up (Troubleshooters.com)

Posted Mar 16, 2005 7:32 UTC (Wed) by beejaybee (guest, #1581) [Link]

Right on. Guess why this user is still using lilo. I understand it and have no problems getting it to work...

BTW I've migrated systems from one HDD to another on several occasions using basic tools only (cpio) & not had significant problems.

Remote boot

Posted Mar 17, 2005 21:48 UTC (Thu) by kael (subscriber, #1599) [Link]

Would anyone care to comment how GRUB, as of current, works for those of us supporting remote systems?

LILO has been my friend for a long long time in this regard.

Remote boot

Posted Mar 25, 2005 13:51 UTC (Fri) by anton (subscriber, #25547) [Link]

IMO LILO is better especially for remote systems, because the LILO
installer tells you at install time that your lilo.conf is broken (so
you can fix it and rerun the installer), whereas Grub only tells you
that on boot time (and there is no way of checking the Grub config
file (or that you have it in the right place under the right name,
which cost us two hours to find out)); that's already a pain when you
work locally, but it would be a disaster for remote booting.

Other LILO vs. Grub issues:

- The grub-installer does not always work well. I knew the Linux and
BIOS and Grub names of the drives I wanted to specify, but
grub-install insisted that I use the Linux name for one of the drives,
but then failed to translate it to the format it needed, leving me
without a Grub.

- Grub is theoretically less brittle, since it accesses stuff through
file systems and since it has the command line as a fall-back. In
practice I have not had any problems in that direction from LILO.

- Since I use Grub (instead of LILO-20), poweroff powers the machine
down instead of leaving it running.

- (somewhat exotic:) Grub can switch BIOS drives around, LILO-20 could
do that (but the LILO-20 installer I used to use does not work with
the 2.6 kernel), LILO-21 could not; I think LILO-22 can again.

In conclusion: If LILO works for you, stick with it.

Copyright © 2005, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds