Installation and Use of GRUB

Source: Internet
Author: User

Install and use grub

To explore the highlights of GRUB, you must first download, compile, and install it. But don't be afraid-you won't modify your boot record at all-we just need to compile and install GRUB, just like other programs, in this process we can create GRUB boot disks. Don't worry. I will tell you before modifying the boot process.

The Installation Process of grub is no different from that of common software. you can install grub on your own.

Use of grub

Preparations:

1) format a partition:

Sudo mke2fs/dev/fd02) mount partition sudo mount/dev/fd0/mnt/floppy3) create directory and copy file sudo mkdir/mnt/floppy/boot
Sudo mkdir/mnt/floppy/boot/grub
Sudo cp/usr/share/grub/i386-pc/stage1/mnt/floppy/boot/grub
Sudo cp/usr/share/grub/i386-pc/stage2/mnt/floppy/boot/grub boot disk creation:
4) create a boot disk with grub> root (fd0) // where to find the stage1 and stage2 file
Grub> setup (fd0) // where to install the boot loader
Grub> quit problems:
5) You may be confused about the naming conventions of grub so far, because the naming conventions for Hard Disk/partition used by GRUB are different from those used by Linux. In Linux, the fifth partition of the first hard disk is called "hda5 ". GRUB calls this partition "(hd0, 4 )". GRUB calculates the hard disk and partition numbers from 0. In addition, the hard disk and partition are separated by commas, and the entire expression is enclosed in brackets. Now, let's take a look at the GRUB prompt. If you want to boot the Linux hard drive hda5, enter "root (hd0, 4 )". If you have understood the name of the GRUB Hard Disk/partition, you may need to adjust the current root command line so that it points to the partition that saves the Linux kernel. Enter the command in the following format, and then press Enter:

Grub> root (hd0, 4) (hit enter)
Filesystem type is reiserfs, partition type 0x837) about setup (hd0) Whether GRUB can work if you use FAT instead of the ext2 file system to create a boot disk. Yes, it works because GRUB installs stage1.5 that matches the root file system type when "setup (fd0)" is entered. Even if there is no space to install stage1.5, GRUB can still Mount stage2 by going back to the original block list. Grub install: install grub to your device 8) Use grub to search for and restore the kernel required for system backup startup: sudo mount/dev/fd0/mnt/floppy
Sudo cp/path/to/bzImage/mnt/floppy/boot
Sudo umount/dev/fd0 use the kernel to start grub> root (fd0)
Grub> kernel/boot/bzImage root =/dev/hda5 (change/dev/hda5 to the name of the partition to be booted)
Grub> boot9) grub config needs to use update-grub to update grub. cfg file grub-install: install grub to the corresponding device (Note: it is a device, not a partition)

Recommended reading:

GRUB Bootstrap Configuration File Analysis

How to fix GRUB rescue after an error occurs in Linux Installation

Install GRUB Customizer on Ubuntu 13.04

Repair demonstration after GRUB is damaged

Detailed graph description of creating a GRUB Disk

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.