Linux Filesystem Hierarchy Linux Filesystem Hierarchy and Hard Disk - - PowerPoint PPT Presentation

linux filesystem hierarchy linux filesystem hierarchy and
SMART_READER_LITE
LIVE PREVIEW

Linux Filesystem Hierarchy Linux Filesystem Hierarchy and Hard Disk - - PowerPoint PPT Presentation

Linux Filesystem Hierarchy Linux Filesystem Hierarchy and Hard Disk Partitioning and Hard Disk Partitioning Moreno Baricevic CNR-IOM DEMOCRITOS Trieste, ITAL Y File System File System A fjle system is a set of methods and data structures


slide-1
SLIDE 1

Linux Filesystem Hierarchy Linux Filesystem Hierarchy and Hard Disk Partitioning and Hard Disk Partitioning

Moreno Baricevic

CNR-IOM DEMOCRITOS Trieste, ITAL Y

slide-2
SLIDE 2

File System File System

A fjle system is a set of methods and data structures used to

  • rganize,

store, retrieve and manage information in a permanent storage medium, such as a hard disk. Its main purpose is to represent and

  • rganize storage resources.
slide-3
SLIDE 3

3

File System: elements File System: elements Name space: is a way to assign names to the items stored and organize them hierarchically. API: is a set of calls that allow the manipulation

  • f stored items.

Security Model: is a scheme to protect, hide and share data. Implementation: is the code that couples the logical model to the storage medium.

slide-4
SLIDE 4

4

File Systems: Basic Concepts (1/2) File Systems: Basic Concepts (1/2)

Disk: A permanent storage medium of a certain size. Block: The smallest unit writable by a disk or fjle system. Everything a fjle system does is composed of operations done on blocks. Partition: A subset of all the blocks on a disk. Volume: The term is used to refer to a disk or partition that has been initialized with a fjle system. Superblock: The area of a volume where a fjle system stores its critical data.

slide-5
SLIDE 5

5

File Systems: Basic Concepts (2/2) File Systems: Basic Concepts (2/2)

Metadata: A general term referring to information that is about something but not directly part of it. For example, the size of a fjle is very important information about a fjle, but it is not part of the data in the fjle. Ownerships, access permissions, creation/modifjcation/access time, are also part of the metadata information pertaining a fjle. Journaling: A method of insuring the correctness of fjle system metadata even in the presence of power failures or unexpected reboots (atomic write). Attribute: A name and value associated with the name. The value may have a defjned type (string, integer, etc.).

slide-6
SLIDE 6

6

Modern File System Features Modern File System Features

Journaling: write data to journal, commit to fjle system when complete in atomic operation

– reduces risk of corruption and inconsistency

Faster fjle lookups through balanced tree Snapshot: retain status of fjle system at given point in time by copying metadata and marking

  • bject data referred as copy-on-write

Deduplication: identify identical storage

  • bjects, consolidate and mark them

copy-on-write

slide-7
SLIDE 7

7

(Local) File Systems: few examples (Local) File Systems: few examples

FAT NTFS ext2, ext3, ext4 Reiserfs xfs jfs ...

slide-8
SLIDE 8

File System Hierarchy File System Hierarchy

slide-9
SLIDE 9

UNIX/LINUX Directory Structure UNIX/LINUX Directory Structure In the Filesystem Hierarchy Standard (FHS) all the fjles and directories appear under the “root directory” “/”.

slide-10
SLIDE 10

Directory Structure Directory Structure

  • / (root or “slash”)

– Root directory of the entire hierarchy

  • /bin

– Essential commands: ls, cp, rm, cat...

  • /boot

– Kernel and boot loader fjles

  • /dev

– Essential devices, such as disk drives, serial ports..

slide-11
SLIDE 11

Directory Structure Directory Structure

  • /etc

– System wide confjguration fjles

  • /home

– User's home directories, containing saved fjles,

personal settings...

  • /lib

– Shared libraries needed by the programs on the

root fjlesystem

slide-12
SLIDE 12

Directory Structure Directory Structure

  • /media

– Mount points for removable media such as

CD-ROMs

  • /mnt

– Mount points for temporary mounts by the system

administrator.

  • /opt

– Optional application software packages.

slide-13
SLIDE 13

Directory Structure Directory Structure

  • /proc

– Virtual fjlesystem documenting kernel and process

status as text fjles

  • /root

– Root user home directory

  • /sbin

– Essential system binaries, like init, ifconfjg,

mount...

slide-14
SLIDE 14

