65
System Administration Storage Systems

System Administration Storage Systems. Agenda Storage Devices Partitioning LVM File Systems

Embed Size (px)

Citation preview

  • Slide 1

System Administration Storage Systems Slide 2 Agenda Storage Devices Partitioning LVM File Systems Slide 3 STORAGE DEVICES Slide 4 Single Disk Slide 5 RAID? Slide 6 Slide 7 RAID Redundant Array of Independent Disks Software vs. Hardware RAID 0, 1, 3, 5, 6 Slide 8 Software RAID Parity done by CPU FakeRAID Linux md LVM ZFS, btrfs Later Slide 9 Hardware RAID RAID controller card Dedicated hardware box Slide 10 Direct Attached Storage SAS interface Slide 11 Storage Area Network Fiber Channel iSCSI ATA-over-Ethernet Slide 12 Fiber Channel Slide 13 Network Attached Storage NFS CIFS (think Windows File Sharing) Slide 14 SAN vs. NAS Slide 15 PARTITIONING Slide 16 1 File System / Disk? Slide 17 2 TB maybe 2TB x 12? Slide 18 2TB x 128 then? Slide 19 Slide 20 Partitioning in Linux fdisk No support for GPT Parted GParted Slide 21 Fdisk Slide 22 Add Partition Slide 23 Delete Partition Slide 24 Save & Exit Slide 25 Parted Slide 26 Add Partition Slide 27 Change Units Slide 28 Delete Partition Slide 29 No need to save Any action you do is permanent Parted will try to update system partition table Slide 30 Script support parted can also take commands from command line: parted /dev/sda mkpart pri ext2 1Mib 10Gib Slide 31 Resize (Expand) 1. Edit partition table Delete and create with same start position 2. Reload partition table Reboot if needed 3. Expand filesystem Slide 32 Resize (Shrink) 1. Shrink filesystem Slightly smaller than final 2. Edit partition table Delete and create with same start position 3. Reload partition table Reboot if needed 4. Expand filesystem to fit partition Slide 33 No Partition Moving Slide 34 LOGICAL VOLUME MANAGER Slide 35 What is LVM? A system to manage storage devices Volume == Disk Slide 36 Why use LVM? Storage pooling Online resizing Resize any way Snapshots Slide 37 Concepts Physical Volume A disk or partition Volume Group A group of PVs Logical Volume A virtual disk/partition Physical Extent Data blocks of a PV Slide 38 Slide 39 Using a partition for LVM Best to have a partition table 1. Create partition with LVM type Fdisk: use t to change type to 8e Parted: toggle lvm flag 2. pvcreate /dev/XXX Slide 40 Slide 41 Create a volume group vgcreate /dev/XXX Slide 42 Slide 43 Add PVs to volume groups vgextend /dev/XXX Slide 44 Create a logical volume lvcreate --name --size Size units: B, K, M, G, T Path to new volume /dev/ / Slide 45 Slide 46 More about LVM https://wiki.archlinux.org/index.p hp/LVM Slide 47 FILE SYSTEMS Slide 48 What is a File System? A file system (or filesystem) is an abstraction to store, retrieve and update a set of files. Learn more in OS course Slide 49 Linux Disk File Systems Ext Family Ext2 Ext3 Ext4 ReiserFS XFS ZFS Btrfs Slide 50 Ext Family Ext replaced MINIX file system Ext2 was major overhaul Ext3 adds Journaling Online expand Htree directory index (was linked-list) Slide 51 Ext Family cont. Ext4 adds Larger file system (> 2TB) Extents Journal Checksum Increase subdirectory limit Delayed Allocation Persistent Pre-allocation Slide 52 Ext Family cont. Default FS in many distros Slide 53 ReiserFS (Reiser3) By Hans Reiser / NAMESYS Earlier than ext3 Fast for huge directories and small files Features Journaling Online resize Tail packing Slide 54 XFS By SGI Opensourced and ported to Linux Fast for large filesystems and large files Features Journaling Extents Slide 55 ZFS Filesystem + LVM By Sun Open-source but license not compatible with Linux Available on Solaris FreeBSD (older/slower than Solaris) Linux using FUSE or ZFS on Linux Basis for Sun Open Storage Slide 56 Btrfs Started by Oracle Experimental Comparable to ZFS Slide 57 Recommendation Use ext4 or XFS See manpages for tunables Features Block size RAID stripe size / stride width Journaling level Slide 58 How to create a filesystem /sbin/mkfs. /dev/XXX Type: ext2, ext3, ext4, xfs, reiserfs, ZFS and btrfs have special tools Slide 59 Filesystem Utilities Ext Family e2fsprogs ReiserFS reiserfsprogs XFS xfsprogs Slide 60 How to mount a filesystem A filesystem is mounted at a mount point, a directory Contents of that directory are hidden mount /dev/XXX /mnt mount Shows currently mounted filesystems Slide 61 How to unmount unmount /dev/XXX unmount /mnt Slide 62 Automatic mounting Add entry in /etc/fstab Will mount during boot Slide 63 Slide 64 Practice Use a spare HDD or flat file Create a 10G flat file with dd: dd if=/dev/zero of=XXX bs=1M count=10k Play with fdisk/parted and LVM Go through the docs or Wikipedia Learn the features Slide 65 Homework: Write a script Given 2 HDDs /dev/sdb /dev/sdc Use parted in script mode to create LVM partitions on both HDDs Add them to LVM volume group Use your student ID as the name Create a 20G LV named ID-1 and format as ext4 Create a 20G LV named ID-2 and format as XFS Undo (delete everything) Be sure to try it SAFELY before submitting Do not include any useless commands