Tải bản đầy đủ (.pdf) (134 trang)

Bài giảng Nhập môn Hệ điều hành: File system - Nguyễn Xuân Vinh

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1008.76 KB, 134 trang )

GV: NGUYỄN XUÂN VINH
NHẬP MÔN HỆ ĐIỀU HÀNH
1/15/16
/XX
1

NHẬP MÔN HỆ ĐIỀU HÀNH
INTRODUCTION TO OPERATING
SYSTEMS
[214242]

FILE SYSTEM

Nguyễn Xuân Vinh

vn


GV: NGUYỄN XUÂN VINH
NHẬP MÔN HỆ ĐIỀU HÀNH

Introduction


Filesystem



How are data stored in storage?
How do users access the data?





Data organization, files and directories

Filesystem types 




2

/XX

1/15/16



Disk FS: ext2, ext3, FAT, FAT32 & NTFS
Network FS: Samba & NFS
Flash FS: JFFS2
Special FS: proc FS

2


GV: NGUYỄN XUÂN VINH








You should understand Linux FS
– Why?
Everything in Linux is file, if it is NOT process
– Easy to use

Open file, read/write and close the file
Unlike Windows, Linux FS is standard FS
– Everyone should learn standards

3

/XX

1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH

Introduction (cont’d)

3


GV: NGUYỄN XUÂN VINH

Filesystem Hierarchy
Standard

Started by Dennis Ritchie, 1993




4

/XX

1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH



Defines the main directories and their contents in most Linux­
based systems
Current Version: 2.3, 29 Jan 2004.

4


GV: NGUYỄN XUÂN VINH

FHS



5


/XX

1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH



There is not any drive C:, D:, …
All directories are under “/”
– “/” is the root directory
It is possible 
– to have multiple partitions
– to multiple filesystems

5


GV: NGUYỄN XUÂN VINH

The “/”




6

/XX

1/15/16


NHẬP MÔN HỆ ĐIỀU HÀNH



The primary hierarchy in FSH
– The root of tree of filesystem 
All paths start form here
There is only one “/” in filesystem

6


7
/XX
1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH

GV: NGUYỄN XUÂN VINH

The “/”

/

boot
bin
dev
etc
lib

proc
root
sbin
tmp

7

usr
var


GV: NGUYỄN XUÂN VINH





Linux kernel
Boot loader configuration 
If you lost  boot
– You cannot boot your OS

8

/XX

1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH


boot

8


9
/XX
1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH

GV: NGUYỄN XUÂN VINH

boot

boot

vmlinuz-2.6.12
config-2.6.12

grub

grub.conf

9


GV: NGUYỄN XUÂN VINH






Essential programs 
Need for system startup
Basic commands for 
– Navigating in filesystem
– File management

10

/XX

1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH

bin

10


11
/XX
1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH

GV: NGUYỄN XUÂN VINH


bin

bin

bash
bzip2
cat
...
gzip
ls

11

mv
rm


GV: NGUYỄN XUÂN VINH

dev

NHẬP MÔN HỆ ĐIỀU HÀNH





12

/XX


1/15/16



Everything is file 
– Hardware components (devices) are file

Hard disk

Key board
All device files are here
Direct interaction with device driver 
– Open the device file
– Read & Write 

12


13
/XX
1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH

GV: NGUYỄN XUÂN VINH

dev

dev


hda
fda
sda
...
tty
random

13

null


GV: NGUYỄN XUÂN VINH





System configuration directory
– What is done by the registry in Windows
All configuration file are text files
– You can view and edit it manually 

14

/XX

1/15/16


NHẬP MÔN HỆ ĐIỀU HÀNH

etc

14


GV: NGUYỄN XUÂN VINH

etc

bashrc

fstab

inittab

passwd

shadow

init.d

X11

network

named

httpd


X11.conf

15

/XX

1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH

etc

15


GV: NGUYỄN XUÂN VINH






Home directory of user
Each user has a directory
– /home/bahador
– /home/hamed 
All files of user are stored here

16


/XX

1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH

home

16


GV: NGUYỄN XUÂN VINH

lib




17

/XX

1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH



Programs need libraries

– Dynamically linked libraries
Programmers need libraries
All essential libraries are here
– Needed for system startup 

17


18
/XX
1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH

GV: NGUYỄN XUÂN VINH

lib

lib

libc
libm
libcrypt
libpthread

modules

18



GV: NGUYỄN XUÂN VINH








Kernel’s interface
– Kernel pseudo­directory 
Special directory
– It is NOT a directory on hard disk 
Kernel Configuration
Kernel State monitoring

19

/XX

1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH

proc

19


GV: NGUYỄN XUÂN VINH


proc

cpuinfo

meminfo

devices

net

interrupts

tcp

sys
udp

net

20

/XX

1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH

proc


20

1

129

kernel


GV: NGUYỄN XUÂN VINH




Home directory of root
Don’t confuse
–  / is the “root of Filesystem”
–  root is the name of system admin
–  /root is the admin 

21

/XX

1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH

root


21


GV: NGUYỄN XUÂN VINH

sbin


22

/XX

1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH



System configuration programs
– Format hard disk
– Manage hardware
Only “root” can run the programs 

22


23
/XX
1/15/16


NHẬP MÔN HỆ ĐIỀU HÀNH

GV: NGUYỄN XUÂN VINH

sbin

sbin

fsck
mkfs
mount
...
adduser

23

poweroff


GV: NGUYỄN XUÂN VINH

tmp




24

/XX


1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH



Temporary directory
All temp files are created by programs
Your temp files
It is emptied regularly 

24


GV: NGUYỄN XUÂN VINH






Secondary hierarchy 
Very useful programs
– We usually use them

compiler, tools 
Are not essential for system startup

25


/XX

1/15/16

NHẬP MÔN HỆ ĐIỀU HÀNH

usr

25


×