Device Mapper tools: RAID, Logical Volume Manager, and LUKS encryption Alan Porter 2011-01-13 Triangle Linux Users Group.

Slides:



Advertisements
Similar presentations
Storage Management Lecture 7.
Advertisements

System Administration Storage Systems. Agenda Storage Devices Partitioning LVM File Systems.
Hands-on RAID on Moxa Computer Prepared by: (40min) Date: mm-dd-yyyy.
Linux Installation LINUX INSTALLATION. Download LINUX Linux Installation To install Red Hat, you will need to download the ISO images (CD Images) of the.
Grant Cohoe IMPACT OF DISK ALIGNMENT IN VIRTUALIZED ENVIRONMENTS.
Software RAID on linux with mdadm Campus-Booster ID: Copyright © SUPINFO. All rights reserved Software RAID.
Chapter 10: File-System Interface
L V M A Logical Volume Manager for Linux by Heinz Mauelshagen Sistina, Inc.
Linux Installation Chapter II. Linux Distributions Pre-packaged, installable Linux Anyone can compile a distribution, have to inculde GPL Available for.
Lecture 10: The FAT, VFAT, and NTFS Filesystems 6/17/2003 CSCE 590 Summer 2003.
Disk Volume Management CSS-1. Terms  Extent – any contiguous set of clusters  Partition – extent treated as a disk  Volume - partition formatted with.
Storage and NT File System INFO333 – Lecture Mariusz Nowostawski Noria Foukia.
Chapter Sixteen Data Recovery and Fault Tolerance.
RAID RAID stands for Redundant Array of Inexpensive (Independent) Disks.
Configuring RAID with mdadm. Raid ? Redundant Array of Inexpenisve Disks JBOD Raid 0,1,2,3,5,6 Combinations 10,0+1, etc...
Guide to Linux Installation and Administration, 2e 1 Chapter 9 Preparing for Emergencies.
Please Note: Information contained in this document is considered LENOVO CONFIDENTIAL For Lenovo Internal Use Only Do Not Copy or Distribute!! For Lenovo.
| nectar.org.au NECTAR TRAINING Module 9 Backing up & Packing up.
Hp education services education.hp.com 50 LVM Problems Version C.00 H4264S Module 6 Slides.
Installation Overview Lab#2 1Hanin Abdulrahman. Installing Ubuntu Linux is the process of copying operating system files from a CD, DVD, or USB flash.
Managing Disks and Drives Chapter 13 powered by dj.
Multiboot System under Windows XP – Ubuntu – Windows 7 Qiong LIN - 28 April 2012.
Chapter 1 Managing Storage. Contents Understanding Partitioning Understanding LVM Understanding RAID Understanding Clustering and GFS Using Access Control.
CSN08101 Digital Forensics Lecture 4: System Level Disk Control Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak.
Configuring Disk Devices. Module 4 – Configuring Disk Devices ♦ Overview This module deals with making partitions using fdisk, implementing RAID and Logical.
LVM & Mirror 中国惠普有限公司支持服务事业部 QIAN Yun Elements of LVM (逻辑卷管理器) physical Volumes 物理卷 volume Group 卷组 logical Volumes 逻辑卷 VG01 lvol1 /dev/rdsk/c0t0d0.
CIS Lesson 5 Lesson 5 New Skills Boot time GRUB edits (review) Changing BIOS boot order on a VM (review) Mounting CD ISO and floppy Image files on.
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.
System Administration – Part 2. Devices in UNIX are files: A device can be accessed with different file names All device files are stored in /dev or its.
Microsoft Windows XP Professional MCSE Exam
Storage Management: MirrorDisk/UX, Online JFS Introduction LVM Striping Mirror Disk / UX – Basics Online Backups (lvsplit) Mirror Disk / UX – Advanced.
| nectar.org.au NECTAR TRAINING Module 9 Backing up & Packing up.

