Скачать презентацию Operating systems Lecture 1 2 Introduction to Linux Скачать презентацию Operating systems Lecture 1 2 Introduction to Linux

week-1.2.pptx

  • Количество слайдов: 13

Operating systems Lecture 1. 2 Introduction to Linux file system 1 Operating systems Lecture 1. 2 Introduction to Linux file system 1

Overview • • About partitioning. What is file and directory? Linux directory structure. Understanding Overview • • About partitioning. What is file and directory? Linux directory structure. Understanding /dev/null. Understanding Linux filesystem structure. Surviving a Linux filesystem. Basic commands to work with files and directories. 2

About partitioning • Partition – раздел жесткого диска. • One of the goals of About partitioning • Partition – раздел жесткого диска. • One of the goals of having different partitions is to achieve higher data security in case of disaster. By dividing the hard disk in partitions, data can be grouped and separated. When an accident occurs, only the data in the partition that got the hit will be damaged, while the data on the other partitions will most likely survive. • There are two kinds of major partitions on a Linux system: - data partition: normal Linux system data, including the root partition containing all the data to start up and run the system; - swap partition: expansion of the computer's physical memory, extra memory on hard disk (analog of paging file in Windows OS). It is recommended to set size of swap partition : swap. Size=2*RAMSize 3

What is file and directory? • File are collection of data items stored on What is file and directory? • File are collection of data items stored on disk. In fact what ever you store in computer it must be in form of file. Files are always associated with devices like hard disk , floppy disk etc. File is the last object in your file system tree. • Directory is group of files. Directory is divided into two types: - Root directory - Strictly speaking, there is only one root directory in your system, which is denoted by / (forward slash). It is root of your entire file system and can not be renamed or deleted. - Sub directory - Directory under root (/) directory is subdirectory which can be created, renamed by the user. 4

FHS – filesystem hierarchy standard 5 FHS – filesystem hierarchy standard 5

About /dev/null • The null device is typically used for disposing of unwanted output About /dev/null • The null device is typically used for disposing of unwanted output streams of a process, or as a convenient empty file for input streams. This is usually done by redirection. • The null device is also a favorite subject of technical jokes: "please send complaints to /dev/null“ The i. Phone Dev Team commonly uses the phrase "send donations to /dev/null", meaning they do not accept donations. 6

Understanding Linux filesystem • Linux supports numerous file system types • Ext 2: This Understanding Linux filesystem • Linux supports numerous file system types • Ext 2: This is like UNIX file system. It has the concepts of blocks, inodes and directories. • Ext 3: It is ext 2 filesystem enhanced with journalling capabilities. Journalling allows fast file system recovery. • But what is in a File system? • Again file system divided into two categories: • User data - stores actual data contained in files • Metadata - stores file system structural information such as superblock, inodes, directories 7

Understanding Linux filesystem • • • Understanding UNIX / Linux filesystem Inodes The inode Understanding Linux filesystem • • • Understanding UNIX / Linux filesystem Inodes The inode (index node) is a fundamental concept in the Linux and UNIX filesystem. Each object in the filesystem is represented by an inode. But what are the objects? Let us try to understand it in simple words. Each and every file under Linux (and UNIX) has following attributes: => File type (executable, block special etc) => Permissions (read, write etc) => Owner => Group => File Size => File access, change and modification time (remember UNIX or Linux never stores file creation time, this is favorite question asked in UNIX/Linux sys admin job interview) All the above information stored in an inode. In short the inode identifies the file and its attributes (as above). Each inode is identified by a unique inode number within the file system. Inode is also know as index number. 8

Superblock • Each file system has a superblock, which contains information about file system Superblock • Each file system has a superblock, which contains information about file system such as: • File system type • Size • Status • Information about other metadata structures • If this information lost, you are in trouble (data loss) so Linux maintains multiple redundant copies of the superblock in every file system. 9

Surviving a Linux Filesystem Failures • Most of time fsck utility can fix the Surviving a Linux Filesystem Failures • Most of time fsck utility can fix the problem, first simply run e 2 fsck - to check a Linux ext 2/ext 3 file system (assuming [/dev/sda 3 partition] filesystem for demo purpose), first unmount /dev/sda 3 then type following command : # e 2 fsck -f /dev/sda 3 10

11 11

 • • On next Lecture: File attributes, access modes. Mounting external devices. etc… • • On next Lecture: File attributes, access modes. Mounting external devices. etc… 12

Thank you for attention! 13 Thank you for attention! 13