In This Tutorial We Are Going To Learn How To Configure Swap Partition And Swap File Over Lvm And Lvm Over Raid 5
Now firstly We Have To Create Raid Then We Have To Create LVM And Then We Have To Create Swap Partition And Swap File Over Lvm
Here You Can Check The Diagram
For Creating Lvm Here We Have To Create First 3 Partition Which Type Is Raid
Step -1 Here First We Have To Create Raid Partition
fdisk -l
fdisk /dev/sda
n {for New Partition}
Select Partition 2
t {For Change The Type Of Partition}
fd {For Creating Raid Partition}
p {For Check Partition Is created Or Not}
w {For Save}
Partprobe /Dev/Sda {For Refresh}
fdisk -l
fdisk /dev/sda
n {for New Partition}
Select Partition 3
t {For Change The Type Of Partition}
fd {For Creating Raid Partition}
p {For Check Partition Is created Or Not}
w {For Save}
Partprobe /Dev/Sda {For Refresh}
fdisk -l
fdisk /dev/sda
n {for New Partition}
Select Partition 4
t {For Change The Type Of Partition}
fd {For Creating Raid Partition}
p {For Check Partition Is created Or Not}
w {For Save}
Partprobe /Dev/Sda {For Refresh}
If You Do Any Change In Hard Disk Then You Have To Run Command Partprobe Then Give The Hard Disk Name Where You Do Change
Now Or Partition Is Created Now We Have To Create Raid 5 Using This Partition
Step -2 Here Is The Coading Of Creating Raid
mdadm –create /dev/md0 –level=5–raid-devices=2 /dev/sda2 dev/sda3 /dev/sda4
Now Our Second Portion Of Create Raid Is Complete Nov We Have To Create Lvm
Step -3 Here Is the Coading Of Create Lvm
pvcreate /dev/sda2 /dev/sda3 /dev/sda4
pvs
vgcreate vg00 /dev/sda2 /dev/sda3 /dev/sda4
vgs
lvcreate -L+1G -n Lv1 vg00
lvs
lvcreate -L+1G -n Lv2 vg00
lvs
Step -4 Now We Have To Create Swap Partition Over Lvm In Lv1
Mkswap /dev/vg00/lv1
free-m
Swapon /dev/vg00/lv1
Step -5 Now We Have To Create Swap File Over Lvm In Lv2
dd if=/dev/zero of=/hacking bs=1M count=500
Free-m
Mkswap /hacking
swapon /hacking
This Is How All We Configure Swap Partition And Swap File Over Lvm And Lvm Over Raid 5