Thursday, July 15, 2021

How to clone CentOS server to another one

 How to clone CentOS server to another one


Step 1: Installing the Rsync Tool in CentOS

For cloning to be successful the rsync command-line tool needs to be present on both servers. This will be used for mirroring the source server to the destination server and syncing all the differences between the two systems. Thankfully, modern systems come with rsync already pre-installed.

To check the version of rsync installed run:

$ rsync --version

If you want to view additional information about rsync, execute the following rpm command:

$ rpm -qi rsync
Check Rsync Version in CentOS
Check Rsync Version in CentOS

If rsync is missing, run the following command to install it in RHEL / CentOS / Fedora systems.

$ sudo yum install rsync

Step 2: Configure the Source Server

There are directories and files that you may want to exclude from cloning because they are either already available in the destination server or are autogenerated. These include the /boot, /tmp and /dev directories.

Therefore, create an exclusion file /root/exclude-files.txt and add the following entries:


Save and exit the configuration file.

Step 3: Clone the CentOS Server

With everything set, proceed and rsync your server to the remote or destination server using the command:

$ sudo rsync -vPa -e 'ssh -o StrictHostKeyChecking=no' --exclude-from=/root/exclude-files.txt / REMOTE-IP:/
Clone CentOS Server
Clone CentOS Server

The command will rsync everything from the source server to the destination server while excluding the files and directories you defined earlier on. Be sure to replace the REMOTE-IP: option with your destination server’s IP address.

After the syncing is done, reboot the destination system to reload the changes and thereafter, boot into the server using the source server’s credentials. Feel free to decommission the old server since you now have a mirror copy of it.


found at:


Wednesday, July 7, 2021

Change grub2 default kernel

 Change grub2 default kernel

0. Check if grub_default is setup to saved

# cat /etc/default/grub
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_CMDLINE_LINUX=" vconsole.font=latarcyrheb-sun16 crashkernel=auto  vconsole.keymap=us rhgb quiet"

1. make copy of grub

# cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.bak

2. generata new grub .config

# grub2-mkconfig -o /boot/grub2/grub.cfg

3. Check what kernels are available.

# grep "^menuentry" /boot/grub2/grub.cfg | cut -d "'" -f2

4. Select kernel by name and setup as default 

#grub2-set-default "Oracle Linux Server 7.9, with Linux 3.10.0-1160.31.1.el7.x86_64

5. Check what is saved entry

# grub2-editenv list

Recreate initramfs with realtek.ko for kernel 5.4.x


Recreate initramfs with realtek.ko for kernel 5.4.x


1. Edit dracut.conf

# mcedit /etc/dracut.conf

add_drivers+="realtek r8169"

2. Backup initramfs

# cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.$(date +%m-%d-%H%M%S).bak

3. Rebuild initramfs with multipath

>CentOS/RHEL 6

# dracut -v -f -a multipath --include /etc/multipath /etc/multipath

>CentOS/RHEL 7

# dracut --force --add multipath --include /etc/multipath

4. Verify

# ls -lrt /boot/initramfs-$(uname -r).img

5.  Check if realtek is included

# lsinitrd /boot/initramfs-5.4.17-2102.202.5.el7uek.x86_64.img |grep realtek

-rw-r--r--   1 root root 33784 May 23 08:24 usr/lib/modules/5.4.17-2102.202.5.el7uek.x86_64/kernel/drivers/net/ethernet/realtek/r8169.ko.xz
-rw-r--r--   1 root root   4732 May 23 08:24 usr/lib/modules/5.4.17-2102.202.5.el7uek.x86_64/kernel/drivers/net/phy/realtek.ko.xz

 6. Reboot

# reboot


Internet Storm Center Infocon Status

Internet Storm Center Infocon Status
Internet Storm Center Infocon Status