• 沒有找到結果。

Presenter: Robert Wang Storage !

N/A
N/A
Protected

Academic year: 2022

Share "Presenter: Robert Wang Storage !"

Copied!
51
0
0

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

全文

(1)

Storage

Presenter:!

Robert Wang

(2)

Linux’s Abstraction

(vfs)

(file systems)

(physical devices)

(3)

Storage Device

(4)

Disk Drive

(5)

Multiple Drives

RAID!

Redundant Array of Independent/Inexpensive Disks!

Software or Hardware!

RAID 0, 1, 5, 6, 10

(6)

Software RAID

Linux md!

LVM!

ZFS, btrfs

(7)

Hardware RAID

RAID controller card!

!

!

Expensive!

Higher performance!

Able to expose as a single drive to OS

(8)

Direct Attached Storage

DAS

(9)

Storage Area Network

SAN!

Fibre Channel (FC)!

iSCSI!

ATA-over-Ethernet

(10)

Network Attached Storage

NFS!

commonly support on unix-like OS!

SMB/CIFS!

Windows file sharing!

AFP!

Apple’s Mac OS

(11)

SAN vs. NAS

open(“yay.cpp”) read_block(5566)

(12)

Partitioning

(13)

Intro.

A partition table on disk

MBR!

(msdos) GPT

Max disk size 2 TiB ~8 ZiB

Max # part. 4 primary 128

(14)

Utilities

fdisk!

No GPT support.!

parted!

Scripting support

(15)

fdisk

(16)

fdisk — create partition

(17)

fdisk — delete partition

(18)

fdisk — save and exit

(19)

parted

Warning: Modification is immediate!

— help

(20)

parted — GPT example

Done once for each new disk

Create a new partition

(21)

parted — delete partition

(22)

Cannot Move

Map as ranges!

Partitions cannot easily be moved

1 2 3

logical disk address ———————>

(23)

Logical Volume Manager

(24)

What is LVM?

A system to manage disk drives on Linux.!

Provides!

Storage pooling!

Online resizing!

Snapshots

(25)

Concepts

PV — Physical Volume!

A disk or partition!

VG — Volume Group!

A group of PVs!

LV — Logical Volume!

A virtual disk/partition!

PE — Physical Extent!

Data blocks of a PV

(26)

PP = PE = Physical Extent

(27)

Setup

# aptitude install lvm2

(28)

Create PV

When using DOS partition table, set the partition to LVM type!

fdisk: change type to “8e”!

parted: turn on “lvm” flag!

# pvcreate /dev/XXX

(29)
(30)

Create VG

# vgcreate <name> /dev/XXX

(31)

Create LV

# lvcreate --name <name> --size<size> <vg name>!

Size units!

B, K, M, G, T!

Path to new volume!

/dev/<vg name>/<lv name>!

/dev/mapper/<vg name>-<lv name>

(32)
(33)

More Info

Commands you can try:!

!

!

More on wiki!

https://wiki.archlinux.org/index.php/LVM!

And manpages.

(34)

File Systems

(35)

Linux File Systems

ext family — default in most Linux distributions!

ext2, ext3, ext4!

XFS!

ZFS!

btrfs!

pseudo-file system

(36)

ext family

ext — replaced MINIX file system!

ext2!

ext3 — adds!

Journaling!

Online expanding!

HTree directory index (was linked-list)

(37)

ext family (cont.)

ext4 — adds!

Larger file system (> 2TB)!

Extents (large contiguous blocks)!

Journal Checksum!

Unlimited subdirectories (was 32,000)!

Faster fsck!

Delayed allocation!

Persistent pre-allocation

(38)

XFS

By SGI!

Opensourced and ported to Linux!

Fast for large filesystems and large files!

Features!

Journaling!

Extents!

Filesystem freezing!

etc.

(39)

ZFS

By SUN!

Opensource but license not compatible with Linux!

Available on!

Solaris!

FreeBSD!

Linux using FUSE or “ZFS on Linux”!

File system + LVM

(40)

btrfs

Started by Oracle!

Experimental!

Actively developed!

Comparable to ZFS

(41)

Recommendation

Use ext4 or XFS!

See manpage for options!

Some need to be set at file system creation!

Some can be tuned by remount or even online!

Features, block size, strip size/width, etc.

(42)

Create a Filesystem

# mkfs.<type> /dev/XXX!

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

btrfs!

https://btrfs.wiki.kernel.org/index.php/Getting_started

(43)
(44)

Utilities

ext family!

e2fsprogs!

XFS!

xfsprogs

(45)

Mount

A filesystem is mounted at a “mount point”!

a directory!

contents of that directory is hidden!

See mounted filesystems!

$ mount

(46)

<device> on <mount point> type <type> (<mount options>) /dev/sda4 on /home type ext4 (…)

(47)

How to Mount

Create a directory!

# mkdir /mnt/disk!

Mount (auto detect type)!

# mount /dev/XXX /mnt/disk!

Mount (specify type/options)!

# mount -t xfs -o ro,noatime /dev/XXX /mnt/disk

(48)

How to Unmount

Unmount!

# umount /dev/XXX!

or!

# umount /mnt/disk

(49)

Mount on Boot

Edit /etc/fstab

(50)

Practice

Use a flat file to play with fdisk and parted!

$ dd if=/dev/zero of=XXX bs=1M count=10240!

$ fdisk XXX!

$ parted XXX!

Create a DOS partition table!

Create 2 partitions with!

1st — 2GiB!

2nd — the rest

(51)

Homework

Given 2 HDDs from command line arguments.!

# ./b02902000.sh /dev/XXX /dev/YYY!

!

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

參考文獻

相關文件

• What is delivered is now a forward contract with a delivery price equal to the option’s strike price.. – Exercising a call forward option results in a long position in a

• Similar to futures options except that what is delivered is a forward contract with a delivery price equal to the option’s strike price.. – Exercising a call forward option results

• It works as if the call writer delivered a futures contract to the option holder and paid the holder the prevailing futures price minus the strike price.. • It works as if the

ptrArray:PTR DWORD, ; points to the array arraySize:DWORD ; size of the array ArraySum PROTO,. ptrArray:PTR DWORD, ; points to the array count:DWORD ; size of the array

In the inverse boundary value problems of isotropic elasticity and complex conductivity, we derive estimates for the volume fraction of an inclusion whose physical parameters

Two examples of the randomly generated EoSs (dashed lines) and the machine learning outputs (solid lines) reconstructed from 15 data points.. size 100) and 1 (with the batch size 10)

Let us suppose that the source information is in the form of strings of length k, over the input alphabet I of size r and that the r-ary block code C consist of codewords of

● size() 回傳 queue