Sunday, November 17, 2019
Home Blog

What is RAID in Linux?

0

What is RAID? and Levels of RAID in Linux?

RAID (originally Redundant Array of Inexpensive Disks) now a commonly Redundant Array of Independent Disks is a data storage virtualization technology that combines multiple disk drive components into a logical unit for the purposes of data redundancy or performance improvement.

On most situations, you will be using one of the following four levels of RAIDs.

  1. Level 0 – striped disk array without fault tolerance
  2. Level 1 – mirroring and duplexing
  3. Level 2 – error-correcting coding
  4. Level 3 – bit-interleaved parity
  5. Level 4 – dedicated parity drive
  6. Level 5 – block interleaved distributed parity
  7. Level 6 – independent data disks with double parity
  8. Level 10 – a stripe of mirrors.

This article explains the main difference between these raid levels along with an easy to understand the diagram. In all the diagrams mentioned below:

A, B, C, D, E, and F – represents blocks

p1, p2, and p3 – represents parity

RAID Level 0

Following are the key points to remember for RAID level 0.

  • Minimum 2 disks.
  • Excellent performance ( as blocks are striped ).
  • No redundancy ( no mirror, no parity ).
  • Don’t use this for any critical system.

RAID LEVEL -1

Following are the key points to remember for RAID level 1.

  • Minimum 2 disks.
  • Good performance ( no striping. no parity ).
  • Excellent redundancy ( as blocks are mirrored ).

RAID LEVEL 5

Following are the key points to remember for RAID level 5.

Minimum 3 disks.

Good performance (as blocks are striped ).

Good redundancy (distributed parity).

Best cost-effective option providing both performance and redundancy. Use this for DB that is heavily read oriented. Write operations will be slow.

RAID LEVEL 10

 

Following are the key points to remember for RAID level 10

  • Minimum 4 disks.
  • This is also called as “stripe of mirrors”
  • Excellent redundancy ( as blocks are mirrored )
  • Excellent performance ( as blocks are striped )
  • If you can afford the dollar, this is the BEST option for any mission-critical applications (especially databases).

In most critical production servers, you will be using either RAID 5 or RAID 10.

How to Implement the RAID

Implementing the RAID will be two types

1. Software RAID and

2. Hardware RAID

 

How to reboot the production server in Linux ?

0

How to reboot the production server in Linux?

In general the production servers will not be rebooted frequently because the end users will suffer if the productions server are in down state.

If any changes made to the system like grub, Selinux policy, default run level is changed and if kernel patches are applied the system reboot is required.

If any inconsistency in root ( / ) file system, then take the business approval from higher authorities,make a plan for proper schedule and also inform to the different teams like application team to stop the application, database team to stop the databases, QC team to stop the testing, monitoring people to ignore the alerts from this server and other teams if any and then reboot the system with CD ROM in single user mode and then run #fsck command on that file system.

Related Articles:

How to take a Backup on Production Servers?

How to troubleshoot if the boot disk is not available?

How to set the Priority for a process in Linux?

If Operating System (O/S) disk is corrupted or damaged then, reboot the system temporarily with the mirror disk then fix that problem and again boot the system with original disk.

This is the full information about the how to Reboot the Production Server in Linux. If you have any doubts related to this, let us know.

How to change the password aging policies?

0

How to change the password Aging Policies?

In Linux, we can change the password policies in 2 ways.

(i) First open the /etc/login.defs file and modify the current values.

Example: # vim /etc/login.defs

min – 0: means the user can change the password to any no. of times.

min – 2: means the user can change the password within 2 days. ie., he can change the password after 2 days.

max – 5: means the user should change the password before or after 5 days. Otherwise the password will be expired after 5 days.

inactive – 2: means after password expiry date the grace period another 2 days will be given to change the password.

warning – 7: means a warning will be given to the user about the password expiry 7 days before expiry date.

Related Articles:

How to lock the user, if he enters wrong password multiple times?

How to set the Priority for a process in Linux?

(ii) second by executing the # chage command.

Example: # chage <options><user name>

The options are, -d –> last day

-E –> expiry date

-I –> inactive days

-l –> list all the policies

-m –> min. days

-M –> max. days

-w –> warning days

Note : Whenever we change the password aging policy using #chage command, the information is will be modified in /etc/shadow file.

Different ways to mount the NFS shared directory in Linux?

0

Mount the NFS shared directory in Linux

In order to access the NFS shared data, we have to mount that shared directory on local mount point. The mounting can be direct mount (manual mount) and indirect mount (auto mount).

