2008-08-29

GRUB…? It's for Linux

Still first course installation of Linux and confused to do I uninstall the format's computer directly, so great it would pass the boot again window that has been installed there was error in the GRUB not found what I of GRUB and try to see what benefits I get from this Zaki math: Good Reading)

GRUB, the Grand Unified Boot Loader, such as LILO, can memboot your Linux system, maintain and treat the booting and loading on your kernel. GRUB has many more features and easy to use, reliable and flexible compared with LILO. Drawing with basic knowledge LILO and partition the disk so you can use the GRUB this well.
In addition to Linux, GRUB can also memboot other Operating System, such as NetBSD, OpenBSD, the GNU Hurd, DOS, Windows 95, 98, Me, NT, and 2000. Although membooting an Operating System is a job that is not normal and interesting, the work is actually quite important. Boot Loader If you do not work well, you can be locked / trapped in your system (can not booting).
For me, GRUB Boot Loader is a reliable, as an example of the GRUB Linux kernel can be read directly from the partition minix, FAT, ext2, or Reiserfs. From my long-winded explain opportunities GRUB and LILO compares with the one we will start using GRUB this way.

I will start with a Linux OS that is currently still use LILO and GRUB not install at all. We can download the tarballs GRUB the latest version of the ftp://alpha.gnu.org/gnu/grub. At the time of writing this article I use GRUB version 0.5.96.1 (grub-0.5.96.1.tar.gz). Do not afraid to menginstallnya, boot records you will not be changed. We will mengkompile and install GRUB as other programs on umumnya.Kita can make a GRUB bootdisk, once again do not worry. I will tell before we do anything that can change the boot process.
I will put the source code and mengkompilenya in the directory / tmp, and then install everything in the directory / usr. As root, type the command as follows:
# Cd / tmp
# Tar xzvf / direktori/tarball/grub/berada/grub-0.5.96.1.tar.gz
# Cd grub-0.5.96.1
#. / Configure-prefix = / usr
# Make
# Make install
Now GRUB has been installed and we will start with putting the boot loader on a diskette.

Make Bootdisk
To make bootdisk, we will use some simple steps. First we will create an ext2 file system on a diskette, which will be used, and after that we mount to the system and copy some files to a floppy GRUB and then run the program "GRUB" that keep all the settings on the boot diskette records.
Enter a blank floppy, then type the following command:
# Mke2fs / dev/fd0
which means to make (format) file system ext2 on the diskette. Looks like Figure 1.

Figure 1. Formatting a disk with ext2.

Now we will make some directory and copy critical files (which have been installed at the GRUB is installed)
# Mkdir / mnt / floppy / boot /
# Mkdir / mnt / floppy / boot / grub /
Then copy the files stage1 and stage2 in the directory / usr/share/grub/i386-redhat / (if at the time to install Red Hat 7.2 select options GRUB Loader) and / usr/share/grub/i386-pc / (if it was install directly from the tarball GRUB)
# Cp / usr/share/grub/i386-redhat/stage1 / mnt / floppy / boot / grub
# Cp / usr/share/grub/i386-redhat/stage2 / mnt / floppy / boot / grub
Stay for longer we will have bootdisk working properly.
When you install the appropriate instructions at the top of a tar ball GRUB, the program is interesting that called grub is located in the directory / usr / sbin / grub. It is very interesting, because in fact, this program offers the same functions as the GRUB Boot Loader. Yes! Although Linux is already running, you can run GRUB, and can do the job command interface and the same when you use the GRUB boot disk or menginstallkan GRUB on the MBR in your Hard Disk.
We will use the program for the grub set up the boot sector on the boot disk us. Run grub, it will exit the display as follows ...

# / Usr / sbin / grub

GRUB version 0.90 (640K lower / upper memory 3072K)
[Minimal Bash-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device / filename. ]
grub>

Version of the above depending on the version of the GRUB installed in the system. If we install the tarballs we will see the difference version (Example tarballs this version 0.5.96.1). If we choose the option when installing Red Hat 7.2 version of the GRUB using version 0.90, as we see above.
grub> -> It is a command prompt grub / grub console.
If the grub we console type:
grub> root (fd0)
It will then display the information out as follows:

File type is ext2fs, using whole disk
which means that the devices fd0 File (/ dev/fd0) or floppy all its contents using ext2. The "root" was ask to see the GRUB stage1 and stage2 on fd0 devices, which in defaultya see in the GRUB boot / grub / partition on the disk that you specify (ie the device fd0).
We just copying files to the appropriate directory. Then we will ask to install GRUB Boot Records in the floppy diskette with us using the "setup (device)" in the GRUB console.
grub> setup (fd0)
the view that:

Checking if "/ boot/grub/stage1" exists ... yes
Checking if "/ boot/grub/stage2" exists ... yes
Checking if "/ boot/grub/e2fs_stage1_5" exists no ...
Running "install / boot/grub/stage1 d (fd0) / boot/grub/stage2 p / boot / grub / grub. Conf" Done ... Johnson Space Center.

