System Administration Storage Systems Agenda Storage Devices Partitioning

  • Slides: 65
Download presentation
System Administration Storage Systems

System Administration Storage Systems

Agenda �Storage Devices �Partitioning �LVM �File Systems

Agenda �Storage Devices �Partitioning �LVM �File Systems

STORAGE DEVICES

STORAGE DEVICES

Single Disk

Single Disk

RAID?

RAID?

RAID �Redundant Array of Independent Disks �Software vs. Hardware �RAID 0, 1, 3, 5,

RAID �Redundant Array of Independent Disks �Software vs. Hardware �RAID 0, 1, 3, 5, 6

Software RAID �Parity done by CPU �Fake. RAID �Linux md �LVM �ZFS, btrfs ◦

Software RAID �Parity done by CPU �Fake. RAID �Linux md �LVM �ZFS, btrfs ◦ Later

Hardware RAID �RAID controller card �Dedicated hardware box

Hardware RAID �RAID controller card �Dedicated hardware box

Direct Attached Storage �SAS interface

Direct Attached Storage �SAS interface

Storage Area Network �Fiber Channel �i. SCSI �ATA-over-Ethernet

Storage Area Network �Fiber Channel �i. SCSI �ATA-over-Ethernet

Fiber Channel

Fiber Channel

Network Attached Storage �NFS �CIFS (think Windows File Sharing)

Network Attached Storage �NFS �CIFS (think Windows File Sharing)

SAN vs. NAS

SAN vs. NAS

PARTITIONING

PARTITIONING

1 File System / Disk?

1 File System / Disk?

2 TB maybe… 2 TB x 12?

2 TB maybe… 2 TB x 12?

2 TB x 128 then?

2 TB x 128 then?

Partitioning in Linux �fdisk ◦ No support for GPT �Parted ◦ GParted

Partitioning in Linux �fdisk ◦ No support for GPT �Parted ◦ GParted

Fdisk

Fdisk

Add Partition

Add Partition

Delete Partition

Delete Partition

Save & Exit

Save & Exit

Parted

Parted

Add Partition

Add Partition

Change Units

Change Units

Delete Partition

Delete Partition

No need to save �Any action you do is permanent �Parted will try to

No need to save �Any action you do is permanent �Parted will try to update system partition table

Script support �parted can also take commands from command line: ◦ parted /dev/sda mkpart

Script support �parted can also take commands from command line: ◦ parted /dev/sda mkpart pri ext 2 1 Mib 10 Gib

Resize (Expand) 1. ◦ 2. ◦ 3. Edit partition table Delete and create with

Resize (Expand) 1. ◦ 2. ◦ 3. Edit partition table Delete and create with same start position Reload partition table Reboot if needed Expand filesystem

Resize (Shrink) 1. ◦ 2. ◦ 3. ◦ 4. Shrink filesystem Slightly smaller than

Resize (Shrink) 1. ◦ 2. ◦ 3. ◦ 4. Shrink filesystem Slightly smaller than final Edit partition table Delete and create with same start position Reload partition table Reboot if needed Expand filesystem to fit partition

No Partition Moving

No Partition Moving

LOGICAL VOLUME MANAGER

LOGICAL VOLUME MANAGER

What is LVM? �A system to manage storage devices �Volume == Disk

What is LVM? �A system to manage storage devices �Volume == Disk

Why use LVM? �Storage pooling �Online resizing �Resize any way �Snapshots

Why use LVM? �Storage pooling �Online resizing �Resize any way �Snapshots

Concepts �Physical Volume ◦ A disk or partition �Volume Group ◦ A group of

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

Using a partition for LVM �Best 1. ◦ ◦ 2. to have a partition

Using a partition for LVM �Best 1. ◦ ◦ 2. to have a partition table Create partition with LVM type Fdisk: use “t” to change type to “ 8 e” Parted: toggle “lvm” flag pvcreate /dev/XXX

Create a volume group �vgcreate <name> /dev/XXX …

Create a volume group �vgcreate <name> /dev/XXX …

Add PVs to volume groups �vgextend <name> /dev/XXX …

Add PVs to volume groups �vgextend <name> /dev/XXX …

Create a logical volume �lvcreate --name <name> --size <size> <volume group> �Size units: ◦

