《Linux 实用教程》Linux文件管理

Linux File System 文件系统 VFS VFS的作用 基于ⅤFS的文件访问 VFS重要数据结构 文件系统的注册与安装 ext2、ext3文件系统 文件操作 proc文件系统 CRAMFS文件系统
1 Linux File System • 文件系统 • VFS VFS的作用 基于VFS的文件访问 VFS重要数据结构 • 文件系统的注册与安装 • ext2、ext3文件系统 • 文件操作 • proc文件系统 • CRAMFS文件系统

各种各样的文件系统 o Windows Fat16Fat32. NTFS o传统UNIX:UFS( Unix File System) OBSD文件系统FFS( Fast File system) o Proc File system:只存在于内存中 o Linux File system ext2( is first introduced in kernel 2.0.x reiserfs( is first introduced in kernel 2.2. x) ext3( is first introduced in kernel 2. 4.x, default in RedHat now) xfs (from SGI) Jfs (from IBM) o嵌入式小型文件系统 O CRAMFS O JFFS2
2 各种各样的文件系统 Windows FAT16,FAT32, NTFS 传统UNIX: UFS (Unix File System) BSD文件系统FFS(Fast File System) Proc File System:只存在于内存中 Linux File System – ext2 ( is first introduced in kernel 2.0.x ) – reiserfs ( is first introduced in kernel 2.2.x ) – ext3 ( is first introduced in kernel 2.4.x ,default in RedHat now) – xfs (from SGI ) – Jfs (from IBM ) 嵌入式小型文件系统 CRAMFS JFFS2

inux文件系统目录布局 To comply with FSStND(File System STaNDard first of mount point in linux lete -keep linux default configuration /boot -keep important linux booting files(can be a separate file system) /bin -Essential command binaries for both root and ord. users /sbin -Essential system binaries for administrator /dev -keep all device files /usr -keep all user binary and X library /home -keep user home directory /proc pseudo file system for tracking running process and state of linux system /var -keeping mail, log file and printer spooling /ib -contain shared library that is required by system program /tmp -contain system temporary file /opt -Add-on application software packages
3 linux文件系统目录布局 To comply with FSSTND(File System STaNDard): / - first of mount point in linux /etc - keep linux default configuration /boot - keep important linux booting files(can be a separate file system) /bin - Essential command binaries for both root and ord. users /sbin - Essential system binaries for administrator /dev - keep all device files /usr - keep all user binary and X library /home - keep user home directory /proc - is pseudo file system for tracking running process and state of linux system /var - keeping mail, log file and printer spooling /lib - contain shared library that is required by system program /tmp - contain system temporary file /opt - Add-on application software packages

UNIX文件系统文件类型 Directory -- catalogue of file name Normal file --> format of data source file text file Symbolic link--> a pointer to another file Special file --> use for device controller in kernel Named pipe--> communication channel which can be used by serveral processes(may be irrelevant) in order to exchange data
4 UNIX文件系统文件类型 • Directory --> catalogue of file name • Normal file --> format of data –source file –text file • Symbolic link --> a pointer to another file • Special file --> use for device controller in kernel • Named pipe --> communication channel which can be used by serveral processes(may be irrelevant) in order to exchange data

硬链接( Hard link) [root@localhost link]# Is-1 total 1 -rW-r--r--1 root root 6670ct1513:39a [@localhost link]# ln a b [root@localhost link]# Is-1 total 2 2 root 667oct1513:39 root root 6670ct1513:39b [root@localhost link]# rm a rm: remove a?y [root@localhost link]# Is-1 total 1 1 root root 667oct1513:39b Inode /root/link L匚b了 5
5 硬链接(Hard Link) [root@localhost link]# ls -l total 1 -rw-r--r-- 1 root root 667 Oct 15 13:39 a [root@localhost link]# ln a b [root@localhost link]# ls -l total 2 -rw-r--r-- 2 root root 667 Oct 15 13:39 a -rw-r--r-- 2 root root 667 Oct 15 13:39 b [root@localhost link]# rm a rm: remove `a'? y [root@localhost link]# ls -l total 1 -rw-r--r-- 1 root root 667 Oct 15 13:39 b inode /root/link a b

符号链接( Symbolic link) [root@localhost symlink]# Is -1 total 1 rw-r--r 1 root root 667oct1513:39a [root@localhost symlink]# In -s a b [root@localhost symlink]# Is total 1 root root 667oct1513:39 lrwxrwxrwx root ot 1oct1514:20b->a [root@localhost yy] rm a rm: remove a?y [root@localhost symlink]# Is -1 total 0 lrwxrwxrwx 1 root root 1oct1514:20 [rootglocalhost symlink]# cat b cat: b: No such file or directory Inode /root/link 6
6 符号链接(Symbolic link) [root@localhost symlink]# ls -l total 1 -rw-r--r-- 1 root root 667 Oct 15 13:39 a [root@localhost symlink]# ln -s a b [root@localhost symlink]# ls -l total 1 -rw-r--r-- 1 root root 667 Oct 15 13:39 a lrwxrwxrwx 1 root root 1 Oct 15 14:20 b -> a [root@localhost yy]# rm a rm: remove `a'? y [root@localhost symlink]# ls -l total 0 lrwxrwxrwx 1 root root 1 Oct 15 14:20 b -> a [root@localhost symlink]# cat b cat: b: No such file or directory inode /root/link a b

VFS( Virtua1 FileSystem)的作用 User Programs System Call Interface Virtual File System Process control Ext2 Ext3 Subsystem Scheduler Memory Buffer Cache management De Dr Hardware 7
7 VFS(Virtual FileSystem)的作用 Virtual File System Ext2 Ext3 ... Buffer Cache Device Driver Process Control Subsystem System Call Interface User Programs Inter-process communication Scheduler Memory management Hardware

基于VFS的文件访问 磁盘 超级块 node对象 进程1 fe象 dentry dent 进程2 file对象 对象 对象 进程3 fe对象 8
8 基于VFS的文件访问 进程1 进程1 进程1 file对象 file对象 file对象 超级块 inode对象 磁盘 进程1 进程2 进程3 file对象 file对象 file对象 超级块 inode对象 dentry 对象 dentry 对象

VFS的目录项( dentry) 根目录 d parent d subdirs d child d child 子目录 子目录 子目录 parent d subdirs d mounts d covers 子目录 文件 新文件系统根 d child VFS的 dentry定义在 include/ linux/dcache. h中 为了加快文件的查找,每一个曾被读取的目录或文件都可 能在目录高速缓存( directory cache)中有一个 dentry项; dentry描述了目录与文件的关系树。 9
9 根目录 子目录 子目录 子目录 文件 子目录 新文件系统根 d_subdirs d_subdirs d_child d_child d_child d_mounts d_covers d_parent d_parent VFS的目录项(dentry) VFS的dentry定义在include/linux/dcache.h中 为了加快文件的查找,每一个曾被读取的目录或文件都可 能在目录高速缓存(directory cache)中有一个dentry项; dentry描述了目录与文件的关系树

VFS的目录项( dentry) struct dentry i /*include/linux/dcache. h*/ atomic t d count unsigned int d flags struct inode d inode; /* Where the name belongs to- nULL is negative * struct dentry *d parent; parent directory struct list head d hash /*lookup hash list * struct list head d lru d count =oLRU list * struct list head d child r child of parent list * struct list head d subdirs. *our children struct list head d alias / inode alias list * nt d mounted struct gstr d name unsigned long d time / used by d revalidate struct dentry operations *d struct super block * d sb; / The root of the dentry tree *, unsigned long d vfs flags void d fsdata /*fs-specific data*/ unsigned char d iname [DNAME INLINE LEn]; small names * 10
10 VFS的目录项(dentry) struct dentry { /*include/linux/dcache.h*/ atomic_t d_count; unsigned int d_flags; struct inode * d_inode; /* Where the name belongs to - NULL is negative */ struct dentry * d_parent; /* parent directory */ struct list_head d_hash; /* lookup hash list */ struct list_head d_lru; /* d_count = 0 LRU list */ struct list_head d_child; /* child of parent list */ struct list_head d_subdirs; /* our children */ struct list_head d_alias; /* inode alias list */ int d_mounted; struct qstr d_name; unsigned long d_time; /* used by d_revalidate */ struct dentry_operations *d_op; struct super_block * d_sb; /* The root of the dentry tree */ unsigned long d_vfs_flags; void * d_fsdata; /* fs-specific data */ unsigned char d_iname[DNAME_INLINE_LEN]; /* small names */ };
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 《Linux 实用教程》Linux内核结构与进程管理.ppt
- 《Linux 实用教程》Linux存储管理.ppt
- 《Linux 实用教程》DeviceAndModule.ppt
- 《Linux 实用教程》第9章 Linux编程基础.ppt
- 《Linux 实用教程》第8章 Linux网络安全.ppt
- 《Linux 实用教程》第7章 Web应用服务.ppt
- 《Linux 实用教程》第6章 Internet应用服务器的配置.ppt
- 《Linux 实用教程》第5章 Intranet服务器.ppt
- 《Linux 实用教程》第4章 Linux网络基础.ppt
- 《Linux 实用教程》第3章 Linux系统管理.ppt
- 《Linux 实用教程》第2章 Linux的常用命令.ppt
- 《Linux 实用教程》第1章 Linux概况及安装.ppt
- 《Linux 实用教程》Linux下的shel1与make.doc
- 《数据结构》课程教学资源:研究的内容.ppt
- 《数据结构》课程教学资源:第八章 查找.ppt
- 《数据结构》课程教学资源:第七章 排序.ppt
- 《数据结构》课程教学资源:第七章 排序.ppt
- 《数据结构》课程教学资源:第六章 树和二叉树.ppt
- 《数据结构》课程教学资源:第五章 串.ppt
- 《数据结构》课程教学资源:第四章 栈和队列.ppt
- 《Linux 实用教程》linux系统调用.ppt
- 鞍山科技大学:《C语言程序设计与数据结构》目录.ppt
- 鞍山科技大学:《C语言程序设计与数据结构》第1章 C语言概述.ppt
- 鞍山科技大学:《C语言程序设计与数据结构》第2章 简单程序设计.ppt
- 鞍山科技大学:《C语言程序设计与数据结构》第3章 结构控制语句.ppt
- 鞍山科技大学:《C语言程序设计与数据结构》第4章 函数.ppt
- 鞍山科技大学:《C语言程序设计与数据结构》第5章 数据的顺序存储结构及应用.ppt
- 鞍山科技大学:《C语言程序设计与数据结构》第6章 指针.ppt
- 鞍山科技大学:《C语言程序设计与数据结构》第7章 数据的链式存储及应用.ppt
- 鞍山科技大学:《C语言程序设计与数据结构》第8章 树的存储结构及应用.ppt
- 鞍山科技大学:《C语言程序设计与数据结构》第9章 查找与排序.ppt
- 鞍山科技大学:《C语言程序设计与数据结构》第10章 位运算.ppt
- 鞍山科技大学:《C语言程序设计与数据结构》第11章 文件.ppt
- 清华大学:《计算机组成原理》存储器习题.doc
- 清华大学:《计算机组成原理》第一讲 计算机系统概述.ppt
- 清华大学:《计算机组成原理》第二讲 计算机发展简史.ppt
- 清华大学:《计算机组成原理》第三讲 逻辑电路设计基础.ppt
- 清华大学:《计算机组成原理》第四、五讲 信息表示与编码.ppt
- 清华大学:《计算机组成原理》第六-八讲 计算机算法和算法逻辑实现.ppt
- 清华大学:《计算机组成原理》第九-十讲 存储器.ppt