Page 1 of 38 Lenovo Confidential Lenovo Confidential Lenovo Confidential Lenovo Confidential Lenovo Confidential Please Note: Information contained in.
Adding a Hard Drive. BIOS / UEFI The Unified Extensible Firmware Interface (UEFI) defines a software interface between an operating system and platform.
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
NovaLug May 2008NovaLug May 2008 For NovaLug An LVM Introduction THE MAGIC OF LVMTHE MAGIC OF LVM.
A Brief Look By: Aaron J Hudson What is Logical Volume Management? Software that allows the user to edit the storage configuration without manipulating.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com Embedded Linux Training System.
Boot Diskettes, Bootable USB Keys and Live CDs Used when the computer can't start for some reason, as a diagnostic, repair and recovery tool. Boot diskettes.
Kevin Brouelette OCLUG
Chapter 8 Adding Disks.
Storage HDD, SSD and RAID.
L V M A Logical Volume Manager for Linux by Heinz Mauelshagen
File System Interface CSSE 332 Operating Systems
CompTIA Server+ Certification (Exam SK0-004)
GRUB 2 Dave Soergel.
Chapter 11: File System Implementation
On The Fly Encryption OTFE
Linux Software RAID & LVM Patrick Ladd 5/2/2007.
Chapter 12: File System Implementation
Operating System I/O System Monday, August 11, 2008.
Storage and Filesystem
Journaling File Systems
Introduction To Computers
Introduction to Computers
HOW TO USE: MACOS SIERRA PATCHER TOOL FOR UNSUPPORTED MACS.
Operating System Module 1: Linux Installation
Booting Up 15-Nov-18 boot.ppt.
Linux File Systems Partitioning Mounting File Systems
Linux+ Guide to Linux Certification, Third Edition
OPS235: Week 5 Lab4: Investigations 1 – 3
Overview Continuation from Monday (File system implementation)
Btrfs Filesystem Chris Mason.
CSE 451: Operating Systems Winter 2009 Module 13 Redundant Arrays of Inexpensive Disks (RAID) and OS structure Mark Zbikowski Gary Kimura 1.
Mark Zbikowski and Gary Kimura
CSE 451: Operating Systems Winter 2012 Redundant Arrays of Inexpensive Disks (RAID) and OS structure Mark Zbikowski Gary Kimura 1.
Storage Management Lecture 7.
Presentation transcript:

Device Mapper tools: RAID, Logical Volume Manager, and LUKS encryption Alan Porter Triangle Linux Users Group

« RAID · LVM · LUKS » device mapper · losetup Device Mapper Maps one block device to another one. Does some sort of transformation position of blocks (RAID, LVM, kpartx, multipath) scrambling content (LUKS, cryptoloop, Truecrypt) caching content (dmcache)

« RAID · LVM · LUKS » device mapper · losetup Get familiar with block tools without using a bunch of disks. Loopback devices $ dd if=/dev/zero of=disk1 bs=1M seek=1023 count=1 $ losetup /dev/loop1 disk1 $ losetup -a /dev/loop1: [fc02]: (/home/alan/disk1) $ losetup -d /dev/loop1

« RAID · LVM · LUKS » levels · mdadm · failures · spares What RAID is: A “high-availability” feature. Insurance against disk failure. Used when you can not afford downtime when a disk goes bad. Sometimes used for speed. What RAID is NOT: Insurance against fat-fingering a file (rm *). A backup.

« RAID · LVM · LUKS » levels · mdadm · failures · spares RAID Levels 0 - striping, used for performance A single disk failure will destroy the array. 1 - mirroring, same data on all disks All but one device is allowed to fail. 4 - striped array with a parity device One device is allowed to fail. 5 - striped array with distributed parity One device is allowed to fail. 6 - striped array with dual distributed parity. Two devices are allowed to fail.

« RAID · LVM · LUKS » levels · mdadm · failures · spares “mdadm” syntax $ mdadm -C /dev/md0 --level=5 --raid-devices=/dev/loop1 /dev/loop2 /dev/loop3 note - 'missing' is a possible device Then mount the /dev/md0 device. $ mount /dev/md0 /mnt/mountpoint

