linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] lvm raid1
@ 2015-06-08 13:33 Vasiliy Tolstov
  2015-06-08 22:57 ` Georges Giralt
  0 siblings, 1 reply; 4+ messages in thread
From: Vasiliy Tolstov @ 2015-06-08 13:33 UTC (permalink / raw)
  To: linux-lvm

Hi. I have such hardware:
/dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf (500Gb ssd)

1) i want to create raid1 using lvm raid1 personalities with 100Mb
size on top of this disk
2) i want to create lv and format it to ext4/xfs of free space on each disk

If this is not possible with only lvm, how i can do this ? ( simple
create two lv on each disk and create via mdadm raid1? )

-- 
Vasiliy Tolstov,
e-mail: v.tolstov@selfip.ru

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-lvm] lvm raid1
  2015-06-08 13:33 [linux-lvm] lvm raid1 Vasiliy Tolstov
@ 2015-06-08 22:57 ` Georges Giralt
  2015-06-09 19:00   ` MegaBrutal
  0 siblings, 1 reply; 4+ messages in thread
From: Georges Giralt @ 2015-06-08 22:57 UTC (permalink / raw)
  To: linux-lvm

Hello Vassiliy
Do the other way around :
Make an array using mdadm (md0)
Run pvcreate on it and build your VG with this (these) PVs. (pvcreate 
/dev/md0)
Then build all the LV you want on this VG
Le 08/06/2015 07:33, Vasiliy Tolstov a �crit :
> Hi. I have such hardware:
> /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf (500Gb ssd)
>
> 1) i want to create raid1 using lvm raid1 personalities with 100Mb
> size on top of this disk
> 2) i want to create lv and format it to ext4/xfs of free space on each disk
>
> If this is not possible with only lvm, how i can do this ? ( simple
> create two lv on each disk and create via mdadm raid1? )
>

-- 
If the only tool you have is a hammer, you tend to see every problem as a nail.
                 Abraham Maslow
A British variant :
Any tool can serve as a hammer but a screwdriver makes the best chisel.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-lvm] lvm raid1
  2015-06-08 22:57 ` Georges Giralt
@ 2015-06-09 19:00   ` MegaBrutal
  2015-06-09 20:14     ` Georges Giralt
  0 siblings, 1 reply; 4+ messages in thread
From: MegaBrutal @ 2015-06-09 19:00 UTC (permalink / raw)
  To: LVM general discussion and development

Hi,

You can also create a VG from all the disks and then create raid1 LVs
on it. It depends on which is more convenient for you.

Here are some pros and cons I can think of (note that others may have
different views):

LVM over software RAID (mdadm):
– First you create your array with mdadm, and then run pvcreate on it,
form a VG, and then you can create your LVs.
– This way, you have more control over the RAID1 layer, as you can set
spare devices. The array is automatically rebuilt on the spare disk
when one of your active disks fails.
– Creating LVs is more convenient, as you don't need to bother with
mirroring them over the LVM layer.
– You can't choose which LVs to mirror and which LVs to not mirror.
Your entire VG is mirrored, so you can't differentiate between
important data and less important data.
– All of your disks need to be of the same size.

RAID over LVM:
– First you run pvcreate on all your disks and then add them to a VG.
(Note: it is highly recommended to partition the disks to have a valid
MBR/GPT, and then run pvcreate on the partitions. Thus, your pvcreate
command should look like: "pvcreate /dev/sda1 /dev/sdb1 /dev/sdc1
/dev/sdd1 /dev/sde1 /dev/sdf1".)
– You have less control over the RAID layer, as you can't set spare
devices (as far as I know), and if a disk fails, manual intervention
is necessary to remove the faulty disk from the VG and begin the
resynchronization to a new disk. (See the manual pages for "vgreduce
--removemissing", "lvconvert --replace", "lvconvert --repair".)
– You need to create your LVs like: "lvcreate --type raid1 --mirrors 3
..." to have mirrored LVs. LVM will take care of the RAID1 mirroring.
You can completely forget about mdadm, you won't even need to touch
it, ever.
– You can have LVs with different RAID levels in one VG. You can
choose to have more mirrors for more critical data and less mirrors
(or no mirror) for less important data. This way, you can manage your
storage more effectively, especially if your disks are not all the
same sizes.
– Your disks don't have to be of the same sizes. E.g. you can have
1TB, 500GB, 500GB disks and then seamlessly mirror everything from the
1TB disk to the other two. LVM will not complain. This scenario is not
possible with mdadm.

Personally, I consider RAID over LVM superior, as it is more dynamic
and allows more effective optimization of storage space. On the other
hand, when all your disks are the same size, and you need more control
over the RAID layer, need to set spare devices, and want your array to
rebuild without intervention, or you need higher RAID levels, mdadm
can be more effective. (LVM can also handle RAID4,5,6,10, but probably
with higher overhead and with less performance with mdadm – however,
it is just my intuition, please search for actual benchmark results if
this is your aim.)


MegaBrutal



2015-06-09 0:57 GMT+02:00 Georges Giralt <georges.giralt@free.fr>:
> Hello Vassiliy
> Do the other way around :
> Make an array using mdadm (md0)
> Run pvcreate on it and build your VG with this (these) PVs. (pvcreate
> /dev/md0)
> Then build all the LV you want on this VG
> Le 08/06/2015 07:33, Vasiliy Tolstov a écrit :
>>
>> Hi. I have such hardware:
>> /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf (500Gb ssd)
>>
>> 1) i want to create raid1 using lvm raid1 personalities with 100Mb
>> size on top of this disk
>> 2) i want to create lv and format it to ext4/xfs of free space on each
>> disk
>>
>> If this is not possible with only lvm, how i can do this ? ( simple
>> create two lv on each disk and create via mdadm raid1? )
>>
>
> --
> If the only tool you have is a hammer, you tend to see every problem as a
> nail.
>                 Abraham Maslow
> A British variant :
> Any tool can serve as a hammer but a screwdriver makes the best chisel.
>
>
> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-lvm] lvm raid1
  2015-06-09 19:00   ` MegaBrutal
@ 2015-06-09 20:14     ` Georges Giralt
  0 siblings, 0 replies; 4+ messages in thread
From: Georges Giralt @ 2015-06-09 20:14 UTC (permalink / raw)
  To: linux-lvm

Hello MegaBrutal,
You wrote for mdadm :

Le 09/06/2015 13:00, MegaBrutal a écrit :
> – All of your disks need to be of the same size.
This is not true.
The md will have the smallest size of the disks. (Behavior which is 
mandatory because modern disks DO NOT have exactly the same capacity 
even if same P/N... )
This behavior is useful to increase capacity : you add one bigger disk, 
synchronize the array then do the same with the second disk. When the 
array is in sync you can extend it to the size of the new disks. Then 
extend the VG to tell it has bigger PV than before et voila !
I use this in production on a couple of servers for 10 years and it is 
perfect.
Of course if you are trying to get all the speed possible it may not 
compete with a dedicated array card.
Hope this helps

-- 
If the only tool you have is a hammer, you tend to see every problem as a nail.
                 Abraham Maslow
A British variant :
Any tool can serve as a hammer but a screwdriver makes the best chisel.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-09 20:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-08 13:33 [linux-lvm] lvm raid1 Vasiliy Tolstov
2015-06-08 22:57 ` Georges Giralt
2015-06-09 19:00   ` MegaBrutal
2015-06-09 20:14     ` Georges Giralt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).