In Linux Machine, sometime we need to change or edit kernel parameters to add some more features on Linux operating system.

change in Kernel parameters would make it persistent across reboot, So that these changes would get in effect with boot time.

In this post we will check how we can change kernel parameters on CentOS7 Machines.

In CentOS7 Machine we need to change GRUB_CMDLINE_LINUX options parameters on /etc/default/grub file.

I suggest before change in /etc/default/grub, we should first take backup of it as precautions measure.

Open /etc/default/grub file in editor.

[root@srv17 ~]# vim /etc/default/grub 
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL="serial console"
GRUB_SERIAL_COMMAND="serial --speed=115200"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap crashkernel=auto  vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

Now we could edit/Add some kernel parameter in GRUB_CMDLINE_LINUX like below

GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap crashkernel=auto  vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root vconsole.keymap=us console=ttyS0,115200 transparent_hugepage=never"

We removed “rhgb quiet” and added some important parameter like console and hugepages settings required for Virtual Machine and MongoDB Database.

After changing this parameters, we need Rebuild the /boot/grub2/grub.cfg file by running the grub2-mkconfig like below.

[root@srv17 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg

We can reboot machine after this.

[root@srv17 ~]# cat /proc/cmdline 
BOOT_IMAGE=/vmlinuz-3.10.0-1127.10.1.el7.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/swap crashkernel=auto vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root vconsole.keymap=us c
onsole=ttyS0,115200 transparent_hugepage=never