• 沒有找到結果。

System Administration

N/A
N/A
Protected

Academic year: 2022

Share "System Administration"

Copied!
65
0
0

加載中.... (立即查看全文)

全文

(1)

System Administration

Storage Systems

(2)

Agenda

Storage Devices

Partitioning

LVM

File Systems

(3)

STORAGE DEVICES

(4)

Single Disk

(5)

RAID?

(6)
(7)

RAID

Redundant Array of Independent Disks

Software vs. Hardware

RAID 0, 1, 3, 5, 6

(8)

Software RAID

Parity done by CPU

FakeRAID

Linux md

LVM

ZFS, btrfs

Later

(9)

Hardware RAID

RAID controller card

Dedicated hardware box

(10)

Direct Attached Storage

SAS interface

(11)

Storage Area Network

Fiber Channel

iSCSI

ATA-over-Ethernet

(12)

Fiber Channel

(13)

Network Attached Storage

NFS

CIFS (think Windows File Sharing)

(14)

SAN vs. NAS

(15)

PARTITIONING

(16)

1 File System / Disk?

(17)

2 TB maybe… 2TB x 12?

(18)

2TB x 128 then?

(19)
(20)

Partitioning in Linux

fdisk

No support for GPT

Parted

GParted

(21)

Fdisk

(22)

Add Partition

(23)

Delete Partition

(24)

Save & Exit

(25)

Parted

(26)

Add Partition

(27)

Change Units

(28)

Delete Partition

(29)

No need to save

Any action you do is permanent

Parted will try to update system partition table

(30)

Script support

parted can also take commands from command line:

parted /dev/sda mkpart pri ext2 1Mib 10Gib

(31)

Resize (Expand)

1. Edit partition table

Delete and create with same start position

2. Reload partition table

Reboot if needed

3. Expand filesystem

(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

(33)

No Partition Moving

(34)

LOGICAL VOLUME

MANAGER

(35)

What is LVM?

A system to manage storage devices

Volume == Disk

(36)

Why use LVM?

Storage pooling

Online resizing

Resize any way

Snapshots

(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

(38)
(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

(40)
(41)

Create a volume group

vgcreate <name> /dev/XXX …

(42)
(43)

Add PVs to volume groups

vgextend <name> /dev/XXX …

(44)

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>

(45)
(46)

More about LVM

https://wiki.archlinux.org/index.p hp/LVM

(47)

FILE SYSTEMS

(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

(49)

Linux Disk File Systems

Ext Family

Ext2

Ext3

Ext4

ReiserFS

XFS

ZFS

Btrfs

(50)

Ext Family

Ext replaced MINIX file system

Ext2 was major overhaul

Ext3 adds

Journaling

Online expand

Htree directory index (was linked-list)

(51)

Ext Family cont.

Ext4 adds

Larger file system (> 2TB)

Extents

Journal Checksum

Increase subdirectory limit

Delayed Allocation

Persistent Pre-allocation

(52)

Ext Family cont.

Default FS in many distros

(53)

ReiserFS (Reiser3)

By Hans Reiser / NAMESYS

Earlier than ext3

Fast for huge directories and small files

Features

Journaling

Online resize

Tail packing

(54)

XFS

By SGI

Opensourced and ported to Linux

Fast for large filesystems and large files

Features

Journaling

Extents

(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

(56)

Btrfs

Started by Oracle

Experimental

Comparable to ZFS

(57)

Recommendation

Use ext4 or XFS

See manpages for tunables

Features

Block size

RAID stripe size / stride width

Journaling level

(58)

How to create a filesystem

/sbin/mkfs.<type> /dev/XXX

Type: ext2, ext3, ext4, xfs, reiserfs, …

ZFS and btrfs have special tools

(59)

Filesystem Utilities

Ext Family

e2fsprogs

ReiserFS

reiserfsprogs

XFS

xfsprogs

(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

(61)

How to unmount

unmount /dev/XXX

unmount /mnt

(62)

Automatic mounting

Add entry in /etc/fstab

Will mount during boot

(63)
(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

(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

參考文獻

相關文件

本次的作業 (netstat -na 部分 ) 即在觀看所有機 器上的 transport layer 連線. 本次的作業 (netstat -na 部分 ) 即在觀看所有機 器上的 transport layer

• An algorithm is any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output.. • An algorithm is

存放檔案的 inode 資訊, inode 一旦滿了也一樣會 無法儲存新檔案, inode 會告知檔案所使用的 data block 位置。. Q :如何知道那些 inode 和

5/11 Network Address Translation and Virtual Private Network. 5/18 System configuration and

5/4 System configuration and log systems 5/11 Network Address Translation (NAT)
. and Virtual Private

* All rights reserved, Tei-Wei Kuo, National Taiwan University, 2005..

and/or make predictions about the future behaviour of a system in the real world. ● requires the modeller to be creative and make choices, assumptions,

A system is said to be in stable equilibrium if, when displaced from equilibrium, it experiences a net force or torque in a direction opposite to the direction of the displacement..