The RAID stands as Redundant Array of Independent Disks . RAID is a technology that employs the simultaneous use of two or more partitions on the same or different hard disk drives to achieve greater levels of performance and reliability. It is a fault tolerance mechanism in which the data is not lost even if one of the disk fails.

Types of RAID
  • Hardware RAID
  • Software RAID
Parity

Firstly It is used for fault tolerance.Sometimes it is calculated by using XOR tables. If one hard disk is lost the data on the other hard disk is xor with the parity and the original data is retrieved.

Redundant Array of Independent Disks (RAID) levels
  • Striping without parity  (RAID 0)
  • Disk mirroring (RAID 1)
  • The Parity (RAID 4)
  • Striping with parity (RAID 5)
RAID 0
  • Minimum 2 hard disks required.
  • Can support maximum 32 hard disks.
  • Data is written simultaneously and evenly across the multiple hard disks.
  • The reading and writing speed is faster.
  • Fault tolerance is not available.
RAID 1
  • Works with only 2 hard disks.
  • Same data is simultaneous written on both the disk.
  • The reading speed is fast and the writing speed is slow.
  • Fault tolerance is available.
  • Overhead is 50%
RAID 4
  • Minimum 3 hard disks required.
  • Can support maximum 32 hard disks.
  • One of the disk is reserved for parity.
  • Data is written simultaneously and evenly across the remaining disks.
  • The reading and writing speed is fast.
  • Fault tolerance is available.
  • Overhead 1 hard disk
RAID 5
  • Minimum 3 hard disks required .
  • Can support maximum 32 hard disks.
  • Data is written simultaneously and evenly across multiple hard disks.
  • The parity is written equally on all disks.
  • The reading and writing speed is fast.
  • Fault tolerance is available.
Creating Partitions

Firstly Make multiple partitions

# fdisk <device>

Then Update the partition table

# partprobe <device>
RAID Commands

After that To club all partitions into a RAID array

# mdadm –C /dev/md0 -n <No. of partitions> <partition 1> <partition 2> <partition 3> -l <level>

Secondly Formatting the RAID device

# mkfs.ext3 /dev/md0

Then Making a mount point

# mkdir <directory name>

Finally Mounting the RAID partition

# mount /dev/md0 < directory name>

As soon as To make a partition faulty

# mdadm  -f  /dev/md0 < faulty partition>

After that To remove a partition from the RAID array

# mdadm  -r  /dev/md0 < partition>

Add a new partition to the RAID array

# mdadm  -a  /dev/md0 <new partition>

Secondly To display the RAID device

# mdadm  -d  /dev/md0

After all To stop the RAID

# mdadm  -s  /dev/md0

Note: first it has to be unmountd before it can be stopped.

Then To assemble a RAID

# mdadm  -a  /dev/md0 <partition1> <partition2> <partition3>

Backup

  • Backup is the process of copying the data to another location.
  • It is used to prevent the loss of data.
  • Users can take a backup only of their own data.
  • The complete backup can only be taken by root.
Types of Backup
  • Full backup
  • The backup of the complete data.
  • Incremental backup
  • It includes files that were changed since the last backup.
Commands for Backup
  • Tar (Tape Archive)
  • Dump
Backup using tar Command

To backup and restore using tar commands

# tar <options> <destination> <source>

Options
-c            Create                                                  -t             table of  content
-x            Extract/restore                                 -z            zip
-v            Verbose                                               -f             File

Backup using dump Command

To backup using dump commands

# dump <options> <destination> <source>

Options
-n            n is an integer between 0 and 19 () means full backup)
-u            Update dump database file (/etc/dumpdates)
-f             filename

To restore the backup created by using the dump command

# restore <options> <destination> <source>

Options
-t             Table of contents
-r             Restore
-f             Filename

Congratulation now you have learned the Linux Raid and Backup using the Cheat Sheet on Linux.