Top Banner
32

Flash memory as a hard drive replacement

May 07, 2015

Download

Technology

Blossoms

from the collection of hisham pasha
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Flash  memory  as a  hard  drive replacement
Page 2: Flash  memory  as a  hard  drive replacement

FLASH MEMORY AS A HARD DRIVE REPLACEMENT

Seminar by

Hisham Pasha.N.K.

Roll No:8S5 MCA

11/04/23 GEC_Thrissur 2

Page 3: Flash  memory  as a  hard  drive replacement

OVERVIEW

• FLASH BASICS

• FLASH DEGRADATION

• FLASH MEMORY V/S HARD DISK DRIVES

• FLASH AS A HARD DRIVE REPLACEMENT

• PROLONGING FLASH LIFE

11/04/23 GEC_Thrissur 3

Page 4: Flash  memory  as a  hard  drive replacement

HARD DISK STRUCTURE

11/04/23 GEC_Thrissur 4

Page 5: Flash  memory  as a  hard  drive replacement

HARD DISK STRUCTURE

11/04/23 GEC_Thrissur 5

Page 6: Flash  memory  as a  hard  drive replacement

STRUCTURE OF A USB FLASH DRIVE

11/04/23 GEC_Thrissur 6

Page 7: Flash  memory  as a  hard  drive replacement

Applications of flash memory

• DIGITAL CAMERAS

• PERSONAL DIGITAL ASSISTANTS (PDAs)

• GAME CONSOLES

• USB DRIVES

• GENERAL PURPOSE SERVERS

• BLADE SYSTEMS

11/04/23 GEC_Thrissur 7

Page 8: Flash  memory  as a  hard  drive replacement

FLASH MEMORY USED IN DEVICES

11/04/23 GEC_Thrissur 8

Page 9: Flash  memory  as a  hard  drive replacement

FLASH DEGRADATION

Storage units perform two basic functions:

- reading

- writing The lifetime of a flash device is measured in

“write/erase” or “program/clear” cycles. Write operations are performed on “pages”. Erase operations are performed on “blocks”. The lifespan of a flash device is long, but

limited

11/04/23 GEC_Thrissur 9

Page 10: Flash  memory  as a  hard  drive replacement

FLASH MEMORY V/S HDD

Key factors:-

Pricing trends

Technology trends

Energy consumption

Robustness

File size

11/04/23 GEC_Thrissur 10

Page 11: Flash  memory  as a  hard  drive replacement

Cost is a Key Factor

11/04/23 GEC_Thrissur 11

Page 12: Flash  memory  as a  hard  drive replacement

11/04/23 GEC_Thrissur 12

Page 13: Flash  memory  as a  hard  drive replacement

Advantages of Flash over HDD

• In portable applications• In limited capacity applications• In applications where file size or the total no: of files to be stored is more important than total system cost

11/04/23 GEC_Thrissur 13

Page 14: Flash  memory  as a  hard  drive replacement

FLASH AS A HARD DRIVE REPLACEMENT

• Wear leveling– Technique to rotate the write/erase cycles.– Goal

Get the entire device to wear at approximately the same rate.

– Generally implemented in h/w on a microcontroller on the same PCB as the flash memory

– Wear leveling failing formula:-

C*L*O/W*60*60*24*365 C*L*O/W*60*60*24*365

11/04/23 GEC_Thrissur 14

Page 15: Flash  memory  as a  hard  drive replacement

PROLONGING FLASH LIFE

1. Reducing Writes

2. Move /tmp to tmpfs

3. Manage swap space

4. Migrate frequently written files off

flash

5. Tune file system to minimize

maintenance-related writes11/04/23 GEC_Thrissur 15

Page 16: Flash  memory  as a  hard  drive replacement

1. PROLONGING FLASH LIFE BY REDUCING WRITES

• Redirect Log Output

Mounting Log Files Via NFS

Redirecting Log Output Using Syslog

Redirecting Application Logs to Syslog

11/04/23 GEC_Thrissur 16

Page 17: Flash  memory  as a  hard  drive replacement

Mounting Log Files Via NFS

• To mount /var as an NFS share– Entry required in /etc/fstab to avoid traffic

