# 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/mapper/vg0-root
# initrd /initrd-[generic-]version.img
#boot=/dev/sda#引导盘
default=0 #设定默认启动的菜单项,落单项(title)编号从0开始
timeout=5 #等待时间
splashimage=(hd0,0)/grub/splash.xpm.gz#是用作GRUB GUI背景的图片所在的位置
hiddenmenu#隐藏菜单
title CentOS 6 (2.6.32-504.el6.x86_64)#启动菜单项名称
root (hd0,0)#GRUB的根目录设备及内核所在分区
kernel /vmlinuz-2.6.32-504.el6.x86_64 ro root=/dev/mapper/vg0-root rd_NO_LUKS rd_NO_DM LANG=en_US.UTF-8 rd_LVM_LV=vg0/swap rd_NO_MD
#ro为载入内核为只读
SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vg0/root
KEYBOARDTYPE=pc KEYTABLE=us rhgb crashkernel=auto quiet rhgb quiet
initrd /initramfs-2.6.32-504.el6.x86_64.img#加载的镜像文件
[iyunv@www ~]# fdisk /dev/sdb
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): +100M
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (15-2610, default 15):
Using default value 15
Last cylinder, +cylinders or +size{K,M,G} (15-2610, default 2610): +2G
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 82
Changed system type of partition 2 to 82 (Linux swap / Solaris)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (277-2610, default 277):
Using default value 277
Last cylinder, +cylinders or +size{K,M,G} (277-2610, default 2610): +5G
Command (m for help): p
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0ec68c8e
Device Boot Start End Blocks Id System
/dev/sdb1 1 14 112423+ 83 Linux
/dev/sdb2 15 276 2104515 82 Linux swap / Solaris
/dev/sdb3 277 930 5253255 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
1
2
3
4
5
6
7
[iyunv@www ~]# partx -a /dev/sdb
BLKPG: Device or resource busy
error adding partition 1
BLKPG: Device or resource busy
error adding partition 2
BLKPG: Device or resource busy
error adding partition 3
[iyunv@www ~]# grub-install --root-directory=/mnt /dev/sdb
Probing devices to guess BIOS drives. This may take a long time.
Installation finished. No error reported.
This is the contents of the device map /mnt/boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
(fd0) /dev/fd0
(hd0) /dev/sda
(hd1) /dev/sdb
[iyunv@www ~]# mkdir /mnt/sysroot#创建挂载点
[iyunv@www ~]# mount /dev/sdb3 /mnt/sysroot/
[iyunv@www ~]# cd /mnt/sysroot/
[iyunv@www sysroot]# ls
lost+found
[iyunv@www sysroot]# mkdir -pv etc bin sbin lib lib64 dev var usr home root mnt
mkdir: created directory `etc'
mkdir: created directory `bin'
mkdir: created directory `sbin'
mkdir: created directory `lib'
mkdir: created directory `lib64'
mkdir: created directory `dev'
mkdir: created directory `var'
mkdir: created directory `usr'
mkdir: created directory `home'
mkdir: created directory `root'
mkdir: created directory `mnt'
[iyunv@www sysroot]# ls
bin dev etc home lib lib64 lost+found mnt root sbin usr var#创建的文件系统