Then the "quit" in the GRUB console to exit. Thus, we already have the GRUB boot disk that we will "play" to experiment more :-).
grub> quit
When you use GRUB Boot Loader as you, first make sure you know the partition where you save the kernel Linuxnya name and the partition that contains the root filesystem "/". Also make sure you see the LILO configuration, like some of the arguments that the need for mempassingkan arguments to the kernel, such as "append = ide-scsi" to mengemulasikan presence cdwriter as scsi, and the argument - an argument the other. If we already know all this information, we will start quietly.

Starting GRUB
To start the GRUB, we will shutdown the computer, and memboot from the boot disk that was created earlier. But if you want to run it from the system that has been running. You can run grub such as the above, all will be running the same, but you will not be what memboot it from here (because the system is running Linux).
When Memboot from bootdisk that we created earlier, GRUB will seek information from the BIOS and find the file that we have a copy delivered to the bootdisk before. The view will be the same as we run the above:

GRUB version 0.90 (640K lower / upper memory 3072K)
[Minimal Bash-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device / filename. ]
grub>

As you can see all the same as above, but we will memboot Linux System you from here.
In Linux, when we talk about the "root" filesystem, we will appointed directly to the main Linux partitions (/). But GRUB has its own definition of partition "root". Partition "root" GRUB is the partition that you save the Linux kernel. This may or not the file system root "normal" that you have. In the example, on Gentoo Linux partition we have a small, separate to save the Linux Kernel and information - information Booting. We leave this partition is not mounted, so will not fall apart if accidentally or intentionally system is suddenly crashes or mereboot back.
Now we are in the GRUB, we will show the location of the root. When we enter the root partition by memountnya GRUB will be read-only option, so can mengload Linux Kernel from there. One thing that is really fantastic in the GRUB GRUB is able to read FAT partitions, minix, ext2, FFS and Reiserfs.
Type the command root in the GRUB
grub> root (
Press the button TAB, will likely fill the disk partition that you have. If you have multiple partitions starting from hd0 (not the / dev / hda as usual). If you only have one hard drive, the GRUB will be filled with "hd0". If you have more than one hard drive please select the hard drive that is the kernel linuxnya, for example, "hd0" followed with a comma "," next to it. Up here do not press [Enter]!
grub> root (hd0,
Then press [Tab] to see the possibility of partitioning the hard drive you have in it.
grub> root (hd0, [Tab]

Possible partitions are:
Partition NUM: 0, Filesystem type is ext3fs, partition type 0 × 83
Partition NUM: 1, Filesystem type unknown, partition type 0 × 82
Partition NUM: 2, Filesystem type unknown, partition type 0 × 7
Partition NUM: 4, Filesystem type is reiserfs, partition type 0 × 83
Partition NUM: 5, Filesystem type is the GNU Hurd, partition type 0 × 63

Of course, the appearance will vary in accordance with the partition on your hard drive. On Linux, usually from 5 to partition the hard drive hda5, but on the other GRUB defined, namely (hd0, 4). GRUB use the naming / labeling hard disk partitions and started from 0, not a or 1.
We will memboot hard drive containing the Linux Kernel, as for example in the partition to -5,
grub> root (hd0, 0) [Enter]
File type is ext3fs, partition type 0 × 83
Then specify the location of the kernel. You put it in accordance with the location of the Linux kernel.
grub> kernel / boot/vmlinuz-2.4.7-10 ro root = / dev/hda5
Means the kernel is called vmlinuz-2.4.7-10 and located in the directory / boot, with mounting read-only to the root "/" in / dev/hda5.
You can add your kernel parameters such as the "root = / dev/hda5" and "mem = 256."
Note: kernel parameters "root =" is defined important to show you the root filesystem.
You have to mount the root filesystem, and load your Linux kernel. When you memboot your linux kernel, with a simple command using the "boot".
grub> boot
and the Linux boot process will begin.
GRUB configuration file (grub.conf) in the directory / boot / grub /. The following examples of the contents of grub.conf:

# Grub.conf generated by anaconda #
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a / boot partition. This means that
# All kernel and initrd paths are relative to / boot /, eg.
# Root (hd0, 0)
# Kernel / vmlinuz-version ro root = / dev/hda5
# Initrd / initrd-version.img
# boot = / dev / hda
Default = 0
timeout = 10
splashimage = (hd0, 0) / grub / splash.xpm.gz
title Red Hat Linux (2.4.7-10)
root (hd0, 0)
kernel / vmlinuz-2.4.7-10 ro root = / dev/hda5
initrd / initrd-2.4.7-10.img

The file is created during installation with Anaconda Installer from Red Hat 7.2.
If all goes well, you can load your Linux distribution with a GRUB bootdisk. GRUB is the boot loader should be calculated, because you can dynamically configure / change according to your wishes. Furthermore, the authors show how to create Loader GRUB menu of your typing 3 GRUB command line. But before that let us deepen our knowledge about the workings of GRUB.

How to Work GRUB
To set up the boot floppy, we do 2 things, we first copy 2 files from the directory / usr/share/grub/i386-redhat / to / boot / grub / floppy that berfilesystem ext2 and run the setup program from GRUB.
grub> setup (fd0)
Install GRUB loader "stage1" to the boot record on floppy and also configure the "stage1" to mengload to "stage2" directly from the ext2 file system. GRUB actually do this by creating a list that consists of blocks to the floppy containing data "stage2". So "stage1" does not need to know anything about the ext2 filesystem to load "stage2".
However, in some cases, installing the GRUB loader "stage1.5" to boot record after installing a "stage1." Loader "stage1.5" This will create a special "stage2" can be in loads without using a blocklist ancient / long (primitive blocklist), but by using standard-based approach to the path that is more flexible. This ability of the GRUB to identify the structure of the filesystem directly, which can make GRUB powerfull more than LILO. If there Defraksi on file at the bootdisk, directly, stage1 (owing to the ext2 stage1.5) can find stage2. This can not be done by LILO, because LILO is depending on the file folder. This map files must be re-run every time you update your kernel, or move something physical / rough on the disk, although the paths are not changed.
You will be amazed at the same time wonder if you made bootdisk with the FAT file system other than the ext2 file system. Yes! it can be done, because when we run the "setup (fd0)" GRUB will menginstallkan "stage1.5" in accordance with the type of file in the root. Even if there is no place for "stage1.5," GRUB can load stage2 with the way the approach to turn the ancient block-list.

Installing GRUB on the hard drive
Now we have to make bootdisk floppy GRUB, what if we want to menginstallnya in the hard disk? How very simple, we first determine where the root GRUB placed, and then create the directory / boot / grub / GRUB on the root partition. Remember the root of GRUB is not defined with the same root partition on Linux. Then copy the files stage1 and stage2 to the directory / boot / grub /. For example, if the directory / boot / grub / placed / dev/hda4 the root set to "(hd0, 3)"
grub> root (hd0, 3)
Now, living decided whether GRUB will be placed in the MBR? If yes, then put GRUB in the entire disk without partition, as for example in hd0 (/ dev / hda), then run the following command:
grub> setup (hd0)
If you menginstallnya in other partitions, living mentioned in the partition where, for example, on the partition hda5,
grub> setup (hd0, 4)
Now GRUB has been installed. If you memboot system then you will exit the GRUB console display (If you put them in the MBR) as the example above, we now live make a boot menu so that you do not type the command line per line at the top.

Making the GRUB menu
To make the GRUB boot menu, we only make a plain text file named menu.lst and in place in the directory / boot / grub / files between stage1 and stage1, following the example files menu.lst.
Default = 0
timeout = 10
splashimage = (hd0, 0) / grub / splash.xpm.gz
title Red Hat Linux (2.4.7-10)
root (hd0, 0)
kernel / vmlinuz-2.4.7-10 ro root = / dev/hda5
initrd / initrd-2.4.7-10.img

Windows 2000 title
root (hd0, 3)
chainloader 1

In Red Hat 7.2, the files in menu.lst-link to grub.conf.
The following explanation file GRUB boot menu at the top:
The first line, Default boot which will be run (starting from 0 next 1, 2 and so on). The second line, choose the time, if by the time of the set, the default will be selected. The third line (splashimage) to display the boot loader such wallpaper, which can also be replaced with the "color" according to taste, for example:
color white / blue blue / red
The display will drape the GRUB menu.
The next line is the Boot Linux, in accordance with the parameters of-its parameters, the root partition and so forth ... Also can use initrd (initial root disk).
The last line, is working with chainloader memboot (boot record) Windows 2000 on its own partition hda2 and membootnya. This is called a chain lifting with the techniques, GRUB will load to the partition boot record that it's correct and memboot system from there. These techniques work well in Windows and DOS versions of what.
You do not need to re-install GRUB to update the kernel / replace the new version of the kernel or change the location of your partition. You only need to change the file menu.lst. Only if there are some conditions in the GRUB need to re-install, if you will first replace the root filesystem on the GRUB, for example, from ext2 to reiserfs, the second replaces the file if stage1 and stage2 to the latest version.

Quick tips GRUB
GRUB can create a floppy bootdisk while rescuers (rescue disk). If the kernel on your hard drive deliberately / accidentally erased or corrupted, you can call kernelnya in the boot disk and the system will run smoothly. By the way, with a copy of your kernel to the floppy a GRUB bootdisk
# Mount / dev/fd0 / mnt / floppy
# Cp / path / directory / bzImage / mnt / floppy / boot /
# Umount / mnt / floppy
Now you diskette containing the Linux kernel, so you can membootnya in the GRUB console with the way:
grub> root (fd0)
grub> kernel / boot / bzImage root = / dev/hda5
grub> boot
In kernelnya parameters, the root shown to the root of the hard drive.

No comments: