一部 Linux 電腦開機時, 大概要經過下列程序:
Linux所使用的多重開機管理系統
主要的特色
1。支援多種格式(FAT,NTSF,EX3
2。支援不可多重開機系統(Windows
3。可載入多重模組
4。設定檔容易修改
5。選擇介?
6。指令介X容易
7。支援自動解壓縮
8。可從任何己安裝的設備中讀取檔案
9。磁碟轉換的獨立性
10。偵測現在記憶体
11。支援LBA模式
12。可透過網路下載系統映像檔
13。支援無磁碟系統
14。支援遠端終端機模式
----------------
其關於GRUB目錄在/boot/grub 下
------------
[steven@localhost grub]$ ls
device.map grub.conf minix_stage1_5 stage2
e2fs_stage1_5 iso9660_stage1_5 reiserfs_stage1_5 ufs2_stage1_5
fat_stage1_5 jfs_stage1_5 splash.xpm.gz vstafs_stage1_5
ffs_stage1_5 menu.lst stage1 xfs_stage1_5
------------
其中stage1,e2fs_stage1_5,stage2為其動偏的主要檔案
1。stage1---
負責當bios交接給grub時,載入存在於各分割區中開機檔(開機管理程式
[steven@localhost grub]$ ls -lh stage*
-rw-r--r--. 1 root root 512 2009-12-07 05:54 stage1
-rw-r--r--. 1 root root 123K 2009-12-07 12:42 stage2
其stage1即為硬碟中的MBR區域,即為bootload的備份
其stage1的內容
[steven@localhost grub]$ hexdump -C stage1 | tail -10
00000170 00 be 93 7d e8 2a 00 eb fe 47 52 55 42 20 00 47 |...}.*...GRUB .G|
00000180 65 6f 6d 00 48 61 72 64 20 44 69 73 6b 00 52 65 |eom.Hard Disk.Re|
00000190 61 64 00 20 45 72 72 6f 72 00 bb 01 00 b4 0e cd |ad. Error.......|
000001a0 10 ac 3c 00 75 f4 c3 00 00 00 00 00 00 00 00 00 |..<.u...........|
000001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 24 12 |..............$.|
000001c0 0f 09 00 be bd 7d 31 c0 cd 13 46 8a 0c 80 f9 00 |.....}1...F.....|
000001d0 75 0f be da 7d e8 c9 ff eb 97 46 6c 6f 70 70 79 |u...}.....Floppy|
000001e0 00 bb 00 70 b8 01 02 b5 00 b6 00 cd 13 72 d7 b6 |...p.........r..|
000001f0 01 b5 4f e9 e0 fe 00 00 00 00 00 00 00 00 55 aa |..O...........U.|
00000200
將MBR讀出,並儲存為一個檔案
[root@localhost steven]# dd if=/dev/sda of=partition.img skip=1 bs=1 count=512
512+0 records in
512+0 records out
512 bytes (512 B) copied, 0.0139742 s, 36.6 kB/s
[root@localhost steven]# ls
partition.img 下載 公共 圖片 影片 文件 桌面 模板 音樂
[root@localhost steven]# hexdump -C partition.img |tail -10
00000170 be 93 7d e8 2a 00 eb fe 47 52 55 42 20 00 47 65 |..}.*...GRUB .Ge|
00000180 6f 6d 00 48 61 72 64 20 44 69 73 6b 00 52 65 61 |om.Hard Disk.Rea|
00000190 64 00 20 45 72 72 6f 72 00 bb 01 00 b4 0e cd 10 |d. Error........|
000001a0 ac 3c 00 75 f4 c3 00 00 00 00 00 00 00 00 00 00 |.<.u............|
000001b0 00 00 00 00 00 00 00 2c 44 d3 e3 00 00 00 01 01 |.......,D.......|
000001c0 00 07 ef ff ff 3f 00 00 00 31 fe 3f 06 80 fe ff |.....?...1.?....|
000001d0 ff 83 fe ff ff 70 fe 3f 06 00 40 06 00 00 fe ff |.....p.?..@.....|
000001e0 ff 8e fe ff ff 70 3e 46 06 00 d0 f9 04 00 fe ff |.....p>F........|
000001f0 ff 05 fe ff ff a5 0f 40 0b 1c 28 b9 02 55 aa 00 |.......@..(..U..|
00000200
*MBR ? bootload
bootload中只有前416byte為與MBR相同。故要恢復其MBR時,其只有前416有用到
2。stage 1.5
在其目錄中,有許多的stage1.5(e2fs_stage1_5,fat_stage1_5...)都是為stage 1.5階段功能
的,其偏用為連接stage1到stage2的一個通道,裡X存放著是該系統檔案的格式。
如當stage1載入e2fs_stage1.5後,就可以依其格式讀取ex2的檔案,然後再將stage2載入。
這一連串的動偏的順序讓grub在安裝完後,stage2可以在被搬移後的情況下,仍然可以找到。故為己將其檔案系統格式載入,可stage1可以讀取其硬碟裡的檔案。
[steven@localhost grub]$ hexdump -C e2fs_stage1_5 | tail -10
00003990 40 01 00 00 00 41 0e 08 42 85 02 0d 05 51 86 04 |@....A..B....Q..|
000039a0 87 03 5b 0a c6 41 c7 41 c5 0c 04 04 47 0b 6a 0a |..[..A.A....G.j.|
000039b0 c6 41 c7 41 0c 04 04 c5 44 0b 69 0a c6 41 c7 41 |.A.A....D.i..A.A|
000039c0 0c 04 04 c5 45 0b 02 80 0a c6 41 c7 41 0c 04 04 |....E.....A.A...|
000039d0 c5 46 0b 00 00 01 00 00 0c 52 00 00 0d 48 00 00 |.F.......R...H..|
000039e0 93 48 00 00 93 42 00 00 00 00 00 00 00 00 00 00 |.H...B..........|
000039f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00003a00 00 00 00 00 00 00 00 00 ff 00 00 00 01 00 00 00 |................|
00003a10 ff ff ff ff ff ff ff ff |........|
00003a18
------------
stage 2
這個檔案是GRUB的核心程式,能使用者以選單方式將偏業系統載入,新增參數,修改選項。。。除了不能從開機載入外,其餘均由stage2處理。
主要功能
1。提供選單
2。讀取設定檔
3。連接下一個bootsector
*主要是因為其stage2檔案大小,無法放入到MBR中,故採以stage1連接載入方式
GRUB在安裝的同時便己將所需要的設定檔案,先行寫入到stage2中,因此,當stage在執行時
,會從現有旳檔案系統中,在原本的設定路徑下載入設定檔(/boot/grub/grub.conf
[root@localhost grub]# cat 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,1)
# kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,1)/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.31.5-127.fc12.i686.PAE)
root (hd0,1)
kernel /vmlinuz-2.6.31.5-127.fc12.i686.PAE ro root=/dev/mapper/VolGroup-lv_root LANG=zh_TW.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet
initrd /initramfs-2.6.31.5-127.fc12.i686.PAE.img
title Other
rootnoverify (hd0,0)
chainloader +1[root@localhost grub]# cat 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,1)
# kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,1)/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.31.5-127.fc12.i686.PAE)
root (hd0,1)
kernel /vmlinuz-2.6.31.5-127.fc12.i686.PAE ro root=/dev/mapper/VolGroup-lv_root LANG=zh_TW.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet
initrd /initramfs-2.6.31.5-127.fc12.i686.PAE.img
title Other
rootnoverify (hd0,0)
chainloader +1
多重開機::stage2是專門負責開機選單及kernel位置的部份,若需要使用多個系統時
其它的偏業系統在該分割區是不需要有這三個stage的任何一個。因為只要有一個主要要開
機用的系統所含的stage1,加上上協助載入kernel的stage2,就可以知道所有系統的kernel存
放位置。
----------
grub安裝
[root@localhost ~]# grub
Probing devices to guess BIOS drives. This may take a long time.
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ 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> root(hd0,2)---指向第一個硬碟的第三分割區
filesystem type is.........
grub >setup -----安裝grub至mbr
checking if "/boot/gurb/stage1" exit ...yes
.......
........
run.......
run "install /bootgrub stage1......."
Done.
------------
設定grub.conf
grub.conf minix_stage1_5 ufs2_stage1_5
[root@localhost grub]# cat 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,1)
# kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
#開機設定,預設值,delay time ...backgroub pic
default=1
timeout=5
splashimage=(hd0,1)/grub/splash.xpm.gz
#選擇單內容,並沒有顯示出來。
hiddenmenu
title Fedora (2.6.31.5-127.fc12.i686.PAE)
root (hd0,1)
kernel /vmlinuz-2.6.31.5-127.fc12.i686.PAE ro root=/dev/mapper/VolGroup-lv_root LANG=zh_TW.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet
initrd /initramfs-2.6.31.5-127.fc12.i686.PAE.img
title Other
rootnoverify (hd0,0)
chainloader +1
其中最主要的關於 root,kernel,initrd
kernel:載入kernel的位置,當kernel被成功載入後,會再檢視後方緊接著root參數是那一分割區,將該“分割區”mount成為“/”
initrd:
載入initrd的位置,其中存放著一些外掛的驅動
*而其中對於 系統 管理
又分為二種
。直接載入 : 對於原本就支援多重開機,Grub 在開機時直接載入其kernel
。鏈接載入 : 遇到不支援多重開系統時,是將其開機的指標直接指到該分割區的
boot sector
rootnoverify (hd0,0)
chainloader +1
-----------------------
http://linux.vbird.org/linux_basic/0510osloader.php
http://people.ofset.org/~ckhung/b/sa/grub.php
http://www.wretch.cc/blog/sclin0323/25986650
-------------------------
我會將所用的相關的指令做一個介紹
及一些介紹
首先是
man --在於查其指令的說明
*在查看完畢後,要跳離其man要使用 “q”
man(1) man(1)
NAME
man - format and display the on-line manual pages
SYNOPSIS
man [-acdfFhkKtwW] [--path] [-m system] [-p string] [-C config_file]
[-M pathlist] [-P pager] [-B browser] [-H htmlpager] [-S section_list]
[section] name ...
DESCRIPTION
man formats and displays the on-line manual pages. If you specify sec-
tion, man only looks in that section of the manual. name is normally
the name of the manual page, which is typically the name of a command,
function, or file. However, if name contains a slash (/) then man
interprets it as a file specification, so that you can do man ./foo.5
or even man /cd/foo/bar.1.gz.
See below for a description of where man looks for the manual page
files.
PWD(1) User Commands PWD(1)
NAME
pwd - print name of current/working directory
SYNOPSIS
pwd [OPTION]...
DESCRIPTION
Print the full filename of the current working directory.
-L, --logical
use PWD from environment, even if it contains symlinks
-P, --physical
avoid all symlinks
--help display this help and exit
--version
output version information and exit
----------
LS(1) User Commands LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort.
Mandatory arguments to long options are mandatory for short options
too.
-h, --human-readable
with -l, print sizes in human readable format (e.g., 1K 234M 2G)
-l use a long listing format
----------
HEXDUMP(1) BSD General Commands Manual HEXDUMP(1)
NAME
hexdump - ascii, decimal, hexadecimal, octal dump
SYNOPSIS
[-bcCdovx] [-e format_string] [-f format_file] [-n length] [-s skip]
file ...
DESCRIPTION
The hexdump utility is a filter which displays the specified files, or
the standard input, if no files are specified, in a user specified for-
mat.
The options are as follows:
-C Canonical hex+ASCII display. Display the input offset in
hexadecimal, followed by sixteen space-separated, two column,
hexadecimal bytes, followed by the same sixteen bytes in %_p
format enclosed in ‘‘|’’ characters.
Formats
A format string contains any number of format units, separated by whites-
pace. A format unit contains up to three items: an iteration count, a
byte count, and a format.
The iteration count is an optional positive integer, which defaults to
one. Each format is applied iteration count times.
The byte count is an optional positive integer. If specified it defines
the number of bytes to be interpreted by each iteration of the format.
If an iteration count and/or a byte count is specified, a single slash
must be placed after the iteration count and/or before the byte count to
disambiguate them. Any whitespace before or after the slash is ignored.
The format is required and must be surrounded by double quote (" ")
marks. It is interpreted as a fprintf-style format string (see
fprintf(3)), with the following exceptions:
· An asterisk (*) may not be used as a field width or precision.
· A byte count or field precision is required for each ‘‘s’’ con-
version character (unlike the fprintf(3) default which prints
the entire string if the precision is unspecified).
· The conversion characters ‘‘h’’, ‘‘l’’, ‘‘n’’, ‘‘p’’ and ‘‘q’’
are not supported.
· The single character escape sequences described in the C stan-
dard are supported:
NUL \0
\a
\b
\f
\n
\r
\t
\v
-----------------
DD(1) User Commands DD(1)
NAME
dd - convert and copy a file
SYNOPSIS
dd [OPERAND]...
dd OPTION
DESCRIPTION
Copy a file, converting and formatting according to the operands.
---------------
- BIOS 根據 boot priority 的設定, 挑選某顆硬碟或隨身碟
- 這顆碟的 MBR (Master Boot Record)
- 開機管理程式 boot loader
- 使用者從選單挑一個作業系統
- 開機管理員載入 Linux 核心 (通常檔名類似 vmlinuz) 及初始的檔案系統 (通常檔名類似 initrd.gz)
- 將根目錄切換至某個分割, 進入正常系統
Linux所使用的多重開機管理系統
主要的特色
1。支援多種格式(FAT,NTSF,EX3
2。支援不可多重開機系統(Windows
3。可載入多重模組
4。設定檔容易修改
5。選擇介?
6。指令介X容易
7。支援自動解壓縮
8。可從任何己安裝的設備中讀取檔案
9。磁碟轉換的獨立性
10。偵測現在記憶体
11。支援LBA模式
12。可透過網路下載系統映像檔
13。支援無磁碟系統
14。支援遠端終端機模式
----------------
其關於GRUB目錄在/boot/grub 下
------------
[steven@localhost grub]$ ls
device.map grub.conf minix_stage1_5 stage2
e2fs_stage1_5 iso9660_stage1_5 reiserfs_stage1_5 ufs2_stage1_5
fat_stage1_5 jfs_stage1_5 splash.xpm.gz vstafs_stage1_5
ffs_stage1_5 menu.lst stage1 xfs_stage1_5
------------
其中stage1,e2fs_stage1_5,stage2為其動偏的主要檔案
1。stage1---
負責當bios交接給grub時,載入存在於各分割區中開機檔(開機管理程式
[steven@localhost grub]$ ls -lh stage*
-rw-r--r--. 1 root root 512 2009-12-07 05:54 stage1
-rw-r--r--. 1 root root 123K 2009-12-07 12:42 stage2
其stage1即為硬碟中的MBR區域,即為bootload的備份
其stage1的內容
[steven@localhost grub]$ hexdump -C stage1 | tail -10
00000170 00 be 93 7d e8 2a 00 eb fe 47 52 55 42 20 00 47 |...}.*...GRUB .G|
00000180 65 6f 6d 00 48 61 72 64 20 44 69 73 6b 00 52 65 |eom.Hard Disk.Re|
00000190 61 64 00 20 45 72 72 6f 72 00 bb 01 00 b4 0e cd |ad. Error.......|
000001a0 10 ac 3c 00 75 f4 c3 00 00 00 00 00 00 00 00 00 |..<.u...........|
000001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 24 12 |..............$.|
000001c0 0f 09 00 be bd 7d 31 c0 cd 13 46 8a 0c 80 f9 00 |.....}1...F.....|
000001d0 75 0f be da 7d e8 c9 ff eb 97 46 6c 6f 70 70 79 |u...}.....Floppy|
000001e0 00 bb 00 70 b8 01 02 b5 00 b6 00 cd 13 72 d7 b6 |...p.........r..|
000001f0 01 b5 4f e9 e0 fe 00 00 00 00 00 00 00 00 55 aa |..O...........U.|
00000200
將MBR讀出,並儲存為一個檔案
[root@localhost steven]# dd if=/dev/sda of=partition.img skip=1 bs=1 count=512
512+0 records in
512+0 records out
512 bytes (512 B) copied, 0.0139742 s, 36.6 kB/s
[root@localhost steven]# ls
partition.img 下載 公共 圖片 影片 文件 桌面 模板 音樂
[root@localhost steven]# hexdump -C partition.img |tail -10
00000170 be 93 7d e8 2a 00 eb fe 47 52 55 42 20 00 47 65 |..}.*...GRUB .Ge|
00000180 6f 6d 00 48 61 72 64 20 44 69 73 6b 00 52 65 61 |om.Hard Disk.Rea|
00000190 64 00 20 45 72 72 6f 72 00 bb 01 00 b4 0e cd 10 |d. Error........|
000001a0 ac 3c 00 75 f4 c3 00 00 00 00 00 00 00 00 00 00 |.<.u............|
000001b0 00 00 00 00 00 00 00 2c 44 d3 e3 00 00 00 01 01 |.......,D.......|
000001c0 00 07 ef ff ff 3f 00 00 00 31 fe 3f 06 80 fe ff |.....?...1.?....|
000001d0 ff 83 fe ff ff 70 fe 3f 06 00 40 06 00 00 fe ff |.....p.?..@.....|
000001e0 ff 8e fe ff ff 70 3e 46 06 00 d0 f9 04 00 fe ff |.....p>F........|
000001f0 ff 05 fe ff ff a5 0f 40 0b 1c 28 b9 02 55 aa 00 |.......@..(..U..|
00000200
*MBR ? bootload
bootload中只有前416byte為與MBR相同。故要恢復其MBR時,其只有前416有用到
2。stage 1.5
在其目錄中,有許多的stage1.5(e2fs_stage1_5,fat_stage1_5...)都是為stage 1.5階段功能
的,其偏用為連接stage1到stage2的一個通道,裡X存放著是該系統檔案的格式。
如當stage1載入e2fs_stage1.5後,就可以依其格式讀取ex2的檔案,然後再將stage2載入。
這一連串的動偏的順序讓grub在安裝完後,stage2可以在被搬移後的情況下,仍然可以找到。故為己將其檔案系統格式載入,可stage1可以讀取其硬碟裡的檔案。
[steven@localhost grub]$ hexdump -C e2fs_stage1_5 | tail -10
00003990 40 01 00 00 00 41 0e 08 42 85 02 0d 05 51 86 04 |@....A..B....Q..|
000039a0 87 03 5b 0a c6 41 c7 41 c5 0c 04 04 47 0b 6a 0a |..[..A.A....G.j.|
000039b0 c6 41 c7 41 0c 04 04 c5 44 0b 69 0a c6 41 c7 41 |.A.A....D.i..A.A|
000039c0 0c 04 04 c5 45 0b 02 80 0a c6 41 c7 41 0c 04 04 |....E.....A.A...|
000039d0 c5 46 0b 00 00 01 00 00 0c 52 00 00 0d 48 00 00 |.F.......R...H..|
000039e0 93 48 00 00 93 42 00 00 00 00 00 00 00 00 00 00 |.H...B..........|
000039f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00003a00 00 00 00 00 00 00 00 00 ff 00 00 00 01 00 00 00 |................|
00003a10 ff ff ff ff ff ff ff ff |........|
00003a18
------------
stage 2
這個檔案是GRUB的核心程式,能使用者以選單方式將偏業系統載入,新增參數,修改選項。。。除了不能從開機載入外,其餘均由stage2處理。
主要功能
1。提供選單
2。讀取設定檔
3。連接下一個bootsector
*主要是因為其stage2檔案大小,無法放入到MBR中,故採以stage1連接載入方式
GRUB在安裝的同時便己將所需要的設定檔案,先行寫入到stage2中,因此,當stage在執行時
,會從現有旳檔案系統中,在原本的設定路徑下載入設定檔(/boot/grub/grub.conf
[root@localhost grub]# cat 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,1)
# kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,1)/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.31.5-127.fc12.i686.PAE)
root (hd0,1)
kernel /vmlinuz-2.6.31.5-127.fc12.i686.PAE ro root=/dev/mapper/VolGroup-lv_root LANG=zh_TW.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet
initrd /initramfs-2.6.31.5-127.fc12.i686.PAE.img
title Other
rootnoverify (hd0,0)
chainloader +1[root@localhost grub]# cat 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,1)
# kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,1)/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.31.5-127.fc12.i686.PAE)
root (hd0,1)
kernel /vmlinuz-2.6.31.5-127.fc12.i686.PAE ro root=/dev/mapper/VolGroup-lv_root LANG=zh_TW.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet
initrd /initramfs-2.6.31.5-127.fc12.i686.PAE.img
title Other
rootnoverify (hd0,0)
chainloader +1
多重開機::stage2是專門負責開機選單及kernel位置的部份,若需要使用多個系統時
其它的偏業系統在該分割區是不需要有這三個stage的任何一個。因為只要有一個主要要開
機用的系統所含的stage1,加上上協助載入kernel的stage2,就可以知道所有系統的kernel存
放位置。
----------
grub安裝
[root@localhost ~]# grub
Probing devices to guess BIOS drives. This may take a long time.
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ 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> root(hd0,2)---指向第一個硬碟的第三分割區
filesystem type is.........
grub >setup -----安裝grub至mbr
checking if "/boot/gurb/stage1" exit ...yes
.......
........
run.......
run "install /bootgrub stage1......."
Done.
------------
設定grub.conf
grub.conf minix_stage1_5 ufs2_stage1_5
[root@localhost grub]# cat 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,1)
# kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
#開機設定,預設值,delay time ...backgroub pic
default=1
timeout=5
splashimage=(hd0,1)/grub/splash.xpm.gz
#選擇單內容,並沒有顯示出來。
hiddenmenu
title Fedora (2.6.31.5-127.fc12.i686.PAE)
root (hd0,1)
kernel /vmlinuz-2.6.31.5-127.fc12.i686.PAE ro root=/dev/mapper/VolGroup-lv_root LANG=zh_TW.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet
initrd /initramfs-2.6.31.5-127.fc12.i686.PAE.img
title Other
rootnoverify (hd0,0)
chainloader +1
其中最主要的關於 root,kernel,initrd
kernel:載入kernel的位置,當kernel被成功載入後,會再檢視後方緊接著root參數是那一分割區,將該“分割區”mount成為“/”
initrd:
載入initrd的位置,其中存放著一些外掛的驅動
*而其中對於 系統 管理
又分為二種
。直接載入 : 對於原本就支援多重開機,Grub 在開機時直接載入其kernel
。鏈接載入 : 遇到不支援多重開系統時,是將其開機的指標直接指到該分割區的
boot sector
rootnoverify (hd0,0)
chainloader +1
-----------------------
http://linux.vbird.org/linux_basic/0510osloader.php
http://people.ofset.org/~ckhung/b/sa/grub.php
http://www.wretch.cc/blog/sclin0323/25986650
-------------------------
我會將所用的相關的指令做一個介紹
及一些介紹
首先是
man --在於查其指令的說明
*在查看完畢後,要跳離其man要使用 “q”
man(1) man(1)
NAME
man - format and display the on-line manual pages
SYNOPSIS
man [-acdfFhkKtwW] [--path] [-m system] [-p string] [-C config_file]
[-M pathlist] [-P pager] [-B browser] [-H htmlpager] [-S section_list]
[section] name ...
DESCRIPTION
man formats and displays the on-line manual pages. If you specify sec-
tion, man only looks in that section of the manual. name is normally
the name of the manual page, which is typically the name of a command,
function, or file. However, if name contains a slash (/) then man
interprets it as a file specification, so that you can do man ./foo.5
or even man /cd/foo/bar.1.gz.
See below for a description of where man looks for the manual page
files.
PWD(1) User Commands PWD(1)
NAME
pwd - print name of current/working directory
SYNOPSIS
pwd [OPTION]...
DESCRIPTION
Print the full filename of the current working directory.
-L, --logical
use PWD from environment, even if it contains symlinks
-P, --physical
avoid all symlinks
--help display this help and exit
--version
output version information and exit
----------
LS(1) User Commands LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort.
Mandatory arguments to long options are mandatory for short options
too.
-h, --human-readable
with -l, print sizes in human readable format (e.g., 1K 234M 2G)
-l use a long listing format
----------
HEXDUMP(1) BSD General Commands Manual HEXDUMP(1)
NAME
hexdump - ascii, decimal, hexadecimal, octal dump
SYNOPSIS
[-bcCdovx] [-e format_string] [-f format_file] [-n length] [-s skip]
file ...
DESCRIPTION
The hexdump utility is a filter which displays the specified files, or
the standard input, if no files are specified, in a user specified for-
mat.
The options are as follows:
-C Canonical hex+ASCII display. Display the input offset in
hexadecimal, followed by sixteen space-separated, two column,
hexadecimal bytes, followed by the same sixteen bytes in %_p
format enclosed in ‘‘|’’ characters.
Formats
A format string contains any number of format units, separated by whites-
pace. A format unit contains up to three items: an iteration count, a
byte count, and a format.
The iteration count is an optional positive integer, which defaults to
one. Each format is applied iteration count times.
The byte count is an optional positive integer. If specified it defines
the number of bytes to be interpreted by each iteration of the format.
If an iteration count and/or a byte count is specified, a single slash
must be placed after the iteration count and/or before the byte count to
disambiguate them. Any whitespace before or after the slash is ignored.
The format is required and must be surrounded by double quote (" ")
marks. It is interpreted as a fprintf-style format string (see
fprintf(3)), with the following exceptions:
· An asterisk (*) may not be used as a field width or precision.
· A byte count or field precision is required for each ‘‘s’’ con-
version character (unlike the fprintf(3) default which prints
the entire string if the precision is unspecified).
· The conversion characters ‘‘h’’, ‘‘l’’, ‘‘n’’, ‘‘p’’ and ‘‘q’’
are not supported.
· The single character escape sequences described in the C stan-
dard are supported:
NUL \0
-----------------
DD(1) User Commands DD(1)
NAME
dd - convert and copy a file
SYNOPSIS
dd [OPERAND]...
dd OPTION
DESCRIPTION
Copy a file, converting and formatting according to the operands.
---------------
沒有留言:
張貼留言