Grub command to boot Linux

Source: Internet
Author: User

Because of the curiosity about Linux system, want to press to play on the machine. After a busy night yesterday, Linux was finally installed. But a little too early to be happy, I thought into the Linux is like into Windows so simple, did not think but jumped out a boot command (grub), let me guide, I look numb. It's not a bit. There is no way I can not endure, I shut down the computer to sleep. Today at noon, online search information. To acquaint the command with the other side. But it was a tough look. Tried a few times or not. I didn't get it. Ben was going to give up. I didn't expect to be inspired in the afternoon. Knock on a few commands and go in.

This installation has made me learn a lot. Here is the main talk in grub down to boot Linux;

The steps are as follows;

A enter the Grub command mode.

b Familiarize yourself with some of the grub commands first Grub>help

C Familiar with cat commands

d root command to specify the partition where/boot is located

e kernel instructions to specify the Linux kernel, and the partition in which it resides

F Use the INITRD command to specify the INITRD file

G Boot Boot System

Use of the Cat command

The cat instruction is used to view the contents of the file, sometimes we do not know the Linux/boot partition, and/or the location of the root partition, to see/etc/fstab content to know, at this time, we need to use the cat (Hd[0-n],y)/etc/fstab to obtain these content Note to learn to use the TAB key command to complement the function;