« RAID · LVM · LUKS » levels · mdadm · failures · spares Dealing with failed disks: To remove a failed device from the array: $ mdadm /dev/md0 -r /dev/loop1 To add the fixed drive back: $ mdadm /dev/md0 -a /dev/loop1 To simulate a drive failure: $ mdadm /dev/md0 --fail /dev/loop1

« RAID · LVM · LUKS » levels · mdadm · failures · spares Spare disks Can be specified when the array is created with the --spare-devices=N option. $ mdadm --create /dev/md1 --level=raid5 --raid-devices=3 --spare- devices=1 /dev/loop1 /dev/loop2 /dev/loop3 /dev/loop4 Can also be added at a later time with the hotadd option. $ mdadm /dev/md1 -a /dev/loop5

« RAID · LVM · LUKS » pv · vg · lv · move · snap · tools · clean Logical Volume Manager Allocate disk space as you need it. (Then resize filesystems that sit on LV's) You can move volumes from disk to disk. Cloning & snapshots.

« RAID · LVM · LUKS » pv · vg · lv · move · snap · tools · clean

Physical volumes $ pvcreate /dev/loop1 /dev/loop2 /dev/loop3 $ pvscan PV /dev/loop1 lvm2 [1.00 GiB] PV /dev/loop2 lvm2 [1.00 GiB] PV /dev/loop3 lvm2 [1.00 GiB] Total: 3 [3.00 GiB] / in use: 0 [0.00 GiB] / in no VG: 3 [3.00 GiB]

« RAID · LVM · LUKS » pv · vg · lv · move · snap · tools · clean Volume groups $ vgcreate trilug /dev/loop1 /dev/loop2 Volume group "trilug" successfully created $ vgscan Reading all physical volumes. This may take a while... Found volume group "trilug" using metadata type lvm2

« RAID · LVM · LUKS » pv · vg · lv · move · snap · tools · clean “vgdisplay” tells more info than “vgscan” $ vgdisplay --- Volume group --- VG Name trilug System ID Format lvm2 Metadata Areas 3 Metadata Sequence No 1 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 3 Act PV 2 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 odpp2n-XmED-AOq6-qpMH-tMYv-7PnX-vEU5WQ

« RAID · LVM · LUKS » pv · vg · lv · move · snap · tools · clean Logical volumes $ lvcreate trilug --name=music --size=1.5G Logical volume "music" created $ lvscan ACTIVE '/dev/trilug/music' [1.50 GiB] inherit

« RAID · LVM · LUKS » pv · vg · lv · move · snap · tools · clean Using your new Logical Volume (It's just like any other block device) $ mkfs.ext4 /dev/trilug/music $ mkdir mnt ; mount /dev/trilug/music mnt

« RAID · LVM · LUKS » pv · vg · lv · move · snap · tools · clean Moving stuff around $ vgextend /dev/trilug /dev/loop3 Volume group "trilug" successfully extended $ vgreduce /dev/trilug /dev/loop1 Physical volume "/dev/loop1" still in use $ pvmove /dev/loop1 /dev/loop1: Moved: 100.0% $ vgreduce /dev/trilug /dev/loop1 Removed "/dev/loop1" from volume group "trilug"

« RAID · LVM · LUKS » pv · vg · lv · move · snap · tools · clean Practical example #1: Replacing a disk - minimal downtime Plug in USB drive, add PV Move stuff from old HD to USB Remove old HD from VG Replace HD Reboot (carefully, with a Live CD) Add new HD to VG Move stuff to new HD Remove USB drive from VG

« RAID · LVM · LUKS » pv · vg · lv · move · snap · tools · clean Practical example #2: “fdisk” a HD without rebooting - while it's in use! Add a USB drive as a new PV. Pvmove the volume group off of the HD. Remove the HD from the VG Run fdisk. Then do it all again in reverse (vgextend, pvmove, vgreduce, pvremove) The system stays up the whole time!

« RAID · LVM · LUKS » pv · vg · lv · move · snap · tools · clean Snapshots Creates a “copy on write” or “diffs” area. When a block is written to the original volume, the original block is stored in the “diffs” area. $ lvcreate -s /dev/trilug/music --name=snap --size=100M Logical volume "snap" created $ lvscan ACTIVE Original '/dev/trilug/music' [1.50 GiB] inherit ACTIVE Snapshot '/dev/trilug/snap' [ MiB] inherit $ dd if=/dev/trilug/snap of=/dev/tape # takes 4 hours $ lvremove /dev/trilug/snap

« RAID · LVM · LUKS » pv · vg · lv · move · snap · tools · clean Visualization tools system-config-lvm

« RAID · LVM · LUKS » pv · vg · lv · move · snap · tools · clean Cleaning up LVM - destructive! $ umount /dev/trilug/music $ lvremove /dev/trilug/music $ vgremove trilug $ pvremove /dev/loop{1,2,3}

« RAID · LVM · LUKS » format · mount · unmount · info · keys Linux Unified Key Setup (LUKS) LUKS is a standard for the disk encryption. It specifies how the data is laid out on the disk. LUKS can be used on any OS. Some Linux distros (Ubuntu “alternate”) support installing on LUKS partitions.

« RAID · LVM · LUKS » format · mount · unmount · info · keys Formatting a disk or partition (method 1): $ sudo cryptsetup luksFormat /dev/loop1 Formatting a disk or partition (method 2): $ sudo cryptsetup luksOpen /dev/loop1 mylabel $ sudo mkfs.vfat /dev/mapper/mylabel $ sudo cryptsetup luksClose mylabel Formatting a disk or partition (method 3): $ sudo luksformat -t ext2 /dev/loop1

« RAID · LVM · LUKS » format · mount · unmount · info · keys Mounting a LUKS partition (method 1): $ sudo cryptsetup luksOpen /dev/loop1 mylabel $ sudo mount -t ext2 /dev/mapper/mylabel /mnt/mylabel Mounting a LUKS partition (method 2): $ sudo pmount /dev/loop1 mylabel

« RAID · LVM · LUKS » format · mount · unmount · info · keys Unmounting a LUKS partition (method 1): $ sudo umount /mnt/mylabel/ $ sudo cryptsetup luksClose mylabel Unmounting a LUKS partition (method 2): $ sudo pumount mylabel

« RAID · LVM · LUKS » format · mount · unmount · info · keys Showing info about a LUKS partition: $ sudo cryptsetup luksDump /dev/loop1 $ sudo cryptsetup luksUUID /dev/loop1 $ sudo cryptsetup isLuks /dev/loop1 ; echo $? What? There are EIGHT keys?

« RAID · LVM · LUKS » format · mount · unmount · info · keys LUKS passwords The disk/partition is encrypted using a master key. Eight user keys are stored on the disk. Any user key can be used to decrypt the master key, and thus access the disk/partition. Changing a LUKS password (user key): $ sudo cryptsetup luksAddKey /dev/loop1 $ sudo cryptsetup luksDelKey /dev/loop1

« RAID · LVM · LUKS » closing thoughts · cleanup · questions Recovery Boot Ubuntu Live CD, then “apt-get” necessary packages (mdadm, lvm2, cryptsetup, pmount) Make a bootable USB (“startup disk creator”), boot into it, apt-get the needed packages. They will be saved in the “reserved extra space” (an overlay filesystem that is added to the static filesystem image from the ISO). Be careful... there are lots of ways to very quickly get into trouble! Practice with loop devices before jumping into your main HD.

« RAID · LVM · LUKS » closing thoughts · cleanup · questions Cleaning up our loop devices $ losetup -d /dev/loop{1,2,3} $ rm disk1 disk2 disk3

« RAID · LVM · LUKS » closing thoughts · cleanup · questions Questions?