How To Configure Swap Over Raid Over LVM Over Loop Devices Or How To Delete Them In Redhat Linux Rhel-4&5

In This Tutorial We Are Going To Learn How To Configure Swap Over Raid And Raid Over Lvm And Lvm Over Loop Devices Or How To Delete Them In 10 Simple And Easy Steps

First check this Diagram Also

Step-1 Firstly We Have To Create Loop Devices Or before Created Loop Devices We Have To Create The File And Then By Using This File We Create File As A Loop Devices

So Now Here Is The Command Of Creating The File

#dd if=/dev/zero of=a bs=1M count=500 {By Using This Command We Are Creating A File Of 500MB}
#dd if=/dev/zero of=b bs=1M count=500
#dd if=/dev/zero of=c bs=1M count=500
#dd if=/dev/zero of=d bs=1M count=500

Now We Have To Create A Loop Devices By USing Thie File

Step-2 Here Is The Command Of Creating Loop Devices

#losetup /dev/loop0 a {a Is The Name Of File}
#losetup /dev/loop1 b {b Is The Name Of File}
#losetup /dev/loop2 c {c Is The Name Of File}
#losetup /dev/loop3 d {d Is The Name Of File}

Now Our Portion Of Creating A Loop Devices Is Ready Now We Have To Create Lvm Using This Loop Devices

Step-3 Here IS The Command Of Creating LVM {Logical volume Management}

For Creating LVM First We Have To Create Physical Volume

#pvcreate /dev/loop0 /dev/loop1 /dev/loop2 /dev/loop3
#Pvs  { For Check Physical Volume IS Created Or Not}
#Pvs Display { For Check Physical Volume IS Created Or Not In Detail}

After Created Physical Volume Now We Have To Create Volume Group

#vgcreate vg00 /dev/loop0 /dev/loop1 /dev/loop2 /dev/loop3
#vgs { For Check Volume Group IS Created Or Not}
#vgs display { For Check Volume Group IS Created Or Not In Detail}

After We Created Volume Group Now We Have To Create Logical Volume

#lvcreate -L+1G -n Lv1 vg00
#lvs { For Check Logival Volume IS Created Or Not}
#lvs Display { For Check Logival Volume IS Created Or Not In Detail}
#lvcreate -L+1G -n Lv2 vg00
#lvs { For Check Logival Volume IS Created Or Not}
#lvs Display { For Check Logival Volume IS Created Or Not In Detail}

Here We Created Logical Volume

Now Our Portion Of Creating The LVM Is Complete Now We Have To Create Raid

Step-4 Here IS The Coading Of Creating Raid-1

#mdadm –create /dev/md0 –level=1 –raid-devices=2 /dev/vg00/Lv1 /dev/vg00/Lv2
#mdadm –detail /dev/md0 {For Check Raid Is Created Or Not}

Our Portion Of Creating The Raid-1 Is Complete Now We Have To Create Swap Over Raid 

step-5 Here IS The Coading Of Creating Swap

#mkswap /dem/md0
#swapon /dev/md0
#free-m {For Check Swap Is Created Or Not}

Now Our All Portion Of Creating Loop Device,LVM,Raid,Swap All Is Complete No We Have To Delete Them

Firstly We Have To Delete The Swap Then We Have To Delete The Raid Then Lvm Then Loop Devices Then All File Of 500MB Which We Created Before

Step-6 Here IS The Coding Of Deleting Swap

#Swapoff /dev/md0

Step-7 Here IS The Coding Of Deleting Raid-1

#mdadm –detail /dev/md0 {To Check Raid Partition}
#mdadm –stop /dev/md0   {To stop The Raid Partition}
#mdadm –remove /dev/md0 {To remove The Raid Partition}

Step-8 Here IS The Coding Of Deleting Lvm

First We Have To Remove Logical Volume Then Volume Group Then Physical Volume

#lvremove /dev/vg00/lv1
#lvs { For Check Logival Volume Is Deleted Or Not}
#lvs Display { For Check Logival Volume Is Deleted Or Not In Detail}
#lvremove /dev/vg00/lv2
#lvs { For Check Logival Volume Is Deleted Or Not}
#lvs Display { For Check Logival Volume Is Deleted Or Not In Detail}

Now Our Logical Volume Is Deleted Now We Have To Delete Volume Group

#vgremove /dev/vg00 
#vgs { For Check Volume Group Is Deleted Or Not}
#vgs display { For Check Volume Group Is Deleted Or Not In Detail}

Now Our Volume Group Is Deleted Now We Have To Delete Physical Volume

#pvremove /dev/loop0 /dev/loop1 /dev/loop2 /dev/loop3
#Pvs  { For Check Physical Volume Is Deleted Or Not}
#Pvs Display { For Check Physical Volume Is Deleted Or Not In Detail}

Step-9 Here IS The Coding Of Deleting Loop Device


#losetup -d /dev/loop0 
#losetup -d /dev/loop1  
#losetup -d /dev/loop2 
#losetup -d /dev/loop3 

Step-10 Here Is The Coding Of Deleting The File

#rm -rf a {a Is The Name Of File}
#rm -rf b {b Is The Name Of File}
#rm -rf c {c Is The Name Of File}
#rm -rf d {d Is The Name Of File}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s