Presentation is loading. Please wait.

Presentation is loading. Please wait.

Linux Software RAID & LVM Patrick Ladd pladd@optonline.net 5/2/2007.

Similar presentations


Presentation on theme: "Linux Software RAID & LVM Patrick Ladd pladd@optonline.net 5/2/2007."— Presentation transcript:

1 Linux Software RAID & LVM Patrick Ladd 5/2/2007

2 Terminology : RAID RAID: Redundant Array of Inexpensive Disks
Combine 2 or more smaller disks into one larger disk Why? Redundancy Reduce or eliminate exposure to disk failure Performance More data under the drive heads Ease of management Single disk simplifies file system layout Capacity: n: Number of disks s: Size of disks

3 Software RAID vs Hardware RAID
Implemented at kernel level in OS Pros: More flexible Hardware independence Cheap Cons: Requires properly configured kernel Uses system resources Hardware RAID Built into card or motherboard Pros: Faster Battery backed option Cons: Hardware dependency Drivers? Expensive

4 RAID 0: Striping Not really RAID No redundancy Performance: Best
Capacity: Best (n x s) Reliability: Worst

5 RAID 1: Mirroring Fastest Least efficient disk usage
Disks added in pairs Performance: Best Capacity: Worst (n x s) / 2 Reliability: Best

6 RAID 5: Striping with Distributed Parity
Efficient space usage Good balance of features Requires n >= 3 Performance: Good Capacity: Good (n-1) x s Reliability: Good

7 Layered RAID RAID 51 RAID 10 RAID 01 RAID made up of RAID disks
Examples: RAID 01 / 0+1 – RAID 1 of RAID 0's RAID 10 – RAID 0 of RAID 1's RAID 05 – RAID 0 of RAID 5's RAID 50 – RAID 5 of RAID 0's RAID 51 – RAID 5 of RAID 1's Combine benefits of multiple RAID setups Hopefully to offset the drawbacks Tends to be storage inefficient RAID 10 RAID 01

8 LVM – What & Why LVM: Logical Volume Manager
Abstract the interface to storage devices Separate physical layer from file system layers Why? Ease of Management Flexible partitioning Human readable disk names Data migration flexibility Snapshots Alternate way to do RAID 0 (Striping)

9 LVM Objects Physical Volume (PV)
Represents physical hard drive partition Broken up into Physical Extents (PE) Logical Volume (LV) Virtual “partition” for O/S Broken up into Logical Extents (LE) Volume Group (VG) Collection of PVs and LVs Maps LEs to PEs

10 LVM Architecture OS LV LV LV LV LV VG VG PV PV PV PV PV Hard Drive

11 LVM Metadata UUID - Unique identifier stored in every VG, LV, PV
Header contained at start of every PV UUIDs of all other PVs UUIDs of all LVs Allocation map of PE-->LE

12 Mapping Modes Linear: Data from LV laid out sequentially in PVs
Striped: Data laid out alternately among 2 or more PVs Possibly some performance improvement if PVs are on separate physical hardware Concatenation: LVM2 allows extending LVs using one of the above two mapping modes with more data in another layout

13 Ubuntu Install Has LVM / RAID support
Must be done from alternate ISO image (i.e. ubuntu-6.10-alternate-i386.iso) Must be done in text mode

14 Fedora Core 6 Install LVM / RAID support
Includes Anaconda graphical installer support

15 LVM Common Commands Display object information - [pv|vg|lv]display
Create object - [pv|vg|lv]create Delete object – [pv|vg|lv]remove Change object – [pv|vg|lv]change Display metadata– [pv|vg|lv]s Rename – [vg|lv]rename

16 pvdisplay Output [root@laptop ~]# pvdisplay --- Physical volume ---
PV Name /dev/hda3 VG Name MainVG PV Size GB / not usable 9.59 MB Allocatable yes (but full) PE Size (KByte) Total PE Free PE Allocated PE PV UUID XH408a-y8Pz-RoHs-rEOD-RZcW-AFwB-vytZ5I

17 vgdisplay Output [root@laptop ~]# vgdisplay --- Volume group ---
VG Name MainVG System ID Format lvm2 Metadata Areas Metadata Sequence No 8 VG Access read/write VG Status resizable MAX LV Cur LV Open LV Max PV Cur PV Act PV VG Size GB PE Size MB Total PE Alloc PE / Size / 7.78 GB Free PE / Size / 0 VG UUID JYEdd7-mKC2-qAqS-1jsP-EWD4-UGVC-ZGn07n

18 lvdisplay Output [root@laptop ~]# lvdisplay --- Logical volume ---
LV Name /dev/MainVG/RootLV VG Name MainVG LV UUID DgwUgn-wb2F-K9Kn-PKcj-Ra0p-CwoO-FHpH44 LV Write Access read/write LV Status available # open LV Size GB Current LE Segments Allocation inherit Read ahead sectors 0 Block device :0

19 Resizing a Partition Pre LVM2 – e2fsadm
Nice tool to automatically take filesystem offline, resize logical volume, then resize filesystem, put volume back online Now - has to be done manually umount /tmp lvresize +10M /dev/MainVG/TmpLV ext2resize /tmp mount /tmp

20 Adding a drive Give drive a partition table
Safer – prevents other OS that don't recognize LVM from doing strange things to it Setup PV on partition (pvcreate) Add PV to VG (vgextend)

21 Converting to LVM Add 2nd Drive Set up LVM on it Mount it
Copy contents of existing drive to LVM Boot to new LVM image Ensure things work Add old drive as LVM physical volume Extend LVM onto old drive

22 Snapshots Create an exact copy of a LV
Can be read-only or read-write (default) Caution: copy on write means that snapshot must be large enough to handle writes lvcreate -L 500M -s -n BackupLV /dev/MainVG/TmpLV

23 Uses for Snapshots Read only Good for backups
Make sure applications / file system are consistent Force write of data to disk sync file system Read/Write Speculative experiments Try something out, if it doesn't work, remove snapshot and try again Virtual Machine images?

24 Sources Packages Needed RAID Support in kernel mdadm
LVM - Current incarnation is LVM2 Device mapper in kernel (most kernels built in) Device mapper in user space (device-mapper) Device mapper support library (libdevmapper) LVM Tools (lvm2) HOWTOs

25 EVMS EVMS – Enterprise Volume Management System Competitor to LVM Integrated support for RAID 0,1,4,5 Handles LVM & LVM2 volumes Better user-space tools LVM has better internals Not included in most pre-built kernels Has a nice GUI – works with LVM

26 EVMS GUI

27 EVMS Text GUI


Download ppt "Linux Software RAID & LVM Patrick Ladd pladd@optonline.net 5/2/2007."

Similar presentations


Ads by Google