Direct mount:

First create the local mount point and then mount that shared NFS directory on our local systems mount point by    # mount <server host name or IP address> : <shared directory with full path><mount point> command. But this is temporary mount and we can mount it permanently by put an entry in /etc/fstab file.

Indirect mount:

This method is used to mount the NFS share by using the Autofs service. Autofs uses the automount daemon to manage our mount points by only mounting them dynamically when they are accessed.

Autofs consults the master map configuration file /etc/auto.master to determine which mount points are defined. It then starts an automount process with the appropriate parameters for each mount point. Each line in the master map defines a mount point and a separate map file that defines the file systems to be mounted under this mount point. For example, the /etc/auto.misc file might define mount points in the /mnt directory; this relationship would be defined in the /etc/auto.master file.

Each entry in auto.master has three fields. The first field is the mount point. The second field is the location of the map file, and the third field is optional. The third field can contain information such as a timeout value.

For example, to mount the directory /product on the remote machine server9.example.com at the mount point /mnt/nfs on your machine, add the following line to auto.master:

/mnt   /etc/auto.misc –timeout 60

Next, add the following line to /etc/auto.misc:

nfs  -rw server9.example.com:/product

The first field in /etc/auto.misc is the name of the /mnt subdirectory. This subdirectory is created dynamically by automount. It should not actually exist on the client machine. The second field contains mount options such asrw for read and write access. The third field is the location of the NFS export including the hostname and directory.

Related Articles:

What is mounting? Types of Mounting in Linux?

Job Automation in Linux.

Mail Server Configuration in Linux.

The directory /mnt must be exits on the local file system. There should be no sub directories on the local file system.

To start the autofs service, at a shell prompt, type the following command:

# servive autofs restart

To view the active mount points, type the following command at a shell prompt:

# service autofs status

If you modify the /etc/auto.master configuration file while autofs is running, you must tell the automount daemon(s) to reload by typing the following command at a shell prompt:

# service autofs reload

This is the full information about the NFS Shared Directory. If you have any doubts about this, please let us know.

How to allow the root user to access the FTP server?

0

How to allow the root user to access the FTP server?

By default root user is blocked to access the FTP server. To allow the root user to access the FTP server follow the below steps.

  • Open the /etc/vsftpd/user_list file by # vim /etc/vsftpd/user_list command.
  • Go to root user line and comment on that line. For example # root (save and exit the file).
  • Open the /etc/vsftpd/ftpuser file by # vim /etc/vsftpd/ftpuser command.
  • Go to root user line and comment on that line. For example # root (save and exit the file).
  • Restart the ftp deamon by

# service vsftpd restart command in RHEL – 6

or

# systemctl restart vsftpd command in RHEL – 7

Even though we changed the above, the root user cannot access the FTP server because the home directory context is not added. we can solve this as follows.

  • # getsebool -a | grep ftp (to check the SELinux Boolean of the root home directory).
  • # setsebool -p ftp_home_dir on (to change the Boolean of the root home directory).

Now go to client system and try to login the FTP server as root user. Here we can access the FTP server.

Related Articles:

Follow the above 7 steps to allow the root user to access the FTP server. If you have any doubts related to this article please let us know.

What is Sosreport? and How to Generate it in Linux

0

What is Sosreport? and How to Generate it in Linux.

In this article we are clearly explained about Sosreport and How to Generate the Sosreport? Follow the below Step by step commands to generate the Sosreport without any error.

Sosreport is a command in linux (RHEL / CentOS) which collects system configuration and diagnostic information of your linux box like running kernel version, loaded modules, and system and service configuration files. This command also runs external programs to collect further information, and stores this output in the resulting archive.

Sosreport is required when you have open a case with redhat for technical support. Redhat support Engineers will require sosreport of your server for troubleshooting purpose.

To run sosreport , sos package should be installed. Sos package is part of default installation in most of linux. If for any reason this package is no installed , then use below yum command to install sos package :

# yum install sos -y

Related Articles:

What is journaling file system in Linux?

What is mounting? Types of Mounting in Linux?

How to remove the Physical Volume of LVM in Linux?

Generate the sosreport:

Open the terminal and type sosreport command:

# sosreport

This command will normally complete within a few minutes. Depending on local configuration and the options specified in some cases the command may take longer to finish. Once completed, sosreport will generate a compressed a file under /tmp folder. Different versions use different compression schemes (gz, bz2, or xz). The file should be provided to Redhat support representative (normally as an attachment to an open case).

