1. raid 0         ->stripping
2. raid 1         ->mirroring
3. raid 2 onwards ->parity check

TO CREATE RAID
Step 1. fdisk  /dev/sda  ->create 3 partitons and label as fd
Step 2. partprobe
Step 3. fdisk -l
Step 4. mdadm -C /dev/md0 -n 2 -l 1 /dev/sda8 /dev/sda9 ->create raid device
    where  n ->num of device l ->raid level
Step 5. cat /proc/mdstat             ->status of raid device
Step 6. mkfs.ext3 /dev/md0           ->format raid
Step 7. mkdir /raid
Step 8. mount /dev/md0 /raid         ->mount raid
Step 9. cp /etc/* /raid              ->put some contents to raid dir
Step 10.ls /raid/
Step 11.mount                      
Step 12.df -h
Step 13.vim /etc/fstab               ->mount raid permanently
   /dev/md0   /raid  ext3  defaults   1 2 (Add this line to /etc/fstab)
Step 14.mount -a

TO VERIFY RAID
Step 1. cat /proc/mdstat       –>status of raid device
Step 2. umount /raid
Step 3. mdadm –stop /dev/md0  –>stop raid device
Step 4. umount /raid
Step 5. cat /proc/mdstat      
Step 6. mkdir /test1             –>create dir for mounting raid partitions
Step 7. mkdir /test2
Step 8. mount /dev/sda8 /test1      –> mount partiton on dir
Step 9. mount /dev/sda9 /test2
Step 10.ls /test1
Step 11.ls /test2
Step 12.umount /test1                –>umount the partitions
Step 13.umount /test2
Step 14.mdadm –assemble /dev/md0 /dev/sda8 /dev/sda9 –>assemble partitions
Step 15.cat /proc/mdstat
Step 16.mount /dev/md0 /raid         –> mount back the raid
Step 17.cat /proc/mdstat
   
TO RECOVER A FAILED PARTITION
Step 1. cat /proc/mdstat
Step 2. mdadm –fail /dev/md0 /dev/sda8       //Fail a partition
Step 3. cat /proc/mdstat
Step 4. mdadm –add /dev/md0 /dev/sda10       //Add a partition
Step 5. mdadm –remove /dev/md0 /dev/sda8     //Remove faulty partition
Step 6. cat /proc/mdstat

FIELDS OF /ETC/FSTAB
Step 1.partition or label of partition
Step 2.Directory to mount the partition
Step 3.file system type
Step 4.Defaults (rw,ro,acl,quota)
Step 5.Dump (backup)  1->Take backup  0->dont take backup
Step 6.File system check  1->first priority 2 ->second priority
                     0->Dont check file system

a>. TO TAKE BACK UP OF PARTITION USING DUMP COMMAND
Step 1.dump -0uf 123 /boot    ->Take backup of /boot in 123 file
Step 2.du -h /boot/           ->check space of /boot and 123
Step 3.du -h 123
Step 4.mkdir /boot/extra      ->add some more contents to /boot dir
Step 5.cp /etc/* /boot/extra
Step 6.du -h /boot/extra/
Step 7.dump -1uf 456 /boot ->Again take backup of only newly added contents
Step 8.du -h 456
Step 9.du -h /boot/extra/

TO RESTORE BACK
Step 1.cd abc             ->go to dir where you want to restore
Step 2.restore -rf /456   ->where /456 is place where we took backup

b>. TO TAKE BACK UP  USING TAR COMMAND
Step 1.tar -cvf backup file1 file2 file3 ->c-create v-verbose f-file,take
                             backup of file1 to file3 in backup file
Step 2.tar   -tvf backup        ->t-list num of files  backed up
Step 3.tar   -xvf backup        ->x-extract files backed up in pwd.
Step 4.tar  -rvf backup  file4 file5 ->r-append more files to backed up file
Step 5.tar  -xvf backup -C /var ->Extract files inside /var dir

To uncompress and extract a file  gzip file
Step 1.gzip backup    ->compress the file
Step 2.tar  zxvf  backup  ->uncompress + extract the file

To uncompress and extract a file  bzip2 file
Step 1.bzip2 backup    ->compress the file
Step 2.tar  jxvf  backup  ->uncompress + extract the file

Comments

comments