NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction THE MAGIC OF LVMTHE MAGIC OF LVM.

Slides:



Advertisements
Similar presentations
Storage Management Lecture 7.
Advertisements

Chapter 12: File System Implementation
By Rashid Khan Lesson 6-A Place for Everything: Storage Management.
Chapter 9 Part III Linux File System Administration
System Administration Storage Systems. Agenda Storage Devices Partitioning LVM File Systems.
Linux Installation LINUX INSTALLATION. Download LINUX Linux Installation To install Red Hat, you will need to download the ISO images (CD Images) of the.
04/21/2004CSCI 315 Operating Systems Design1 Disk Management.
File Systems.
L V M A Logical Volume Manager for Linux by Heinz Mauelshagen Sistina, Inc.
Managing Your Hard Disk and Operating System 23,26 March :30pm - 4:00pm.
Operating Systems File Systems (in a Day) Ch
Operating Systems File Systems (Select parts of Ch 6)
Chapter 7: Configuring Disks. Configuring File Systems Fat32 –First used with Windows 95 OSR2 –Smaller cluster sizes, more efficient storage up to 32.
70-270, MCSE/MCSA Guide to Installing and Managing Microsoft Windows XP Professional and Windows Server 2003 Chapter Five Managing Disks and Data.
RAID Systems CS Introduction to Operating Systems.
Disk Volume Management CSS-1. Terms  Extent – any contiguous set of clusters  Partition – extent treated as a disk  Volume - partition formatted with.
Session 3 Windows Platform Dina Alkhoudari. Learning Objectives Understanding Server Storage Technologies Direct Attached Storage DAS Network-Attached.
FDISK Partitioning Hard Disks. History We bought our new hard disk drive –Right size for BIOS and OS –Right connections (PATA/SATA) We installed our new.
Week 10 Project 3: An Introduction to File Systems
1 Partitioning a Hard Drive ©Richard Goldman Revised January 8, 2001 Revised December 9, 2002.
Storage and NT File System INFO333 – Lecture Mariusz Nowostawski Noria Foukia.
Using Large Hard Drives in Linux Presented by Kevin McGregor Manitoba UNIX User Group March 12, 2013.
Chapter Sixteen Data Recovery and Fault Tolerance.
RAID RAID stands for Redundant Array of Inexpensive (Independent) Disks.
Disk Access. DISK STRUCTURE Sector: Smallest unit of data transfer from/to disk; 512B 2/4/8 adjacent sectors transferred together: Blocks Read/write heads.
Introduction to Hard Drives Chapter 6 - Key Terms Information Compiled by Diane Ferris, Michele Henderson & Vicki Kertz.
Chapter 3 Managing Disk and File Systems. File Storage Basics Windows XP supports two types of storage Basic Dynamic Basic storage system Centers on partitioning.
C HAPTER 7 Managing Disk and File System. I NTRODUCING DISK MANAGEMENT 2 types of hard disk storage supported by Windows XP are: basic hard disk & dynamic.
4.1 © 2004 Pearson Education, Inc. Exam Managing and Maintaining a Microsoft® Windows® Server 2003 Environment Lesson 4: Organizing a Disk for Data.
11 INSTALLING AND MANAGING STORAGE DEVICES IN WINDOWS XP Chapter 8.
MCTS Guide to Microsoft Windows Vista Chapter 4 Managing Disks.
Hp education services education.hp.com 50 LVM Problems Version C.00 H4264S Module 6 Slides.
File System Management File system management encompasses the provision of a way to store your data in a computer, as well as a way for you to find and.
1 Interface Two most common types of interfaces –SCSI: Small Computer Systems Interface (servers and high-performance desktops) –IDE/ATA: Integrated Drive.
Managing Disks and Drives Chapter 13 powered by dj.
Chapter 1 Managing Storage. Contents Understanding Partitioning Understanding LVM Understanding RAID Understanding Clustering and GFS Using Access Control.
Chapter 3 Partitioning Drives using NTFS and FAT32 Prepared by: Khurram N. Shamsi.
Windows Server 2003 硬碟管理與磁碟機陣列 林寶森
Configuring Disk Devices. Module 4 – Configuring Disk Devices ♦ Overview This module deals with making partitions using fdisk, implementing RAID and Logical.
File Storage Organization The majority of space on a device is reserved for the storage of files. When files are created and modified physical blocks are.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
Davie 5/18/2010.  Thursday, May 20 5:30pm  Ursa Minor  Co-sponsored with CSS  Guest Speakers  Dr. Craig Rich – TBA  James Schneider – Cal Poly.
Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration.
Storage Management: MirrorDisk/UX, Online JFS Introduction LVM Striping Mirror Disk / UX – Basics Online Backups (lvsplit) Mirror Disk / UX – Advanced.
MCTS GUIDE TO MICROSOFT WINDOWS 7 Chapter 4 Managing Disks.
Adding a Hard Drive. BIOS / UEFI The Unified Extensible Firmware Interface (UEFI) defines a software interface between an operating system and platform.
Department of Computer Sciences, University of Wisconsin Madison DADA – Dynamic Allocation of Disk Area Jayaram Bobba Vivek Shrivastava.
Hands-On Microsoft Windows Server 2008 Chapter 7 Configuring and Managing Data Storage.
DIT314 ~ Client Operating System & Administration CHAPTER 7 MANAGING DISKS AND FILE SYSTEM Prepared By : Suraya Alias.
Logical Volume Management in Linux November 2006 Slide 1 Welcome Logical Volume Management in Linux Jeff Muse St. Louis Unix Users Group
Device Mapper tools: RAID, Logical Volume Manager, and LUKS encryption Alan Porter Triangle Linux Users Group.
CS Introduction to Operating Systems
Answer to Summary Questions
L V M A Logical Volume Manager for Linux by Heinz Mauelshagen
Linux Software RAID & LVM Patrick Ladd 5/2/2007.
Chapter 12: File System Implementation
Project 3: An Introduction to File Systems
Introduction To Computers
Introduction to Computers
Introduction to Computers
DADA – Dynamic Allocation of Disk Area
Device-mapper RAID tool Linux-Kongress Hamburg 2005
Partitioning a Hard Drive
Operating System Module 1: Linux Installation
Booting Up 15-Nov-18 boot.ppt.
OPS235: Week 5 Lab4: Investigations 1 – 3
Overview Continuation from Monday (File system implementation)
Modern PC operating systems
Partitioning & Formatting
Storage Management Lecture 7.
Presentation transcript:

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction THE MAGIC OF LVMTHE MAGIC OF LVM

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 2 LVM – an introduction LVM L OGICAL V OLUME M ANAGEMENT LVM - your new, better, more flexible and powerful partitions (and it'll probably make the coffee too) By Peter H. Larsen

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 3 Synopsis ➲ LVM provides logical partitions – called Volumes ➲ Volumes can easily be expanded when needed ➲ Does not suffer from the problems that static partition tables have ➲ Has built in raid 0 and 1 ➲ Snapshots and cloning supported

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 4 Agenda ➲ Hard drives and Traditional Partitions ➲ Why the need for change? ➲ LVM to the rescue – concepts ➲ LVM Components ➲ Demo ➲ Questions – please! And don't wait!

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 5 Hard drive anatomy ➲ Disk/device name ➲ Major/minor number ➲ Addressing: ● Track/Cylinder ● Head ● Sector ➲ MBR ➲ Partition Table ● Primary ● Extended ● Logical ● Boot

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 6 Traditional Partitions ➲ Static table ➲ Must be contiguous space ➲ Cannot extend partitions if space after them are already allocated ➲ Redundancy is built on top of partitions using “3 rd party” tools like md. ➲ Traditional PC bios code will still look for a “boot partition” to load after MBR. This means we still need a “real” boot partition.

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 7 LVM to the rescue ➲ Dynamic – can grow and change over time ➲ Is not contiguous storage. Logical volumes are allocated in blocks. Adding/subtracting space is EASY ➲ Resizing can be done non-linear A “partition” doesn't have to be contiguously allocated ➲ Redundancy built into LVM (raid 1). Supports raid 0 (striping) too ➲ Backup is easy using snapshots ➲ “Partitions” can span multiple disks

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 8 LVM Concepts ➲ Physical Volume ➲ Volume Group ➲ Logical Volume ➲ Disks belong to a group ➲ One or more logical volumes per group

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 9 The argument against single partition installs ➲ Cannot separate user-data and system data at upgrade ➲ Bad process can fill up whole system ➲ Very large block sizes ➲ Bad inodes / corruption impacts all of system including root ➲ Same file-system, cache etc. for all purposes

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 10 DM – Device Mapper ➲ LVM(2) builds on the Device Mapper (DM) ➲ DM provides a simple map of block devices to logical devices ➲ /sbin/dmsetup # dmsetup ls vgsys-lvswap (253, 5) vgsys-lvusr (253, 3) vgsys-lvroot (253, 0) vgsys-lvvar (253, 2) vgsys-lvvm (253, 7) vgsys-lvhome (253, 1) vgsys-lvtmp (253, 4) vgsys-lvu02 (253, 8) vgsys-lvu01 (253, 6)

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 11 LVM commands ➲ Physical Volume – starts with pv Physical Volume – starts with pv ➲ Volume Group – starts with vg Volume Group – starts with vg ➲ Logical Volume – starts with lv Logical Volume – starts with lv ➲ # lvm – a lvm shell # lvm – a lvm shell ➲ # dmsetup ls Device Mapper list # dmsetup ls Device Mapper list ➲ # pvdiskscan Scans all known devices for LVM # pvdiskscan Scans all known devices for LVM

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 12 Sample Environment ➲ 4 Disks (sda, sdb, sdc, sdd) ➲ First disk, sda, has existing system setup – two partitions. First partition is the /boot and the second partition is for LVM ➲ The 3 “new” disks have no yet been initialized. ➲ Goal: To setup LVM on the new disks in two volume groups

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 13 ➲ “Formats” device to hold LVM metadata. Can be applied to whole disks as well as traditional partitions ➲ # pvs Reports about the physical volumes ➲ # pvscan Scans the system for physical volumes ➲ # pvdisplay Show details about a physical volume ➲ # pvcreate Create physical volume ➲ # pvresize Resize phyiscal volume ➲ # pvremove Remove physical volume Commands – Physical Volume

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 14 Physcial Volume Examples # ls /dev/sd? /dev/sda /dev/sdb /dev/sdc /dev/sdd # fdisk -l /dev/sda Disk /dev/sda: 21.4 GB, bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of * 512 = bytes Device Boot Start End Blocks Id System /dev/sda1 * Linux /dev/sda e Linux LVM # pvscan PV /dev/sda2 VG vgsys lvm2 [19.88 GB / 1.94 GB free] Total: 1 [19.88 GB] / in use: 1 [19.88 GB] / in no VG: 0 [0 ]

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 15 Example: Creating Physical Volumes # pvcreate /dev/sdb Physical volume "/dev/sdb" successfully created # pvcreate /dev/sdc Physical volume "/dev/sdc" successfully created # pvcreate /dev/sdd Physical volume "/dev/sdd" successfully created # pvscan PV /dev/sda2 VG vgsys lvm2 [19.88 GB / 1.94 GB free] PV /dev/sdb lvm2 [20.00 GB] PV /dev/sdc lvm2 [50.00 GB] PV /dev/sdd lvm2 [50.00 GB]

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 16 Demo: Physical Volume Details # pvdisplay /dev/sdc --- NEW Physical volume --- PV Name /dev/sdc VG Name PV Size GB Allocatable NO PE Size (KByte) 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID 4vqNKs-DWDn-IsQc-3LkC-mWCI- KKGT-W5kfBE

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 17 Volume Groups ➲ Groups physical volumes together (whole disks or partitions). Conceptually, this is the hard drive ➲ # vgs List volume groups ➲ # vgscan Scan system for volume groups ➲ # vgcreate Create a volume group ➲ # vgremove Delete/remove a volume group ➲ Lots more utils – expansion, merge, split etc.

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 18 Example: Setup volume groups # vgcreate vgora /dev/sdb Volume group "vgora" successfully created # vgcreate vgdata /dev/sdc /dev/sdd Volume group "vgdata" successfully created # vgs VG #PV #LV #SN Attr VSize VFree vgdata wz--n G 99.99G vgora wz--n G 20.00G vgsys wz--n G 1.94G # vgscan Reading all physical volumes. This may take a while... Found volume group "vgdata" using metadata type lvm2 Found volume group "vgora" using metadata type lvm2 Found volume group "vgsys" using metadata type lvm2

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 19 Example: Volume Group Details # vgdisplay vgdata --- Volume group --- VG Name vgdata System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 7 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 1 Max PV 0 Cur PV 2 Act PV 2 VG Size GB PE Size 4.00 MB Total PE Alloc PE / Size / GB Free PE / Size 7678 / GB VG UUID Dbtqdw-HYHR-ZnG9-HcAZ-MPo2- MSRU-QUjcEX

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 20 Commands: Logical Volumes ➲ Structure to store data. Takes the direct place of partitions ➲ # lvs List existing volumes ➲ # lvscan Scan for available volumes ➲ # lvdisplay Display volume details ➲ # lvcreate Create new volume ➲ # lvextend Expand existing volume size ➲ # lvreduce Reduce existing volume size ➲ # lvchange Change existing volume attributes

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 21 Example: Logical Volume # lvcreate -L 10G -n lvu01 vgora Logical volume "lvu01" created # lvcreate -L 60G -n lvdata vgdata Logical volume "lvdata" created # lvs LV VG Attr LSize Origin Snap% Move Log Copy% lvdata vgdata -wi-a G lvu01 vgora -wi-a G lvhome vgsys -wi-ao 4.00G lvroot vgsys -wi-ao 2.00G lvswap vgsys -wi-ao 1.94G lvtmp vgsys -wi-ao 2.00G lvusr vgsys -wi-ao 4.00G lvvar vgsys -wi-ao 4.00G

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 22 Logical Volume Details # lvdisplay --- Logical volume --- LV Name /dev/vgdata/lvdata VG Name vgdata LV UUID Aj60Fh-uPZO-c2er-rSUH-xqMt- 38Pu-gqAt7p LV Write Access read/write LV Status available # open 0 LV Size GB Current LE Segments 2 Allocation inherit Read ahead sectors 0 Block device 253:7

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 23 How is it allocated? ➲ Volume is allocated in “blocks” called extents ➲ Extents does not have to be allocated contiguously ➲ Adding more – or subtracting space, is a matter of moving blocks/extents around ➲ If reducing the size of a volume, remember to reduce the content FIRST (reduce the size of the file system).

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 24 Snapshots ➲ LVM1 supported read-only snapshots (2.4 kernels) ➲ LVM2 support RW snapshots ➲ Snapshots store changes. A snapshot of a 50GB disk takes almost no space if there are no changes. ➲ Changes to the original disk causes more data allocation to store “the difference” ➲ Changes are allowed directly onto the snapshot – will not effect original volume

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 25 Mirroring and Striping ➲ One or more mirror copies of a logical volume ➲ This is NOT real raid – the mirror copy may be on the same disk. There are no “degraded” functionality with LVM. ➲ Mirror helps if there are read/write errors on the disk. Does not help if the disk is lost. ➲ Raid 0 – stripping is supported. Goes across physical volumes

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 26 Device Mapping ➲ Use # dmsetup ls to view the actual device mapping for each lvm ➲ Common implementation is /dev/ /. ➲ Alternative /dev/mapper/ -

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 27 Metadata maintenance ➲ Is stored on the physical volume ➲ And in /etc/lvm ➲ /etc/lvm/lvm.conf is global defaults to control LVM behaviour (normally no change needed) ➲ # vgcfgbackup writes metadata to /etc/lvm/backup/ ➲ # vgcfgrestore restores visa versa ➲ When backing up your system, remember: partition table layout and LVM metadata must be easily accessible on “pre- restore” ➲ UUID glues things together – device names do not

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 28 Demo ➲ Use desktop with 3 blank drives ➲ Create/allocate physical volumes ➲ Create multiple volume groups ➲ Add logical volumes ➲ How to query/view LVM information

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 29 More Demo – if time allows ➲ Adding space - expansion ➲ Snapshots and backups ➲ Striping volumes ➲ Mirroring volumes ➲ LVM configuration files ➲ LVM recovery ➲ How to build on software raid

NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction 30 Questions?