Presentation is loading. Please wait.

Presentation is loading. Please wait.

Operating System & Administration UNIT-III Introduction to File System.

Similar presentations


Presentation on theme: "Operating System & Administration UNIT-III Introduction to File System."— Presentation transcript:

1 Operating System & Administration UNIT-III Introduction to File System

2 OUTLINE 1.PathName 2.File System Mounting and Unmounting 3.Organization of File Tree 4.File Type 5.File Attribute 6.Access Control List

3 What is a file File is a collection of data items stored on disk. Or, it's device which can store the information like data, music (mp3 files), picture, movie, sound, book etc. In fact whatever you store in computer it must be in the form of file. File is the last object in your file system tree.

4 Component of File System A namespace – a way to name things and organize them in a hierarchy An API – a set of system calls for navigating and manipulating objects A security model – a scheme for protecting, hiding, and sharing things An implementation – software to tie the logical model to the hardware. Note:- file should not contain / in between file name characters.

5 Modern kernels define an abstract interface that contains many different back-end filesystems. Windows - NTFS, FAT Linux - Ext –Ext2 –Ext3 –Ext4

6 Linux file system(History) It has maximum size limit of 64 megabytes There was also a filename length limit of 14 characters. In 1991 a new file system came with addition of new file system as a layer on top of linux kerenl that provide generic file API. Termed as VFS termed as ext. But has problems like allowed 2 gigabytes of data and filenames of up to 255 characters. with problems like there was no support for separate access, inode modification and data modification with timestamps.

7 Ext2:- –Introduced in 1993 by Rémy Card. –maximum filename length of 255 characters –has variable length block size(maximum data size of 2047 gigabytes). –Maximum individual file size can be from 16 GB to 2TB –Overall ext2 file system size can be from 2 TB to 32 TB

8 Ext3:- –Introduced in 2001 by Stephen Tweedie –The main benefit of ext3 is that it allows journaling. –Journaling has a dedicated area in the file system, where all the changes are tracked. When the system crashes, the possibility of file system corruption is less because of journaling. –maximum filename length of 255 characters –Maximum individual file size can be from 16 GB to 2 TB –Overall ext3 file system size can be from 2 TB to 32 TB

9 Ext4 It was introduced in 2008. Starting from Linux Kernel 2.6.19 ext4 was available. Supports huge individual file size and overall file system size. Maximum individual file size can be from 16 GB to 16 TB Overall maximum ext4 file system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB (terabyte).

10 Directory can contain a maximum of 64,000 subdirectories (as opposed to 32,000 in ext3) You can also mount an existing ext3 filesystem as ext4 filesystem (without having to upgrade it). Several other new features are introduced in ext4: – multiblock allocation, – delayed allocation, – journal checksum. fast fsck, etc. –All you need to know is that these new features have improved the performance and reliability of the filesystem when compared to ext3

11 11 Filesystem Hierarchy Standard Started by Dennis Ritchie, 1993 Defines the main directories and their contents in most Linux-based systems

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

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

14 Pathname What is Path Path Types Setting Path

15 What is path A path is a unique location to a file or a directory in a file system of an OS. A path to a file is a combination of / and alpha-numeric characters Ex. –/home/fedora/abc.txt –/etc/passwd –/proc/partitions –/etc/yum.d/yum.conf

16 Path Types in Linux Absolute path -An absolute path is defined as the specifying the location of a file or directory from the root directory(/). -In other words we can say absolute path is a complete path from start of actual filesystem from “ / “directory Relative path -Relative path is defined as path related to the present working directory(pwd).

17 Examples of relative path and absolute path Example1: Present location is /abc/xyz, remove /abc/xyz/read/hello.txt file. Using relative path: rm read/hello.txt Using absolute path: rm /abc/xyz/read/hello.txt

18 Example2: My present location is /etc/samba and now I want to change directory to /etc. Using relative path: cd.. Using absolute path: cd /etc Note:- there should be no ‘/’ in file Name Ex:-“abc/pqr” it will be assumed that pqr is in abc directory

19 19 The Organization Of The File Tree

20 boot Linux kernel Boot loader configuration vmlinuz-2.6.3.1 is a executable that loads operating system in memory.(vmlinuz is a kernel). If you lost boot –You cannot boot your OS

21 21 boot Grand Unified boot Loader Dev by Erich Stefan Boleyn

22 22 bin Essential programs Need for system startup Common programs, shared by the system, the system administrator and the users. Basic commands for –Navigating in filesystem –File management

23 23 bin

24 24 dev 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

25 25 dev

26 etc System configuration directory Critical startup and configuration files All configuration file are text files –You can view and edit it manually

27 27 etc

28 28 home Home directory of user Each user has a directory –/home/xyz –/home/abc All files of user are stored here

29 29 lib Libraries, shared libraries and parts of the C compiler Programs need libraries –Dynamically linked libraries All essential libraries are here –Needed for system startup

30 30 lib

31 31 proc Information about all running processes It represent current state of kernel

32 Directories with names as numbers Do a ls -l /proc, and you’ll see lot of directories with just numbers. These numbers represents the process ids, the files inside this numbered directory correspond to the process with that particular PID Following are some file located in proc directory as cmdline – command line of the command. environ – environment variables. fd – Contains the file descriptors which is linked to the appropriate files. limits – Contains the information about the specific limits to the process.