Grub> Cat (Press the TAB key to come out hd0 or HD1, etc.;
Grub> Cat (hd0, note: Enter the hd0, and then press the TAB key;
Grub> Cat (hd0,6)
Possible partitions is:
Partition num:0, Filesystem type unknown, Partition type 0x7
Partition num:4, Filesystem type is fat, Partition type 0xb
Partition num:5, Filesystem type is ReiserFS, Partition type 0x83
Partition num:6, Filesystem type is EXT2FS, Partition type 0x83
Partition num:7, Filesystem type unknown, Partition type 0x83
Partition Num:8, Filesystem type is ReiserFS, Partition type 0x83
Partition num:9, Filesystem type unknown, Partition type 0x82

Grub> Cat (hd0,6)/etc/fstab Note: For example I would like to check (hd0,6)/etc/fstab The contents of this input;

label=//ext3 Defaults 1 1
/dev/devpts/dev/pts devpts gid=5,mode=620 0 0
/DEV/SHM/DEV/SHM TMPFS Defaults 0 0
/DEV/PROC/PROC proc Defaults 0 0
/dev/sys/sys Sysfs Defaults 0 0
LABEL=SWAP-HDA1 swap swap defaults 0 0
/dev/hdc/media/cdrecorder Auto Pamconsole,exec,noauto,
Managed 0 0

Main view of the content in the/etc/fstab, mainly Linux/partition and/boot is a separate partition, if there is no/boot similar line, proof/boot and Linux/on the same hard disk partition, such as the above example label=/this line is extremely important ; The Linux system is in a partition labeled label=/;

If your Linux system/boot and/are not on the same partition, Cat (hd[a-n],y) may have found something similar to the following;

LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2

root (hd[0-n,y) 指令来指定/boot所在的分区;

In fact, this root (hd[0,n],y) can be omitted, if omitted, we have to specify in the KERENL command, we have already said (Hd[0-n],y) The use of the hard disk partition representation, mainly used to specify the partition of/boot;

eg

grub> root (hd0,0)

kernel 指令,用来指定Linux的内核,及/所在的分区;

Kernel This instruction may be a beginner a little afraid, do not know which partition the kernel, and the full name of the kernel file name. Do not forget the TAB key command to complement the application;

If we have specified the/boot partition by root (hd[0-n],y), there are two syntax:

If/boot and Linux are in the same partition, it should be in one of the following formats;

Kernel/boot/vmlinuz Here Press the TAB key to make up, see the kernel full name of the RO root=/dev/hd[a-z]x

If/boot has its own separate partition, it should be;

Kernel/vmlinuz Here Press the TAB key to make up, see the kernel full name of the RO root=/dev/hd[a-z]x

Here root=/dev/hd[a-z]x is the partition where the Linux/root is located, if you do not know which partition it is, use tab-out to calculate, one by one, or use Cat (hd[0-n],y)/etc/fstab to get Linux/ The label of the partition or partition in which it resides;

grub> kernel /boot/在这里按tab键;这样就列出/boot中的文件了; 
Possible files are: grub initrd-2.6.11-1.1369_FC4.img System.map-2.6.11-1.1369
_FC4 config-2.6.11-1.1369_FC4 vmlinuz-2.6.11-1.1369_FC4 grubBAK memtest86+-1.55
.1 xen-syms xen.gz

grub> kernel /boot/vmlinuz-2.6.11-1.1369_FC4 ro root=LABEL=/  
   [Linux-bzImage, setup=0x1e00, size=0x18e473]

Note: root=label=/is the label of the file system of the Linux/partition, and if you know the specific partition of Linux/in which it is located, use Root=/dev/hd[a-z]x to specify the line. For example, the following line is also possible;

grub> kernel /boot/vmlinuz-2.6.11-1.1369_FC4 ro root=/dev/hda7

You can also omit the specified root (hd[0-n],y) of the partition in which the/boot is located, and specify the partition of/boot in the kernel directly, so it is in the following syntax;

If this is the same partition AS/boot and Linux root;

kernel (hd[0-n],y)/boot/vmlinuz ro root=/dev/hd[a-z]X

Like what:

grub>kernel

If the root of/boot and Linux is not in a partition;

kernel (hd[0-n],y)/vmlinuz  ro root=/dev/hd[a-z]X grub> kernel (hd0,0)/boot/vmlinuz-2.6.11-1.1369_FC4 ro root=/dev/hda7 
   [Linux-bzImage, setup=0x1e00, size=0x18e473]

or the following input, the cat out of the/etc/fstab content prevail;

grub> kernel (hd0,0)/boot/vmlinuz-2.6.11-1.1369_FC4 ro root=LABEL=/
   [Linux-bzImage, setup=0x1e00, size=0x18e473]


INITRD the command line to specify the INITRD file;

grub> initrd /boot/initrd在这里tab 来补齐;
grub> initrd /boot/initrd-2.6.11-1.1369_FC4.img
   [Linux-initrd @ 0x2e1000, 0x10e685 bytes]

If/boot is a separate partition, the syntax should look like this;

grub> initrd /initrd在这里tab 来补齐;
grub> initrd /initrd-2.6.11-1.1369_FC4.img
   [Linux-initrd @ 0x2e1000, 0x10e685 bytes]



Boot boot system;

grub>boot 下面是在我机器上的命令: grub> Cat (hd0,0)/etc/fstab
# This file was edited by Fstab-sync-see ' Man Fstab-sync ' for details
label=//ext3 Defaults 1 1
/dev/devpts/dev/pts devpts gid=5,mode=620 0 0
/DEV/SHM/DEV/SHM TMPFS Defaults 0 0
/DEV/PROC/PROC proc Defaults 0 0
/dev/sys/sys Sysfs Defaults 0 0
LABEL=SWAP-HDA1 swap swap defaults 0 0

/dev/hdc/media/cdrecorder Auto pamconsole,exec,noauto,managed 0 0

grub> Root (hd0,0)
Filesystem type is EXT2FS, partition type 0x83

grub> kernel/boot/Press TAB here to complete the full list of/boot files;
Possible files Are:grub initrd-2.6.11-1.1369_fc4.img system.map-2.6.11-1.1369_fc4 config-2.6.11-1.1369_fc4 Vmlinuz-2.6.11-1.1369_fc4
memtest86+-1.55.1 xen-syms xen.gz

grub> kernel/boot/vmlinuz-2.6.11-1.1369_fc4 ro root=label=/
[Linux-bzimage, setup=0x1e00, size=0x18e473]

grub> initrd/boot/Press TAB here to complement
Possible files Are:grub initrd-2.6.11-1.1369_fc4.img system.map-2.6.11-1.1369_fc4 config-2.6.11-1.1369_fc4 VMLINUZ-2.6.11-1.1369_FC4 Grubbak
memtest86+-1.55.1 xen-syms xen.gz

grub> initrd/boot/initrd-2.6.11-1.1369_fc4.imgNote: Enter the full name of the INTRD file name;
[Linux-initrd @ 0x2e1000, 0x10e685 bytes]

grub> Boot
以上也就这么多,还须自己多揣摩

Grub command to boot Linux

Related Article

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.