Linux- 启动管理。
文章目录
CentOS 6.x 启动管理。
系统运行级别。
运行级别 | 含义 |
---|---|
0 | 关机 |
1 | 单用户模式,可以想象为 Windows 的安全模式,主要用于系统修复。 |
2 | 不完全的命令行模式,为含 NFS 服务。 |
3 | 完全的命令行模式,就是标准字符界面。 |
4 | 系统保留。 |
5 | 图形模式。 |
6 | 重启动。 |
运行级别命令。
- 查看运行级别。
init 0 ——> 关机。
init 6 ——> 重启。
[root@localhost ~]# runlevel
N 3
# 上次 现在。
- 改变运行级别。
[root@localhost ~]# init 级别
- 系统默认运行级别。
[root@localhost ~]# cat /etc/inittab
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/init/rcS.conf
#
# Individual runlevels are started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
#
# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,
# with configuration in /etc/sysconfig/init.
#
# For information on how to write upstart event handlers, or how
# upstart works, see init(5), init(8), and initctl(8).
#
# Default runlevel. The runlevels used are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:3:initdefault:
系统启动过程。
CentOS 6.x 启动管理。
启动引导程序- grub。
Grub 配置文件。
Grub 中分区表示方式。
硬盘 | 分区 | Linux 中设备文件名 | Grub 中设备文件名 |
---|---|---|---|
第一块 SCSI 硬盘 | 第一个主分区 | /dev/sda1 | hd(0,0) |
第二个主分区 | /dev/sda2 | hd(0,1) | |
扩展分区 | /dev/sda3 | hd(0,2) | |
第一个逻辑分区 | /dev/sda5 | hd(0,4) | |
第二块 SCSI 硬盘 | 第一个主分区 | /dev/sdb1 | hd(1,0) |
第二个主分区 | /dev/sdb2 | hd(1,1) | |
扩展分区 | /dev/sdb3 | hd(1,2) | |
第一个逻辑分区 | /dev/sdb5 | hd(1,4) |
geek@geek-PC:~$ vim /boot/grub/grub.cfg
[root@localhost ~]# vim /boot/grub/grub.conf
[root@localhost ~]# ll /etc/grub.conf
lrwxrwxrwx. 1 root root 22 Feb 18 07:46 /etc/grub.conf -> ../boot/grub/grub.conf
可以配置启动哪一个系统,以及等待几秒。
splashimage=(hd0,0)/grub/splash.xpm.gz
// 背景图像文件保存位置。
以下案例为 2 个内核版本。
# 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/VolGroup-lv_root
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-754.27.1.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-754.27.1.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root nomodeset rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
initrd /initramfs-2.6.32-754.27.1.el6.x86_64.img
title CentOS 6 (2.6.32-754.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-754.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root nomodeset rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
initrd /initramfs-2.6.32-754.el6.x86_64.img
~