Saturday, May 17, 2014

Few Q for food for thougthsL- Linux single user booting and sysctl usage



1)how to go into the linux single user mode?

11.3. Booting into Single-User Mode
One of the advantages of single-user mode is that you do not need a boot diskette or CD-ROM; however, it does not give you the option to mount the file systems as read-only or not mount them at all.
If your system boots, but does not allow you to log in when it has completed booting, try single-user mode.
In single-user mode, your computer boots to runlevel 1. Your local file systems are mounted, but your network is not activated. You have a usable system maintenance shell. Unlike rescue mode, single-user mode automatically tries to mount your file system; do not use single-user mode if your file system can not be mounted successfully. You can not use single-user mode if the runlevel 1 configuration on your system is corrupted.
On an x86 system using GRUB as the boot loader, use the following steps to boot into single-user mode:
1.    If you have a GRUB password configured, type p and enter the password.
2.    Select Red Hat Enterprise Linux with the version of the kernel that you wish to boot and type a to append the line.
3.    Go to the end of the line and type single as a separate word (press the [Spacebar] and then type single). Press [Enter] to exit edit mode.
4.    Back at the GRUB screen, type b to boot into single-user mode.
On an x86 system using LILO as the boot loader, at the LILO boot prompt (if you are using the graphical LILO, you must press [Ctrl]-[x] to exit the graphical screen and go to the boot: prompt) type:
linux single

For all other platforms, specify single as a kernel parameter at the boot prompt.
==========================================================================
A. sysctl is used to modify kernel parameters at runtime. The parameters available are those listed under /proc/sys/. Procfs is required for sysctl support in Linux. You can use sysctl to both read and write sysctl data.
You must login as the root user to use any one of the following command.

Method # 1: Setting value via procfs

You can use standard echo command to write data to variables:
# echo "value" > /proc/sys/location/variable

Method # 2: Temporary on the command line

Use sysctl command with -w option when you want to change a sysctl setting:
sysctl -w variable=value

Method # 3: Configuration file /etc/sysctl.conf

This is recommended way. First open /etc/sysctl.conf file
# vi /etc/sysctl.conf
Now add value:
variable = value
Close and save the changes. Type the following command to load sysctl settings from the file /etc/sysctl.conf file:
# sysctl -p
Examples:-

FS.FILE-MAX

The fs.file-max kernel property is set via sysctl command. You can see current settings executing command:
1# sysctl fs.file-max
2fs.file-max = 358920
If you plan to run high load service with big number of server connections then this parameter should be at least as twice big as the number of network connections you expect to support. You can change this setting executing command:
1# sysctl -w fs.file-max=360000
2fs.file-max = 360000

NET.IPV4.IP_LOCAL_PORT_RANGE

You can see current settings executing command:
1# sysctl net.ipv4.ip_local_port_range
2net.ipv4.ip_local_port_range = 32768    61000
You can change this setting executing command:
1# sysctl -w net.ipv4.ip_local_port_range="1024 65000"
2net.ipv4.ip_local_port_range = 1024 65000

No comments:

Post a Comment