Tuesday, December 4, 2018

RHEL 8 Beta: Bits & Pieces

Yes, Red Hat has recently released the Beta version of Red Hat Enterprise Linux (RHEL) 8.  This is still in a rigorous testing and development phase, so there could be some changes compared with ‘Stable’ release later. As everyone I was also keen on installing the ‘beta’ version and checking how it works, what are the differences, what’s new, what is not available etc., hence, I thought of writing up this post to give a glimpse of RHEL 8 beta.

Thursday, November 1, 2018

How-To Recover Accidentally Deleted Disk Partition In Linux?

There are many a times that we’ve come across this situation where an “hard drive partition table has been erased accidentally” or “partition data is missing or corrupted” and hence, unable to mount respective block devices. Yes, “how to recover or repair corrupted or deleted partition table of a hard drive” or “how can I recreate hard drive partition table without losing data” are some of the keywords that we hit on Internet to find out a solution. There are a few third party tools (many from open-source) available which could get this job done, however, I wanted to show how this could be done using native tools/commands in Linux operating system. There are at times that we could not use those third party tools, hence, we’ve to go with native way of restoring partition table data. So, let’s see how could we get this achieved. NOTE: If a hard drive is extremely damaged (physically) or if it is re-formatted (making a file system) or if meta-data itself is gone corrupted or severely damaged then there are very less chances of recovering data, in such cases users may have to rely on some sophisticated third party tools which may recover some or part of data. The situation that I’m going to cover here is wherein a hard drive partition table is erased, however, no re-formatting has been done yet.

How-To Recover Accidentally Deleted Disk Partition -Part2

Method 2
The earlier method was a bit lengthy and needs proper planning and implementation. Now, let’s discuss about using parted tool to recover corrupted or deleted partition table details. This method is rather easy and straight farword which doesn’t need so many steps to be performed as we did earlier.

The “parted” tool is a powerful disk utility which can do many functions such as recovery of partition data, resize etc., and also the default utility being used if disk size is greater than 2.2TB. Another powerful feature of “parted” is that it is GPT aware.

Tuesday, October 9, 2018

How To Resolve Kernel Panic Error After Installing A New Kernel?

Kernel panic after installing a new kernel” is a situation that most of the people (admins/staff) who manages a Linux box would have come across or heard off. So, “how to resolve kernel panic error after installing a new kernelor "kernel panic after system updates" would be the keywords that we most of us hit on internet search engine… Google to check for solution. This happened with me as well, and I had to look out for a proper solution and did a lot of research about this. Hence, I wanted to document about kernel package, prerequisites to be checked before installing a new kernel, various methods used to cross-check if new kernel is successfully installed etc., which could help someone looking out for an answer/solution regarding this. There may be a situation where a system fails to boot into new kernel and shows some other errors and it may not be a panic message.

Wednesday, July 18, 2018

How To Troubleshoot When System Drops Into GRUB Rescue Shell?

One of my Linux servers (RHEL 7.5) dropped into grub rescue shell and had failed to load the operating system. So, I was troubleshooting it and discovered a few steps which could help anyone who is in need, hence, I decided to write this post in my blog site. This post talks about step by step procedure to recover such a Linux system and boot normally.  This is tested and re-produced on a virtual system running on VMWare Workstation.

I’m going to document each step with screenshots in this post which would help anyone who wish to recover such failed system.

Sunday, May 13, 2018

Usage Of Functions In Shell Scripting

Benefits of using functions inside shell scripting are:

- Less coding.
- Modular approach.
- Easy to understand.
- Exported as required for portability.
- Easy to expand or edit later.

As mentioned before, we could use functions inside shell scripts whenever required such as when there are set of codes which are common across some shell scripts then those common lines could be grouped into a function and called when required. This approach of using functions would provide better readability, which is easier to understand, as well these functions could be handled independently. A group of codes put together to perform a specific task and defined with a name could be called as a function in shell scripts.

Saturday, March 3, 2018

Learn Shell Scripting In One Day

Let’s learn “Shell Scripting". So, in this post I wanted to talk about “What is a shell script?" & "learner guide  to shell scripting with examples". Before jumping into learning on how to code and execute shell scripts, let’s talk a bit about “Linux” and history of Linux.

Linux is technically the kernel, so, there are other utilities such as GNU tools, GCC compiler etc,. which would ideally make a complete operating system (OS). That is the reason it is called GNU (GNUs not Unix) Linux not simply Linux. Ideally one must say 'GNU Linux' not just 'Linux'.  GNU Linux is one of the widely used OS in market, because it is open-source, so anyone could download/re-use the kernel, publish a new Linux distribution under the guidelines of GPL & Free Software Foundation.

Learn Shell Scripting -- Part 2

Conditional operations using “if…else…fi” statement

We could use “if” statement when it is required to perform a conditional based operation. So, if the condition is true then process a set of commands, otherwise, process some other commands/action. The syntax of this is:

if [ <conditional statement> ]
< statements >    <--------- these statements gets executed if condition is true.
< statements >   <--------- these statements gets executed if condition fails.

Learn Shell Scripting -- Part 3

Let’s look into some of the commonly used built-in standard shell variables

In this section we are going to see some of the standard shell built-in variables which we generally use in shell scripting.

# echo $? →  this would show the exit status of the previous command run in shell (0 - success, anything other than 0 is considered as failure)

# echo $$ →  this shows current shell ID (when run inside a script this would print the PID assigned to the shell).

# echo $@ OR # echo $* →  this prints the arguments passed when called for execution.

# echo $# →  this would show up total number of arguments passed.

# echo $! →  this would report PID of previous background process.

# echo $_ → this would print last argument being used in the previous command in shell.

Friday, February 2, 2018

A few other (advanced) differences between RHEL7 & RHEL6

Extracting initramfs image

Using "skipcpio" command in RHEL7.x, otherwise, we use "gunzip" in earlier RHEL versions. So, the command to extract initramfs image file in RHEL7.x is given below:

# /usr/lib/dracut/skipcpio /boot/initramfs-$(uname -r).img | gunzip -c | cpio -id

In earlier versions, we could do this by using the command gunzip :

# gunzip -c /boot/initramfs-$(uname -r).img | cpio -i -d

Thursday, January 4, 2018

Introduction To Ansible ............. Simple, Easy & it is YAML

Now-e-days we get to hear a lot about automation specifically Infrastructure Automation. Technology has already shifted gears from manual way of controlling IT infrastructure towards automatic methods. This is much needed for today's fast/rapid changing technology or infrastructure as demands from customer end does also took a sharp turn from way of investing/setting up infrastructure towards hosted infrastructure which we call it as "Cloud". A commonly used term which basically allows/facilitates converting physical infrastructure into a framework which is easy to scale up and flexible which provides a virtual platform where everything is defined as service i.e IaaS (Infrastructure As A Service), PaaS (Platform As A Service), SaaS (Software As A Service) (cloud models) on the broader look. There is a similar wing where activities of operation and development could be closely associated which we commonly call it as "DevOps".  Yes, I'm talking about one such tool that is being used to automate tasks in infrastructure which is "Ansible". A simple, easy to use, easy to automate tasks i.e to write playbooks, easy to understand and it uses YAML (Yet Another Markup Language).