E N D
What Is A File? • A collection of data or information that has a name, called the filename. Almost all information stored in a computer must be in a file. There are many different types of files: datafiles, text files , programfiles, directory files, and so on. Different types of files store different types of information. For example, program files store programs, whereas text files store text.
What Is A File System? • A method for storing and accessing files. • We will concentrate on: • -user interface to files • naming and access • -system representation of and access to files • structure, protection • -translation between user and system views • -this is a layered based structure.
Definition: • A file system is an organization of data and metadata on a storage device. Mounting: Associating a file system to a storage device in Linux is a process called mounting. The mount command is used to attach a file system to the current file system hierarchy (root).
File System is developed for - create - store - load - delete • seek file on media • update
File-System Structure • File structure -Logical storage unit -Collection of related information • File system resides on secondary storage (disks) • File system organized into layers • File control block–storage structure consisting of information about a file
In Memory File System Structures • The following figure illustrates the necessary file system structures provided by the operating systems. • Figure refers to opening a file.
Directory Implementation Linear listof file names with pointer to the data blocks. • simple to program • time-consuming to execute Hash Table–linear list with hash data structure. • decreases directory search time • collisions–situations where two file names hash to the same location • fixed size
Allocation Methods • An allocation method refers to how disk blocks are allocated for files: - Contiguous allocation - Linked allocation - Indexed allocation
Types of file systems: File system types can be classified into disk file systems, flash file systems, database file systems, transactional file system, shared disk file system network file systems and special purpose file systems.
Basic functions of File System • present logical (abstract) view of files • and directories • hide complexity of hardware devices • facilitate efficient use of storage devices • optimize access, e.g., to disk • support sharing • provide protection
File System of OS • File system of Windows OS • Windows 98 and Windows ME which supports FAT16, FAT32 • Windows 2000 supports FAT16,FAT32, NTFS • Windows XP which supports FAT32, NTFS • File system of BSD Family OS • FFS (Fast File System)
File System in Linux • File System in Linux is divided into 2 types • Linux Swap which is used in virtual memory system • Linux File System which is used to store file • There is various type of file system • ext2 • reiserfs • ext3
File system architecture in Linux • Now that you've seen file system construction in action, I'll get back to the architecture of the Linux file system layer. This article views the Linux file system from two perspectives. The first view is from the perspective of the high-level architecture. The second view digs in a little deeper and explores the file system layer from the major structures that implement it.
File systems and operating systems • Most operating systems provide a file system. • A file system is an integral part of any modern operating system. • The file systems used by the majority of UNIX operating systems is fairly similar, and unusually distinct from the file systems used by other operating systems, such as DOS or Windows.
cont… • As hard disks grow in capacity, becoming larger and larger every year, it is becoming increasingly difficult for operating systems and their companion file systems, to use them in an efficient manner. • The file system employed by most operating systems today is a generic name given to the software routines and logical structures used to prepare the given hard disk to store data as well as control access to that particular storage space.
cont… Flat file systems: In a flat file system, there are no subdirectories —everything is stored at the same (root) level on the media, be it a hard disk, floppy disk, etc. While simple, this system rapidly becomes inefficient as the number of files grows, and makes it difficult for users to organize data into related groups.
cont… File systems under Unix-like operating systems: Unix-like operating systems create a virtual file system, which makes all the files on all the devices appear to exist in a single hierarchy. This means, in those systems, there is one root directory, and every file existing on the system is located under it somewhere. Unix-like systems can use a RAM disk or network shared resource as its root directory.
cont… File systems under Linux: Linux supports many different file systems, but common choices for the system disk include the ext* family (such as ext2,ext3 and ext4), XFS, JFS, ReiserFS and btrfs and Reiser FS was first journaling file system added to linux kernel. File systems under Microsoft Windows: Windows makes use of the FAT and NTFS file systems.
cont… File systems under Plan 9 from Bell Labs: Everything on a Plan 9 system has an abstraction as a file; networking, graphics, debugging, authentication, capabilities, encryption, and other services are accessed via I-O operations on file descriptors. For example, this allows the use of the IP stack of a gateway machine without need of NAT, or provides a network-transparent window system without the need of any extra code.
File system related commands Here are some commands related to file system usage, and other topics discussed in this section: • bdf - On HP-UX systems, reports file system usage statistics • df - On HP-UX systems, reports on free disk blocks, and i-nodes • du - Summarizes disk usage in a specified directory hierarchy • ln - Creates a hard link (default), or a soft link (with -s option) • mount, umount - Attaches, or detaches, a file system (super user only) • mkfs - Constructs a new file system (super user only) • fsck - Evaluates the integrity of a file system (super user only) • etc…
The /boot/ Directory • The /boot/ directory contains static files required to boot the system, such as the Linux kernel. These files are essential for the system to boot properly.
The /dev/ Directory • The /dev/ directory contains file system entries which represent devices that are attached to the system. These files are essential for the system to function properly.
The /etc/ Directory • Files that are local to the machine The /etc/ directory is reserved for configuration. No binaries are to be put in /etc/. Any binaries that were once located in /etc/ should be placed into /sbin/ or possibly /bin/.
The /lib/ Directory • The /lib/ directory should contain only those libraries that are needed to execute the binaries in /bin/ and /sbin/.
The /mnt/ Directory • The /mnt/ directory is for temporarily mounted file systems, such as CD-ROMs and floppy disks.
The /opt/ Directory • The /opt/ directory provides storage for large, static application software packages.
The /proc/ Directory • The /proc/ directory contains special files that either extract information from or send information to the kernel.
The /sbin/ Directory • The /sbin/ directory is for executables used only by the root user. The executables in /sbin/ are only used to boot and mount /usr/ and perform system recovery operations.
The /usr/ Directory • The /usr/ directory is for files that can be shared across a whole site.
The /sys/ Directory • The /sys/ directory utilizes the new sysfs virtual file system specific to the 2.6 kernel. With the increased support for hot plug hardware devices in the 2.6 kernel, the /sys/ directory contains information similarly held in /proc/, but displays a hierarchical view of specific device information in regards to hot plug devices.
The /srv/ Directory • The /srv/ directory contains site-specific data served by your system running Red Hat Enterprise Linux. This directory gives users the location of data files for a particular service, such as FTP, WWW, or CVS. Data that only pertains to a specific user should go in the /home/ directory.
The /media/ Directory • The /media/ directory contains subdirectories used as mount points for removeable media such as usb storage media, DVDs, CD-ROMs, and Zip disks.
The /usr/local/ Directory • The /usr/local hierarchy is for use by the system administrator when installing software locally.
The/bin/Directory • Contains several useful commands that are of use to both the system administrator as well as non-privileged users. • Usually contains the shells like bash, csh, etc.... and commonly used commands like cp, mv, rm, cat, ls. • Also contains programs which boot scripts may depend on • There are no (real) subdirectories in /bin
The /home/Directory • The user home directories • Accessible only to its owner and the system administrator • Contains the user’s personal configuration files • Quite large to be used as User’s Documents Space
The/lost+found/Directory • Contains the files which were recovered after an unexpected event, such as a proper shutdown. • Try to move each file back to its original location
The/root/Directory • The home directory of the System Administrator, 'root' • Why not in '/home'? Because '/home' is often located on a different partition or even on another system and would thus be inaccessible to 'root' when - for some reason - only '/' is mounted.
Refrences: • http://www.webopedia.com/TERM/F/file.htm • http://en.wikipedia.org/wiki/File_system • http://www.worthytips.com/access-linux-file-system-windows/ • www.cs.uga.edu/~dkl/473/Fall05/lectures/lec13.pdf • www.ics.uci.edu/~bic/courses/143/LEC/ch10.ppt • http://juhuj.com/open-file-pdf-convert-pdf-download-lesystem.htm • wfiww.sci.unich.it/~bista/didattica/sistemi.../slides/ch15_part2.ppt • www.dewassoc.com/kbase/hard_drives/file_systems_unix.htm • http://www.ibm.com/developerworks/linux/library/l-linux-filesystem/
Thanks………………. Now its your turn Quiz