Directory Structure Directory Structure

  • /usr

– Contains all commands, libraries, man pages,

games and static fjles for normal operation (User System Resources).

/usr/bin /usr/sbin /usr/lib /usr/src /usr/man /usr/share /usr/local

  • /usr/local/bin
  • /usr/local/lib
slide-15
SLIDE 15

Directory Structure Directory Structure

  • /var

– Variable fjles (fjles whose content is expected to

continually change during normal operation of the system) such as logs, spool fjles, and temporary e-mail fjles.

  • /tmp

– T

emporary fjles, often not preserved between system reboots.

slide-16
SLIDE 16

Partitioning Partitioning

slide-17
SLIDE 17

Why partitioning? Why partitioning?

  • Protect and isolate fjles

– A loss of a fjle system in one partition doesn't

afgect the others

– Limits efgects of fjle system full

  • Difgerent partitions for difgerent purposes

– Difgerent fjlesystems (Encrypted FS for home

directories)

– Software RAID – LVM

slide-18
SLIDE 18

Partitions Overview Partitions Overview

  • Primary and Extended partitions.

– Maximum 4 primary partitions for hard disk. – Maximum 1 extended partition. – Extended partition can be divided in more logical

partitions (>15, depends on partition table).

  • One partition must be a contiguous chunk of

blocks.

  • Once you create a partition you have to live

with it (with some exceptions).

slide-19
SLIDE 19

Standard Partition Scheme Standard Partition Scheme

  • /
  • /boot
  • /home
  • /usr
  • /tmp
  • /var
  • /opt
  • /scratch
  • <swap_area>
slide-20
SLIDE 20

Standard Partition Scheme Standard Partition Scheme

  • /

– The root directory of the entire fjle system

  • hierarchy. Contains all the other directories not

bound to a specifjc partition (/etc, /bin, /sbin).

– 10 GB may be enough.

  • /boot

– Boot loader fjles (e.g. kernels, initrd, boot loader

confjguration).

– At least 100 MB big, 500MB may be appropriate for

large ramfs/initrd and multiple kernels. Automatic kernel updates may fjll up the space quickly.

slide-21
SLIDE 21

Standard Partition Scheme Standard Partition Scheme

  • /home

– Users' home directory, containing saved fjles,

personal settings.

– The size depends on the purpose of the machine

(e.g. larger on a desktop, minimal on a print server).

  • /usr

– Contains the majority of (multi-)user utilities and

applications.

– Around 15 to 20 GB large.

slide-22
SLIDE 22

Standard Partition Scheme Standard Partition Scheme

  • /tmp

– T

emporary fjles, often not preserved between system reboots or periodically removed if unused.

– 10 GB.

  • /var

– Variable fjles, fjles whose content is expected to

continually change during normal operation of the system, such as logs, spool fjles, and temporary e-mail fjles.

– 10 GB (not necessarily a separate partition on a

desktop installation).

slide-23
SLIDE 23

Standard Partition Scheme Standard Partition Scheme

  • /opt

– Optional application software packages (usually

shared via NFS inside a cluster environment).

– 15 – 20 GB large.

  • /scratch

– A scratch fjle system (for temporary data and large

fjles used by scientifjc applications, pre-processing and post-processing).

– Maximum available space.

slide-24
SLIDE 24

Standard Partition Scheme Standard Partition Scheme

  • <swap_area>

– A partition that temporary holds inactive memory

pages.

– The size depends on the amount of RAM, hard

drive capacity and typical usage. In the past (small amount of RAM), twice the size of RAM was suggested.

  • Other partitions

– e.g. per-applications reserved partitions

  • One partition for each applications (as apache,

mysql...)

slide-25
SLIDE 25

Typical question: I have X terabytes of Typical question: I have X terabytes of available space, how can I partition it? available space, how can I partition it? There's no easy answer, depends on many factors:

  • What kind of services or applications will run
  • n your server?
  • What do you need the most on your system:

performance or reliability (or a combination of both)?

  • Do you need specifjc type of fjle system (e.g.

encrypted fjle systems)?

slide-26
SLIDE 26

Tips Tips

  • Don't allocate all the available space (keep

some for future uses).

  • Use LVM.
  • If you have a raid controller with multiple

disks and the overall space isn't an issue, reserve one hard disk as hot-spare.

  • ...
slide-27
SLIDE 27

Questions? Questions?

slide-28
SLIDE 28

Resources Resources

  • http://www.linuxtopia.org/online_books/linux_

beginner_books/linux_fjlesystem/c23.html