problem in NFS`network

<server>:</path/to/dir> /var nfs sync 0 0<server>:</path/to/dir> /var nfs sync 0 0

11/04/23 GEC_Thrissur 17

hishampasha
jj
Page 18: Flash  memory  as a  hard  drive replacement

• Kernel 2.6.23– RHEL5

– Increase Performance– Large no: of writes fsc no fscTo disable fsc; following /etc/fstab entry used

In log server side; following entry in /etc/exports to authorize the client to mount

and write to the share

<server>:</path/to/dir> /var nfs sync,nofsc 0 0<server>:</path/to/dir> /var nfs sync,nofsc 0 0

/path/to/logs/<client host name><client IP>(rw,no_root_squash,no_subtree_check)/path/to/logs/<client host name><client IP>(rw,no_root_squash,no_subtree_check)

11/04/23 GEC_Thrissur 18

Page 19: Flash  memory  as a  hard  drive replacement

1. PROLONGING FLASH LIFE BY REDUCING WRITES

• Redirect Log Output

Mounting Log Files Via NFS

Redirecting Log Output Using Syslog

Redirecting Application Logs to Syslog

11/04/23 GEC_Thrissur 19

Page 20: Flash  memory  as a  hard  drive replacement

Redirecting Log Output Using Syslog

• Log some or all messages to a remote log server

• UDP is used to send log messages• Security Implications:-

Eg:- Logging over an untrusted n/w– Replacing Syslog by Syslogng

• Logging using TCP

11/04/23 GEC_Thrissur 20

Page 21: Flash  memory  as a  hard  drive replacement

1. PROLONGING FLASH LIFE BY REDUCING WRITES

• Redirect Log Output

Mounting Log Files Via NFS

Redirecting Log Output Using Syslog

Redirecting Application Logs to Syslog

11/04/23 GEC_Thrissur 21

Page 22: Flash  memory  as a  hard  drive replacement

Redirecting Application Logs to Syslog

• Hosted applications write to log filesEg:- BIND & some types of Apache

error loggingTo enable Apache access logs:

CustomLog “|/path/to/logging/script.pl”common

CustomLog “|/path/to/logging/script.pl”common

11/04/23 GEC_Thrissur 22

Page 23: Flash  memory  as a  hard  drive replacement

2.PROLONGING FLASH LIFE BY MOVING /tmp TO tmpfs

The /tmp directory is a large source of writes.The common parameters are size, nr_inodes and mode.

/tmp can be mounted as a ramdisk.Ramdisks:- Areas of RAM reserved by OS Mounted as disks Provide very High Speed Storage

11/04/23 GEC_Thrissur 23

Page 24: Flash  memory  as a  hard  drive replacement

Advantages of tmpfs over Ramdisks

tmpfs dynamically grows the file system up to a user-specified limit

tmpfs is able to swap out seldom-used pages

tmpfs can be resized on the fly by simply remounting it

To mount 100MB tmpfs partition, run the command

11/04/23 GEC_Thrissur 24

%mount –t tmpfs –o size=100M,nr_inodes=1k,mode=777 tmpfs /tmp%mount –t tmpfs –o size=100M,nr_inodes=1k,mode=777 tmpfs /tmp

Page 25: Flash  memory  as a  hard  drive replacement

3. PROLONGING FLASH LIFE BY MANAGING SWAP SPACE

• Analyzing swap space• Running without swap space• Swapping to external storage

11/04/23 GEC_Thrissur 25

Page 26: Flash  memory  as a  hard  drive replacement

Analyzing swap space

• To determine current memory and swap usage of a Linux system

11/04/23 GEC_Thrissur 26

%free -mt%free -mt

Page 27: Flash  memory  as a  hard  drive replacement

Running without swap space1. Determine which device is the

swap device

2. Turn off swapping temporarily

3. Configure system to run with out swap on a more permanent mode

11/04/23 GEC_Thrissur 27

% grep swap /etc/fstab

/dev/sda2 swap swap 0 0

% grep swap /etc/fstab

/dev/sda2 swap swap 0 0

% swapoff /dev/sda2% swapoff /dev/sda2

# /dev/sda2 swap swap defaults 0 0# /dev/sda2 swap swap defaults 0 0

Page 28: Flash  memory  as a  hard  drive replacement

4. PROLONGING FLASH LIFE BY MIGRATING FREQUENTLY WRITTEN FILES

OFF FLASHMigration of frequently written files can be in

any of the following ways:-

Move a file into a Ramdisk and sacrifices

permanence

Move a file onto an NFS share and impact

speed

Move a file into externally attached storage

and add cost to the system

11/04/23 GEC_Thrissur 28

Page 29: Flash  memory  as a  hard  drive replacement

5. PROLONGING FLASH LIFE BY TUNING FILE SYSTEMS TO MINIMIZE WRITES

Areas to be considered:- Make sure reads don’t cause writes Check that the file system is not

using some form of secure deletion Utilize on-the-fly file system

compression Evaluate if any partitions can be

mounted read-only

11/04/23 GEC_Thrissur 29

Page 30: Flash  memory  as a  hard  drive replacement

Standard Linux File System

The Ext2 File System Highly configurable Supports secure deletion Access time logging The Ext3 File System Journaling file system Not recommended for flash drives The JFFS file system Used on non-wear leveled flash devices Log file system Intelligent garbage collection and built-in

compression Targeted at embedded device market

11/04/23 GEC_Thrissur 30

Page 31: Flash  memory  as a  hard  drive replacement

Queries?

11/04/23 GEC_Thrissur 31

Page 32: Flash  memory  as a  hard  drive replacement

11/04/23 GEC_Thrissur 32