Flash memory as a hard drive replacement

Preview:

DESCRIPTION

from the collection of hisham pasha

Citation preview

FLASH MEMORY AS A HARD DRIVE REPLACEMENT

Seminar by

Hisham Pasha.N.K.

Roll No:8S5 MCA

11/04/23 GEC_Thrissur 2

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

HARD DISK STRUCTURE

11/04/23 GEC_Thrissur 4

HARD DISK STRUCTURE

11/04/23 GEC_Thrissur 5

STRUCTURE OF A USB FLASH DRIVE

11/04/23 GEC_Thrissur 6

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

FLASH MEMORY USED IN DEVICES

11/04/23 GEC_Thrissur 8

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

FLASH MEMORY V/S HDD

Key factors:-

Pricing trends

Technology trends

Energy consumption

Robustness

File size

11/04/23 GEC_Thrissur 10

Cost is a Key Factor

11/04/23 GEC_Thrissur 11

11/04/23 GEC_Thrissur 12

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

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

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

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

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

• 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

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

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

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

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

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

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

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

Analyzing swap space

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

11/04/23 GEC_Thrissur 26

%free -mt%free -mt

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

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

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

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

Queries?

11/04/23 GEC_Thrissur 31

11/04/23 GEC_Thrissur 32

Recommended