GRUB识别分区:
grub.conf文件

default=0  ------默认选择第一个title
timeout=10
title icy2013.com linux
       root (hd0.0)--------将内核文件当作了grub的根---这个根是grub的根---/boot
       kernel /vmlinuz ro root=/dev/vg0/root-----这个根才是真正的根
       initrd /initramfs.img

 default=0
     默认启动选项
 timeout=5
     超时时间
Hiddermenu  
      隐藏菜单
 splashp_w_picpath
      指定背景图
 各类硬盘都是hd,  不同的硬盘hd#:如hd0, hd1
 同一个硬盘上的不同分区:(hd0,1)

password --md5 密码 

# grub-md5-crypt----生成加密密码


内核参数:------grub.conf 文件中所指内核的一行Kernel /vmlinuz ro root=/dev/vg0/root

   root=/path/to/somefile :真正的根文件系统设备文件路径,要挂在的根文件
   ro: 以只读方式挂载根;
   quiet: 静默模式; 

  selinux=0: 禁用内核中的selinux-----安全增强

SELinux是一种基于 域-类型 模型(domain-type)的强制访问控制MAC安全系统,它由NSA编写并设计成内核模块包含到内核中,相应的某些安全相关的应用也被打了SELinux补丁,最后还有一个相应的安全策略。

重新安装grub

方法1

# grub

grub> root (hd0,0)-----指定哪个磁盘

grub> setup (hd0)-------安装

grub> quit

(这种方法不实用,grub都坏了,还怎么自己给自己安装,通常使用方法2,给另一块磁盘装grub

方法2

1、创建一个名为boot的目录,例如/mnt/boot

2、确保目标硬盘分区已经存在,否则,请自行分区格式化;

3、挂载目标硬盘上要安装grub的分区至新建的boot目录;

grub-install --root-directory=/mnt/boot /dev/sdb内核探测硬件的信息:记录进日志文件/var/log/dmesg

# cat /var/log/dmesg或者# dmesg

内核参数----/etc/sysctl.conf

/proc/#: 

通过/proc/sys修改内核的工作特性

  文件:但它们是内核参数,文件的内容即为参数的值;

    凡具有写权限的文件,通过可以通过修改其内容来改变内核工作特性:

      echo NEW_VALUE > /proc/sys/to/some_file

      sysctl -w to.some_file=NEW_VALUE

    例如:

      /proc/sys/net/ipv4/ip_forward

        echo 1 > /proc/sys/net/ipv4/ip_forward

        sysctl -w net.ipv4.ip_forward=1

      /proc/sys/kernel/hostname

    sysctl -a: 查看所有内核参数

  sysctl的配置文件:/etc/sysctl.conf

设置完成后使用sysctl -p 使其生效

/etc/sysctl.conf

# Kernel sysctl configuration file for Red Hat Linux

#

# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and

# sysctl.conf(5) for more details.# Controls IP packet forwarding

net.ipv4.ip_forward = 0# Controls source route verification

net.ipv4.conf.default.rp_filter = 1# Do not accept source routing

net.ipv4.conf.default.accept_source_route = 0# Controls the System Request debugging functionality of the kernel

kernel.sysrq = 0# Controls whether core dumps will append the PID to the core filename.

# Useful for debugging multi-threaded applications.

kernel.core_uses_pid = 1# Controls the use of TCP syncookies

net.ipv4.tcp_syncookies = 1# Disable netfilter on bridges.

net.bridge.bridge-nf-call-ip6tables = 0

net.bridge.bridge-nf-call-iptables = 0

net.bridge.bridge-nf-call-arptables = 0# Controls the default maxmimum size of a mesage queue

kernel.msgmnb = 65536# Controls the maximum size of a message, in bytes

kernel.msgmax = 65536# Controls the maximum shared segment size, in bytes

kernel.shmmax = 68719476736# Controls the maximum number of shared memory segments, in pages

kernel.shmall = 4294967296