- Community Home
- >
- HPE Community, China
- >
- 服务器
- >
- Itanium服务器
- >
- 回复: 内核kernel总结
类别
Company
Local Language
论坛
讨论平台
论坛
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
讨论平台
论坛
讨论平台
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
论坛
博客
- 将帖子标记为未读
- 加注书签
- 订阅
- 禁止
- 订阅此主题的 RSS 提要
- 高亮显示此帖
- 打印此帖
- 报告不当内容
修改时间 09-05-2014 05:11 PM
修改时间 09-05-2014 05:11 PM
内核kernel总结
A.管理 11i v1 内核 一、配置管理 11i v1 内核的三种途径:
- 通过SAM, 11iv1主要通过这种方式配置内核
SAM->Kernel Configuration
- 通过CLI命令行方式
- 通过SMH WEB方式:
https://service:2381
http://service:2301
二、通过SAM配置内核
- SAM->Kernel Configuration->Drivers //to add or remove drivers
- SAM->Kernel Configuration->Subsystems //to add or remove subsystems
- SAM->Kernel Configuration->Configurable Parameters //to modify tunable Parameters
- Changes to “Loadable” item can be applied without reboot
-Changes to “Static” item require a reboot
三、生成和应用 11i v1 Kernel
- 通过SAM修改内核 驱动、子系统或可调参数
- 生成新的内核
SAM->Kernel Configuration-> click Actions->Process New Kernel
执行以上命令,SAM会在/stand 目录下,立刻备份当前内核,并生成一个新的内核。
四、手工移动和应用新的内核
#cd /stand
#cp /stand/system /stand/system.prev
#cp /stand/bulid/system.SAM /stand/system
#kmupdate /stand/bulid/vmunix_test
#shutdown –ry 0
五、从备份内核引导并还原备份内核
- 从备份内核引导系统:
[POWER] //Power-on the system.
[ESC] //Hit the escape key to interrupt the boot process.
Main Menu> boot pri //Boot from the primary boot disk
Interact with the IPL? Y //Do interact with the IPL/ISL.
ISL>hpux –ls /stand //find vmunix.prev
ISL> hpux -is /stand/vmunix.prev //Boot from the original kernel
- 将先前内核移回:
#cd /stand
#cp /stand/system.prev /stand/system
#kmupdate /stand/vmunix.prev
#shutdown -ry 0
B.管理 11i v 2和11i v 3内核 一、11i v 2 、11 iv 3与11iv 1内核配置不同点:
- 内核结构的改变
- 更多的动态内核参数设置(DLKM)
- 增加了新的内核管理命令
- 最多限度的减少重机或停机时间
- 更大的灵活性、可用性
二、配置管理11i v 2 和11i v 3内核的三种途径:
- kc* CLI //命令行模式, 11i v2 和11i v3配置内核主要不是使有这种方式
- kcweb TUI //图表模式,其实就是SMH命令方式
#kcweb //进入kcweb TUI
- kcweb GUI //图形模式,其实就SMH web http方式
https://service:2381/kc/kc.cgi
三、使用kc* CLI 命令
Command
Purpose
kconfig
command-line tool for managing kernel configurations
kcpath
command-line tool for determining the current kernel path
kcmodule
command-line tool for managing kernel modules
kctune
command-line tool for managing tunable parameters
kcusage
command-line tool for monitoring resource usage
kcalarm
command-line tool for setting kernel tunable parameter alarms
kclog
command-line tool for viewing the kernel configuration log
- running kctune without any options lists your tunable parameter values.
- running kcmodule without any options lists kernel modules,
- running kconfig without any options lists kernel configuration
- running kcalarm without any options lists kernel alarms.
Several options are consistent across most of the CLI commands, too:
-c config Perform an operation on the specified named kernel configuration rather than the default “current” configuration.
-C comment Document the reason for the change in the /var/adm/kc.log log file.
-B Make a backup of the current configuration before applying changes. This is the default.
-K Inhibit the back up of the current configuration before applying changes; leave the existing “backup” configuration unchanged..
-h Hold changes until next boot, even if the affected parameters/modules are dynamically tunable.
-D Display parameters/modules with pending changes.
-P ColumnName,… Display output in a machine-readable format, only including the specified columns.
-v Display verbose output.
四、11i v2 11i v3内核配置结构 1. 11i v1 中内核由以下几个独立的管理文件组成:
/stand/system
/stand/vmunix
/stand/dlkm
2.11i v2 11i v3管理的是”Kernel Configurations”而不是独立的单个文件。
- Each configuration contains a collection of modules, parameters, and other settings
- Each configuration is assigned a name and is stored in a subdirectory under /stand.
- Configurations can be applied, tuned, exported, and imported as a unit.
3./stand目录下的几个特殊的”Kernel Configuration”
Kernel Configuration
Purpose
/stand/current/
This directory defines the configuration of the currently running kernel. By default, all kernel changes that can be made dynamically are applied to this configuration.
/stand/backup/
Before the administrator makes any changes to the current kernel configuration, HP-UX copies the existing kernel configuration to this directory. If you modify the kernel and discover that the new configuration doesn’t work, you can boot using this backup configuration.
/stand/nextboot/
If the administrator makes changes to static kernel modules or parameters, or if the administrator specifically requests that changes be held until next boot, those changes are recorded in the nextboot configuration. During the next system reboot, the nextboot configuration becomes the current configuration.
/stand/last_install/
This is a backup of the kernel configuration that was created during the last OS install.
/stand/crashconfig/
On rare occasions, serious defects in the operating system or system hardware may cause the system to “panic”. When a panic occurs, the kernel copies the contents of physical memory to the system dump devices specified by the administrator, then reboots. The kernel configuration, as it existed at the time of the crash, is also copied to /stand/crashconfig/.
- /stand/vmunix is a link to /stand/current/vmunix,
- /stand/system is a link to /stand/nextboot/system
五、实验:管理”Kernel Configuration” 1. 查看当前可用的”Kernel Configuration”
#kconfig
#kconfig -v //详细查看所有的Kernel Configuration
2. 通过copy当前Current Kernel 新建一个”Kernel configuration”
#kconfig -s newconfig
3. 查看”Kernel Configuration”的path目录
#kcpach -d newconfig
#kcpach -x newconfig
4. 修改一个”Kernel Configuration”的属性
#kconfig -c newconfig myconfig //复制
#kconfig -r myconfig newconfig2 //重命名
#kconfig -t “create by a pig” newconfig2 //更改newconfig2的Title说明
#kconfig -v newconfig2 //查看确认以下信息
5. 修改指定”Kernel Configuration”的Modlue和Tunable Parameters配置
#kcmodule -c newconfig2 [-h] module_name=state
#kctune -c newconfig2 [-h] tunable_name=parameter
6. 删除一个”Kernel Configuration”
#kconfig -d myconfig
#kconfig //确认删除
7. 应用一个”Kernel Configuration"到当前Current Kernel运行
#kconfig -l newconfig2
8. 选择一个”Kernel Configuration”在下次启动时应用到内核
#kconfig -c newconfig2 newconfig1
#kconfig -n newconfig1
9. 查看”Kernel Configuration”日志,确认以上操作信息
#more /var/adm/kc.log
10. 查看”Kernel Configuration”的所有module 和tunable parameters配置信息
#kconfig -av newconfig2
11. View a list of pending change
#kconfig -D
注:所为pending change即现在做了配置的改变但要到下次重启之后才能生效,在各命令中加上-h 选项就能生成一个pending change, 静态内核也是pending change
六、实验:配置当前Current Kernel 1. 备份当前Current Kernel
#kconfig -s backup_current
2. 修改当前内核的Module 和Tunable Parameters
#kcmodule [-h] module_name=state //-h 选项做一个pending在下次启动时配置生效。
#kctune [-h] tunable_name=parameter //-h 意义同上
3. 查看Current Kernel的新配置
#kconfig -a
4. Check for pending change
#kconfig -D
七、实验: COPY内核配置到其它主机 1. On the source system, export the named configuration to a system file.
# kconfig –e MyConfiguration /tmp/MyConfiguration.system
2. FTP the system file to the target system.
# ftp target
ftp> put /tmp/MyConfiguration.system
3. On the target system, import the system file to create the named configuration.
# kconfig –i MyConfiguration /tmp/MyConfiguration.system
4. Load the new named configuration.
# kconfig –l MyConfiguration
5. Check for pending changes
# kconfig –D
九、内核模块 1. 内核模块的概念
- 每个一个内核配置”Kernel Configuration”都包含多个内核模块。
- 内核模块是一个驱动、子系统或是一段内核代码。
- 内核模块必须要linked或是loaded到HP-UX kernel
- 为了访问一个外围设备,内核必须载入和此设备相关的驱动模块。
- 内核模块分为静态和动态(DLKM)两种。
2. 内核模块的状态
State
Description
unused
The module is not included in the kernel configuration.
static
The module is statically bound into the vmunix executable.
auto
The module will be dynamically loaded into the kernel when needed.
loaded
The module is dynamically loaded into the kernel.
best
The module will be put into the state identified by the kernel module developer as its "best" state. Typically this will be auto (if supported by the module). If auto isn’t supported, it will likely be loaded (if the module is dynamically loadable). If the module supports neither the auto nor the loaded states, the best available state will likely be static.
3. 内核模块状态的改变
The table below lists the reasons a module might change state.
Cause
Description
explicit
The system administrator explicitly chose the current state.
best
The system administrator chose to use the module, but didn’t choose a specific state, so the module is placed in its “best” state, as determined by the module developer.
auto
The module was in the auto state, and was automatically loaded needed (DLKMs only).
required
The module is required by the kernel.
depend
The module is in use because some other module in the configuration depends on it.
十、实验:管理内核模块 1. list kernel module
#kcmodule //查看所有
#kcmodule -v cdfs //查看某一个,例如cdfs
2.Mark a DLKM module to be dynamically loadable in the current kernel
#kcmodule cdfs=auto
3.Explicity load a DLKM module into the current kernel
#kcmodule cdfs=loaded
4.Add a module to the static nextboot kernel
#kcmodule cdfs=static
5.Mark a module unusable in the static nextboot kernel
#kcmodule cdfs=unused
6.Place a module in the “best” state, as defined by the module developer
#kcmodule cdfs=best
7.List pending module change in the nextboot kernel
#kcmodule -D
十一、内核可调参数 1. 内核模块参数调整的概念
- 每一个内核module可以包括一个或多个tunable parameters
- Tunable parameters 也分动态和静态两种
2. Tunable参数的种类
Type
Description
static
Static tunable changes require re-linking the kernel, and rebooting.
dynamic
Dynamic tunable changes may be applied immediately to the running kernel, without rebooting.
automatic
Values are set automatically , but can be overriden
user-defined
Defined by user, May be used like variables in other tunable’ formulas
十二、实验:管理内核参数 1. List tunable parameters
#kctune //显示所有
#kctune -v nproc //显示nproc详细信息
2. Edit a tunable parameter
#kctune [-h] [–c newconfig2] nproc=parameter
3. Increment a tunable
#kctune nproc+=32
4. Create a user-defined parameter
#kctune -u numdbs=4
5. Define a tunable as an expression based on another system or user-defined parameter
#kctune nproc=1024+256*numdbs
6. List pending tunable
#kctune -D
7. Use man command to view the detail of tunable parameters
#man 5 nproc
十三、实验:kcusage命令监控Tunables的使用情况 1. View current usage for one tunable.
#kcusage nproc
2. View top consumer and usage over the last hour/day/month/year, for tunable paramerters
#kcusage -t [-h|-d|-m|-y] nproc
Add a -h|-d|-m|-y option to view historic usage patterns over the last hour/day/month/year. For some tunables, the –t option can be added to list the top five users or processes consuming the tunable’s associated resource during each reporting interval.
十四、11iv 2 11iv3 Kernel Troubleshooting a. 查看内核变更日志
- Log file location
#More /var/adm/kc.log
#More /var/adm/syslog/syslog.log
- View the last five log entries for the current kernel
#kclog 5
- View the last 5 entries for a specific named kernel configuration
#kclog -c newconfig2 5
- View the last 5 entries that contain a specified string
#kclog -f “oracle” 5
- View the last 5 entries associated with a specific tunable module
#kclog -n “cdfs” 5
- View the last 5 entries for all tunable changes(but not kernel module change)
#kclog –t tunable 5
- Add a general comment in the kernel log\
#kclog -C “Add this comment to kernel configuration log”
b. 从备用kernel启动
- ON PA-RISC SYSTEM
Main Menu: boot pri
Interact w/ IPL? y
ISL> hpux ls
ISL> hpux /stand/MyConfiguration/vmunix
- ON Integrity SYSTEM
HP-UX Boot Loader for IA64 Revision 1.71
Press Any Key to interrupt Autoboot
\EFI\HPUX\AUTO ==> boot vmunix
Seconds left till autoboot – 10 Escape
Type 'help' for help
HPUX> ll
HPUX> boot MyConfiguration
c. Boot with override Parameters
- ON PA-RISC SYSTEM
Processor is booting from first available device.
To discontinue, press any key within 10 seconds.
Main Menu: boot pri isl
Interact with IPL? y
ISL> hpux /stand/vmunix nproc=6000
- ON Integrity SYSTEM
HP-UX Boot Loader for IA64 Revision 1.71
Press Any Key to interrupt Autoboot
\EFI\HPUX\AUTO ==> boot vmunix
HPUX> boot vmunix nproc=6000
d. Boot to Tunable maintenance mode
- ON PA-RISC SYSTEM
Processor is booting from first available device.
To discontinue, press any key within 10 seconds.
Main Menu: boot pri isl
Interact with IPL? y
ISL> hpux -tm
- ON Integrity SYSTEM
HP-UX Boot Loader for IA64 Revision 1.71
Press Any Key to interrupt Autoboot
\EFI\HPUX\AUTO ==> boot vmunix
HPUX> ll
HPUX> boot vmunix -tm
e. Kernel recovery roadmap
- System Up, Backup Good
If your system is up, and your /stand/backup/ configuration is good, simply load the backup configuration or another named configuration. If loading the backup configuration requires changes to static modules or kernel parameters, it may be necessary to reboot.
# kconfig –l backup
# shutdown –ry 0
- System is Up, Backup is Questionable
If the system is up, but both /stand/current/ and /stand/backup/ are questionable, review recent changes in the kernel log and reverse them using kctune and kcmodule.
- System is Down, Backup is Good
If the system is down, but /stand/backup/ or another configuration is good, use the kernel loader to boot the alternate configuration.
- System is Down, Backup is Questionable
If the system is down and /stand/backup/ configuration is questionable, specify an override parameter or boot to failsafe / tunable maintenance mode, find previous changes in the kernel change log, and reverse them using kctune and kcmodule.
- With an Ignite make_tape_recovery tape, it might be easier to reinstall the system from the recovery tape.