Monday, 11 May 2015

RAID with LVM Configuration in RHEL7


In this tutorial, we will create RAID Level 5 device using 3 disks. On top of this RAID array, we will create a LVM partition. RAID with LVM configuration gives us several advantages over a traditional system:

1) RAID 5 gives fault tolerance. If one of our disks fails, our data remains intact.  
2) LVM gives us resizable volumes (partitions).
3) More disk space can be easily be added without the need to recreate any partition. Disks can be added to the RAID array and the LVM volume group can be extended. 

For basic RAID configuration, refer to this post . And for basic LVM configuration, refer to this post

Consider 3 disks,  /dev/sda, /dev/sdb, /dev/sdc each of size 1Gb. We will assemble these 3 disks into 1 logical RAID 5 device. We will add this RAID 5 device to a Volume Group. From the volume group, we will create a logical volume.

1) Create partitions /dev/sda1, /dev/sdb1, /dev/sdc1 on the devices  /dev/sda, /dev/sdb, /dev/sdc respectively.

2) Build a RAID 5 array '/dev/md0' with the above 3 partitions.
[root@server3 ~]# mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.


View Status
[root@server3 ~]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sdc1[3] sdb1[1] sda1[0]
      2093056 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]
unused devices: <none>

2) Initialize the RAID device as physical volume.
[root@server3 ~]# pvcreate /dev/md0
  Physical volume "/dev/md0" successfully created

3) Create a volume group consisting of the  physical volume initialized above.
[root@server3 ~]# vgcreate vg_linux /dev/md0
  Volume group "vg_linux" successfully created

The name of the volume group is 'vg_linux' and size is 2Gb as shown below.
[root@server3 ~]# vgdisplay
  --- Volume group ---
  VG Name               vg_linux
  Format                lvm2
  VG Access             read/write
  VG Status             resizable
  VG Size               1.99 GiB
  PE Size               4.00 MiB
  Total PE              510
  Alloc PE / Size       0 / 0  
  Free  PE / Size       510 / 1.99 GiB
  VG UUID               6tQeK2-NRmX-gaUb-jcfi-hlvR-2g6r-VxHk4P

4) Create a logical volume of size 1Gb, which you can mount and actually use.
[root@server3 ~]# lvcreate -L 1G -n lv_data vg_linux
  Logical volume "lv_data" created
 
The logical volume can now be accessed as '/dev/vg_linux/lv_data'.

5) Create filesystem on the logical volume 'lv_data'.
[root@server3 ~]# mkfs -t xfs /dev/vg_linux/lv_data

6) Create mount point
[root@server3 ~]# mkdir /var/data

7) Mount the logical volume 'lv_data' and create files in it.
[root@server3 ~]# mount -t xfs /dev/vg_linux/lv_data  /var/data
[root@server3 ~]# touch /var/data/foo{1,2,3}
[root@server3 ~]# ls /var/data/
foo1  foo2  foo3

8) Add the following entry in '/etc/fstab' (to automatically mount the logical volume at boot time).
          /dev/vg_linux/lv_data            /var/data         xfs           defaults        1  2

1 comment:

  1. SSN FULLZ AVAILABLE

    Fresh & valid spammed USA SSN+Dob Leads with DL available in bulk.

    >>1$ each SSN+DOB
    >>3$ each with SSN+DOB+DL
    >>5$ each for premium fullz (700+ credit score with replacement guarantee)

    Prices are negotiable in bulk order
    Serious buyer contact me no time wasters please
    Bulk order will be preferable

    CONTACT
    Telegram > @leadsupplier
    ICQ > 752822040
    Email > leads.sellers1212@gmail.com

    OTHER STUFF YOU CAN GET

    SSN+DOB Fullz
    CC's with CVV's (vbv & non-vbv)
    USA Photo ID'S (Front & back)

    All type of tutorials available
    (Carding, spamming, hacking, scam page, Cash outs, dumps cash outs)

    SMTP Linux Root
    DUMPS with pins track 1 and 2
    WU & Bank transfers
    Socks, rdp's, vpn
    Php mailer
    Sql injector
    Bitcoin cracker
    Server I.P's
    HQ Emails with passwords
    All types of tools & tutorials.. & much more

    Looking for long term business
    For trust full vendor, feel free to contact

    CONTACT
    Telegram > @leadsupplier
    ICQ > 752822040
    Email > leads.sellers1212@gmail.com

    ReplyDelete