Note: sosreport requires root permissions to run.

Different Options used in sosreport command:

The sosreport command has a modular structure and allows the user to enable and disable modules and specify module options via the command line. To list available modules (plug-ins) use the following command:

# sosreport -l

To turn off a module include it in a comma-separated list of modules passed to the -n/–skipplugins option. For  instance to disable both the kvmand amd modules:

# sosreport -n kvm, amd

Individual modules may provide additional options that may be specified via the -k option. For example on Red Hat Enterprise Linux 5 installations the sos rpm module collects “rpm -Va” output by default.

As this may be time-consuming the behaviour may be disabled via:

# sosreport -k rpm.rpmva=off

This is the full information about the Sos Report. If you have any doubts about Sos Report, please let us know.

Important Commands to search Files and Directories in Linux.

0

Important Commands to search files and directories in Linux

To search Files and Directories in Linux, there are two important commands.

They are

  1. # locate
  2. # find

Locate Command:

  • Locate command always looks at the locate database and not in a specific location. The data of the locate is stored in /var/lib/mlocate/mlocate.db file.
  • If the data is not updated in the locate database or the locate database is available or locate database is deleted, we cannot locate the files and directories.
  • # updatedb is the command to update the locate database.
  • locate database cannot find the newly created files and directories.
  • It is not recommended to use on production servers because it impacts on the performance of the servers.
  • So, to overcome this problem we normally use # find command on production servers.

# updatedb (to update the locate database)

# locate (to search the specified file or directory)

Search FIles and Directories in Linux

Related Articles:

What is a Link File in Linux ? and its types.

What is the File system and Types of File System in Linux?

What is the difference between Shadow files and Passwd files?

Find Command:

  • Find Command is one of the important commands in Linux to search files and Directories.
  • It is also one of the widely used commands in Linux and also very easy to use.
  • Find command required a specific location. Without a specific location, we cannot find the files or directories.

Use the below command, to search the files in a Specific Location.

# find <location><options><file or directory>   (to find the specific file or directory).

The options are,

-name —–> search files and directories

-prem —–> search for permissions

-size —–> search for sizes

-user —–> search for the owner

-uid —–> search for files/directories of uid)

-gid —–> search for files/directories of gid)

-group —–> search for group owner

-empty —–> search for empty files

-amin —–> search for access time

-mmin —–> ”   ”

-cmin —–> ”    ”

-atime —–> search for access day (access day, minutes, hrs, …etc)

-mtime —–> search for modify day (change the content)

-ctime —–> search for change day (permissions, …..etc)

This is the full information about the Find and Locate Commands to search files and Directories in Linux.

What are Signals in Linux?

0

Signals in Linux

Signals are a way of sending simple messages to processes. Most of these messages are already defined and can be found in <linux/signal.h>. However, signals can only be processed when the process is in user mode. If a signal has been sent to a process that is in kernel mode, it is dealt with immediately on returning to user mode.

Every signal has a unique signal name, an abbreviation that begins with SIG (SIGINT for interrupt signal, for example). Each signal name is a macro which stands for a positive integer – the signal number for that kind of signal. Your programs should never make assumptions about the numeric code for a particular kind of signal, but rather refer to them always by the names defined. This is because the number for a given kind of signal can vary from system to system, but the meanings of the names are standardized and fairly uniform.

Signals can be generated by the process itself, or they can be sent from one process to another. A variety of signals can be generated or delivered, and they have many uses for programmers. (To see a complete list of signals in the Linux environment, uses the command kill -l.)

What are signals in Linux

There are total 64 signals in Linux, the list of all the signal can be seen by

# kill –l

Related:

Special Permissions or Advanced Permissions in Linux.

What is the difference between Shadow files and Passwd files?

Important Signals in Linux

The most common signals used are

  • 1 for reloading the process.
  • 9 for killing the process.
  • 15 for Terminating the process.
  • 20 for stopping the process.

To kill the signal completely

To kill the signal, First, find out the process running in the system, let’s say by a user

# ps –u <user name>

Example: # ps –u musab

# kill <signal no> <process id>

Example: # kill -9 11591

Likewise, you can use other signals to kill the process like

# kill -15 <pid>

# kill -1 <pid>

To stop the process using a signal no. 20

To stop a process first login as a normal user and start a process

# su – musab

# cat > hello

Check its PID and kill it by using 20, # ps –u musab

# kill -20

If you have any doubts about Signals, Please let us know.