Connect with us

Hi, what are you looking for?

Linux

Linux RAID and Backup Commands Cheat Sheet

Redundant Array of Independent Disks (RAID)

  • RAID is a technology that employs the simultaneoud 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
RAID levels
  • RAID 0 (striping without parity)
  • RAID 1 (disk mirroring )
  • RAID 4 (parity)
  • RAID 5 (striping with parity)
Parity
  • Parity is used for fault tolerance.
  • Parity 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 retrived.
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
Make multiple partitions
[root@techbrown.com~]# fdisk <device>
 Update the partition table
[root@techbrown.com~]# partprobe <device>
RAID Commands
To club all partitions into a RAID array
[root@techbrown.com~]# mdadm –C /dev/md0 -n <No. of partitions> <partition 1> <partition 2> <partition 3> -l <level>
Formatting the RAID device
[root@techbrown.com~]# mkfs.ext3 /dev/md0
Making a mount point
[root@techbrown.com~]# mkdir <directory name>
Mounting the RAID partition
[root@techbrown.com~]# mount /dev/md0 < directory name>
To make a partition faulty
[root@techbrown.com~]# mdadm  -f  /dev/md0 < faulty partition>
To remove a partition from the RAID array
[root@techbrown.com~]# mdadm  -r  /dev/md0 < partition>
Add a new partition to the RAID array
[root@techbrown.com~]# mdadm  -a  /dev/md0 <new partition>
To display the RAID device
[root@techbrown.com~]# mdadm  -d  /dev/md0
To stop the RAID
[root@techbrown.com~]# mdadm  -s  /dev/md0

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

To assemble a RAID
[root@techbrown.com~]# 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
[root@techbrown.com~]# 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
[root@techbrown.com~]# 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
[root@techbrown.com~]# restore <options> <destination> <source>

Options
-t             Table of contents
-r             Restore
-f             Filename
Congratulations now have learned the Linux RAID and Backup Commands.

Advertisement. Scroll to continue reading.
Comments
Advertisement
Advertisement

Linux

DNF stands Dandified YUM and this is the default package manager for RHEL 8 / CentOS 8.  This tutorial explains you how to create...

Linux

If you forget a root password of your RHEL 8 and CentOS 8 and want to reset the password so that the RHEL 8...

Windows

How to auto upgrade JioFi firmware for JioFi 2 / JioFi 3 / JioFi 4 / JioFi 5 / JioFi 6 and other JioFi...

Linux

How to Upgrade WordPress Server from Ubuntu 16.04 to Ubuntu 18.04. Right now, Ubuntu 18.04 has been released with tons of new features. Upgrading...

Linux

How to Enable TLS 1.3 on Nginx Web Server. Nginx is a ultra fast web server optimized for modern web applications and servers. TLS...

Advertisement

You May Also Like

Windows

How to auto upgrade JioFi firmware for JioFi 2 / JioFi 3 / JioFi 4 / JioFi 5 / JioFi 6 and other JioFi...

Windows

How to download and install the Mobile Intel 4 Series Express Chipset Graphics Drivers for Windows 10.  Windows 10 is the one of the...

Windows

Internet is the most important public network for connecting to the WEB. For internet connection requirement the ISP is required as well as it...

Windows

How to Install and Configure PCSX2 on Windows 10. The Windows 10 is the most recommended operating system for the Games. In stream platform...