33 Files about the system information It contains system information such as cpuinfo, meminfo, /proc/cpuinfo – information about CPU, /proc/meminfo – information about memory, /proc/partitions – partition related information, /proc/version – linux version

34 mounts – mount related information

35 35 proc

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

37 37 sbin It contains executable programs (ready to run). They are mostly admin tool and made available to root user. System configuration programs –Format hard disk (fdisk,fsck, ifconfig,modinfo(info for kernel module) –Halt, reboot,fasthalt(stop system without disk checking).

38 /sbin should contain only binaries essential for booting, restoring, recovering, and/or repairing the system in addition to the binaries in /bin.

39 39 sbin

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

41 41 usr It contains all the user binaries, their documentation, libraries, header files, etc and its supporting libraries can be found here. Also termed as Secondary hierarchy Very useful programs –We usually use them for compiler, tools Are not essential for system startup

42 /usr/bin:- –This directory contains the vast majority of binaries on your system. – Executables in this directory vary widely. –For instance vi, gcc, gnome-session and mozilla and are all found here. /usr/doc:- –The central documentation directory. –Documentation is actually located in /usr/share/doc and linked from here.

43 43 usr

44 44 var Contains variable data like system logging files, mail and printer spool directories, and transient and temporary files. Some portions of /var are not shareable between different systems.like –/var/log, /var/lock, and /var/run. The shared – /var/mail, /var/cache/man, /var/cache/fonts, and /var/spool/new The variable directory All dynamic files, User cannot change the files

45 45 var

46

47 47 File Types Filesystem implementation define seven types of files 1.Regular files 2.Directories 3.Character device files 4.Block domain sockets 5.Local domain sockets 6.Named pipes (FIFO) 7.Symbolic links

48 48 How to create and remove files

49 49 Regular File : It is consist of a series of bytes, filesystems impose no structure on their contents. Example: text files, data files, executable programs. Directories : It contains named references to other files.

50 50 Character and Block device files : Device files let programs communicate with the system’s hardware and peripherals. The kernel loads driver software for each of the system’s devices. Character device files allow their associated drivers to do their own i/p and o/p buffering. Device Driver Files Hardware Program request

51 51 Block device files are used by drivers that handle i/o in large chunks and want the kernel to perform buffering for them. Device files are characterized by two numbers, called the major and minor device numbers. The major device number tells the kernel which driver the file refers to, and the minor device number typically tells the driver which physical unit to address.

52 52 Local domain sockets : Sockets are connections between processes that allow processes to communicate. Local domain sockets are accessible only from the local host and are referred to through a filesystem object rather than a network port.

53 53 Named pipes : It also allow communication between two processes running on the same host. It is also known as “FIFO files”

54 54 Symbolic links : Symbolic or “soft” link points to a file by name. Pathname stored as the contents of the link. Links : hard link and soft link Hard link is a direct reference Soft link is a reference by name

55 55 File Attributes 1. Permission bits : Every file has a set of nine permission bits that control who can read, write, and execute the contents of the file. There are 3 basic permissions –Read (r) –Write (w) –Execute (x) How to change them –chmod +/- r/w/x

56 56 File permissions in terms of octal numbers because each digit of an octal no. represents three bits and each group of permission bits consists of three bits. In each triplet bits, the high bit is the read bit, middle bit is the write bit, and low bit is the execute bit. Two types of executable files exist: binaries, which the CPU runs directly, and script, which must be interpreted by a shell (bash or sh scripts).

57 57 2. Chmod : change permissions Chmod cmd changes the permissions of a file. Only the owner of the file and the superuser can change its permissions. Permission encoding for chmod:

58 58 3. chown and chgrp : change ownership and group: Using –R flag to change the setting of a directory and all the files underneath. Example : chown –R user:group dir/.* 4. umask : assign default permissions

59

60 60 Mounting and Unmounting Mount : –To add a filesystem to other filesystem Filesystems are attached to the tree with the mount cmd. Mount maps a directory within the existing file tree, called the mount point, to the root of the newly attached filesystem. The previous contents of the mount point become inaccessible as long as another filesystem is mounted there. Mount points are usually empty directories.

61 61 How? –mount –mount -t vfat /dev/sdb1 /mnt/flash To detach filesystems with the umount cmd. Don’t forget the umount –umount –umount /mnt/flash

62 Access Control List What is an ACL? – Access Control List: collection of Access Control Entries (ACEs) associated with a file. What is an ACE? – A structure specifying permission for a user, group, or other entity.

63

64 setfacl User command utility to set, modify, or delete ACLs on a file Can be ran by file owner or anyone given permission to modify permissions Sample commands: – setfacl –s u:alice:+rx:i myFile – setfacl –m o::drwx myFile – setfacl –u myFile – setfacl –d u:alice myFile

65 getfacl User utility to examine the ACL on a particular file Examines a file’s inode to detemine what permissions are set Sample: – getfacl myFile


Download ppt "Operating System & Administration UNIT-III Introduction to File System."

Similar presentations


Ads by Google