10 boot time parameters you should know about the Linux kernel
2013-03-13 19:52
489 查看
The Linux kernel accepts boot time parameters as it starts to boot system. This is used to inform kernel about various hardware parameter. You need boot time parameters:
* Troubleshoot system
* Hardware parameters that the kernel would not able to determine on its own
* Force kernel to override the default hardware parameters in order to increase performance
* Password and other recovery operations
Where,
name : Keyword name, for example, init, ro, boot etc
To boot system without password pass /bin/bash or /bin/sh as argument to init
If you copy entire partition from /dev/sda1 to /dev/sdb1 then use
Value 0 : Disable selinux
Value 1 : Enable selinux
with the kernel parameter "raid=noautodetect". As of kernel 2.6.9, only drives with a type 0 superblock can be autodetected and run at boot time.
The kernel command line is a null-terminated string currently up to 255 characters long, plus the final null. A string that is too long will be automatically truncated by the kernel, a boot loader may allow a longer command line to be passed to permit future
kernels to extend this limit (H. Peter Anvin ).
is mounted, and the initrd file system is moved over to /initrd; finally the usual boot sequence (e.g. invocation of /sbin/init) is performed. initrd is used to provide/load additional modules (device driver). For example, SCSI or RAID device driver loaded
using initrd.
If you disable hdb in BIOS, Linux will still detect it. This is the only way to disable hdb.
ether: ETHERNET DEVICES
For example, following boot argument force probing for a second Ethernet card (NIC), as the default is to only probe for one (irq=0,iobase=0 means automatically detect them).
ether=0,0,eth1
1) Select second line
2) Again, press 'e' to edit selected command
3) Type any of above parameters.
See an example of "recovering grub boot loader password", for more information. Another option is to type above parameters in grub.conf or lilo.conf file itself.
See the complete list of
Linux kernel parameters i.e. /usr/src/linux/Documentation/kernel-parameters.txt file.
* Troubleshoot system
* Hardware parameters that the kernel would not able to determine on its own
* Force kernel to override the default hardware parameters in order to increase performance
* Password and other recovery operations
The kernel command line syntax
name=value1,value2,value3…Where,
name : Keyword name, for example, init, ro, boot etc
Ten common Boot time parameters
init
This sets the initial command to be executed by the kernel. Default is to use /sbin/init, which is the parent of all processes.To boot system without password pass /bin/bash or /bin/sh as argument to init
init=/bin/bash
single
The most common argument that is passed to the init process is the word 'single' which instructs init to boot the computer in single user mode, and not launch all the usual daemonsroot=/dev/device
This argument tells the kernel what device (hard disk, floppy disk) to be used as the root filesystem while booting. For example following boot parameter use /dev/sda1 as the root file system:root=/dev/sda1
If you copy entire partition from /dev/sda1 to /dev/sdb1 then use
root=/dev/sdb1
ro
This argument tells the kernel to mount root file system as read-only. This is done so that fsck program can check and repair a Linux file system. Please note that you should never ever run fsck on read/write file system.rw
This argument tells the kernel to mount root file system as read and write mode.panic=SECOND
Specify kernel behavior on panic. By default, the kernel will not reboot after a panic, but this option will cause a kernel reboot after N seconds. For example following boot parameter will force to reboot Linux after 10 secondspanic=10
maxcpus=NUMBER
Specify maximum number of processors that an SMP kernel should make use of. For example if you have four cpus and would like to use 2 CPU then pass 2 as a number to maxcpus (useful to test different software performances and configurations).maxcpus=2
debug
Enable kernel debugging. This option is useful for kernel hackers and developers who wish to troubleshoot problemselinux [0|1]
Disable or enable SELinux at boot time.Value 0 : Disable selinux
Value 1 : Enable selinux
raid=/dev/mdN
This argument tells kernel howto assembly of RAID arrays at boot time. Please note that When md is compiled into the kernel (not as module), partitions of type 0xfd are scanned and automatically assembled into RAID arrays. This autodetection may be suppressedwith the kernel parameter "raid=noautodetect". As of kernel 2.6.9, only drives with a type 0 superblock can be autodetected and run at boot time.
mem=MEMEORY_SIZE
This is a classic parameter. Force usage of a specific amount of memory to be used when the kernel is not able to see the whole system memory or for test. For example:mem=1024M
The kernel command line is a null-terminated string currently up to 255 characters long, plus the final null. A string that is too long will be automatically truncated by the kernel, a boot loader may allow a longer command line to be passed to permit future
kernels to extend this limit (H. Peter Anvin ).
Other parameters
initrd /boot/initrd.img
An initrd should be loaded. the boot process will load the kernel and an initial ramdisk; then the kernel converts initrd into a "normal" ramdisk, which is mounted read-write as root device; then /linuxrc is executed; afterwards the "real" root file systemis mounted, and the initrd file system is moved over to /initrd; finally the usual boot sequence (e.g. invocation of /sbin/init) is performed. initrd is used to provide/load additional modules (device driver). For example, SCSI or RAID device driver loaded
using initrd.
hdX =noprobe
Do not probe for hdX drive. For example, disable hdb hard disk:hdb=noprobe
If you disable hdb in BIOS, Linux will still detect it. This is the only way to disable hdb.
ether=irq,iobase,[ARG1,ARG2],name
Where,ether: ETHERNET DEVICES
For example, following boot argument force probing for a second Ethernet card (NIC), as the default is to only probe for one (irq=0,iobase=0 means automatically detect them).
ether=0,0,eth1
How to begin the enter parameters mode?
You need to enter all this parameter at Grub or Lilo boot prompt. For example if you are using Grub as a boot loader, at Grub prompt press 'e' to edit command before booting.1) Select second line
2) Again, press 'e' to edit selected command
3) Type any of above parameters.
See an example of "recovering grub boot loader password", for more information. Another option is to type above parameters in grub.conf or lilo.conf file itself.
See the complete list of
Linux kernel parameters i.e. /usr/src/linux/Documentation/kernel-parameters.txt file.
相关文章推荐
- 10 things you should know about every Linux installation(ZT)
- 10 things you should know about every Linux installation
- What You Should Know About the Jewelry Business
- 5 Things You Should Know About the New Maxwell GPU Architecture
- 10 Things You Should Know About Using a BlackBerry!
- 15 Things You Should Know about the ORDER BY Clause
- Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl
- (Maybe you should just omit the defined()?) at kernel/timeconst.pl line
- 10 things you should know about NoSQL databases
- 10 Things You Should Know About Microsoft's Silverlight
- Top 2 things you should know about the Global Assembly Cache (GAC) in .NET 4.0
- Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line
- The 9 Deep Learning Papers You Need To Know About
- 6 Things You Should Know About Fragment URLs
- Driving Me Nuts - Things You Never Should Do in the Kernel
- 10 Small Things You May Not Know About Javascript
- What you should know about Stored Procedure Universe in BI 4.0 ?
- linux_10 Most Dangerous Commands – You Should Never Execute on Linux
- Data Structure: All you should know about Hash
- 10 Linux Commands Every Developer Should Know