Create a logical volume �lvcreate --name <name> --size <size> <volume group> �Size units: ◦ B, K, M, G, T … �Path to new volume ◦ /dev/<volume group>/<name>

More about LVM �https: //wiki. archlinux. org/index. p hp/LVM

More about LVM �https: //wiki. archlinux. org/index. p hp/LVM

FILE SYSTEMS

FILE SYSTEMS

What is a File System? �A file system (or filesystem) is an abstraction to

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

Linux Disk File Systems �Ext Family ◦ Ext 2 ◦ Ext 3 ◦ Ext

Linux Disk File Systems �Ext Family ◦ Ext 2 ◦ Ext 3 ◦ Ext 4 �Reiser. FS �XFS �ZFS �Btrfs

Ext Family �Ext replaced MINIX file system �Ext 2 was major overhaul �Ext 3

Ext Family �Ext replaced MINIX file system �Ext 2 was major overhaul �Ext 3 adds ◦ Journaling ◦ Online expand ◦ Htree directory index (was linkedlist)

Ext Family cont. �Ext 4 ◦ ◦ ◦ ◦ adds Larger file system (>

Ext Family cont. �Ext 4 ◦ ◦ ◦ ◦ adds Larger file system (> 2 TB) Extents Journal Checksum Increase subdirectory limit Delayed Allocation Persistent Pre-allocation …

Ext Family cont. �Default FS in many distros

Ext Family cont. �Default FS in many distros

Reiser. FS (Reiser 3) �By Hans Reiser / NAMESYS �Earlier than ext 3 �Fast

Reiser. FS (Reiser 3) �By Hans Reiser / NAMESYS �Earlier than ext 3 �Fast for huge directories and small files �Features ◦ Journaling ◦ Online resize ◦ Tail packing

XFS �By SGI �Opensourced and ported to Linux �Fast for large filesystems and large

XFS �By SGI �Opensourced and ported to Linux �Fast for large filesystems and large files �Features ◦ Journaling ◦ Extents ◦…

ZFS �Filesystem + LVM �By Sun �Open-source but license not compatible with Linux �Available

ZFS �Filesystem + LVM �By Sun �Open-source but license not compatible with Linux �Available on ◦ Solaris ◦ Free. BSD (older/slower than Solaris) ◦ Linux using FUSE or “ZFS on Linux” �Basis for Sun Open Storage

Btrfs �Started by Oracle �Experimental �Comparable to ZFS

Btrfs �Started by Oracle �Experimental �Comparable to ZFS

Recommendation �Use ext 4 or XFS �See manpages for tunables ◦ ◦ Features Block

Recommendation �Use ext 4 or XFS �See manpages for tunables ◦ ◦ Features Block size RAID stripe size / stride width Journaling level

How to create a filesystem �/sbin/mkfs. <type> /dev/XXX ◦ Type: ext 2, ext 3,

How to create a filesystem �/sbin/mkfs. <type> /dev/XXX ◦ Type: ext 2, ext 3, ext 4, xfs, reiserfs, … �ZFS and btrfs have special tools

Filesystem Utilities �Ext Family ◦ e 2 fsprogs �Reiser. FS ◦ reiserfsprogs �XFS ◦

Filesystem Utilities �Ext Family ◦ e 2 fsprogs �Reiser. FS ◦ reiserfsprogs �XFS ◦ xfsprogs

How to mount a filesystem �A filesystem is mounted at a “mount point”, a

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

How to unmount �unmount /dev/XXX �unmount /mnt

How to unmount �unmount /dev/XXX �unmount /mnt

Automatic mounting �Add entry in /etc/fstab �Will mount during boot

Automatic mounting �Add entry in /etc/fstab �Will mount during boot

Practice �Use a spare HDD or flat file ◦ Create a 10 G flat

Practice �Use a spare HDD or flat file ◦ Create a 10 G flat file with dd: ◦ dd if=/dev/zero of=XXX bs=1 M count=10 k �Play with fdisk/parted and LVM �Go through the docs or Wikipedia ◦ Learn the features

Homework: Write a script � Given 2 HDDs /dev/sdb /dev/sdc � Use parted in

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 20 G LV named ID-1 � Create a 20 G LV named ID-2 � Undo (delete everything) � Be � Do and format as ext 4 and format as XFS sure to try it SAFELY before submitting not include any useless commands