Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Unix (CA263) File System

Similar presentations

Presentation on theme: "Introduction to Unix (CA263) File System"— Presentation transcript:

1 Introduction to Unix (CA263) File System
By Tariq Ibn Aziz

2 Objectives After reading this chapter and completing the exercises, you will be able to: Discuss UNIX/Linux file systems Explain partitions and inodes Understand the elements of the root hierarchy Use the mount command Explain and use paths, pathnames, and prompts Navigate the file system Create and remove directories Copy and delete files Configure file permissions

3 Understanding UNIX/Linux File Systems
File: basic component for data storage UNIX/Linux considers everything to be a file A file system is UNIX/Linux’s way of organizing files on mass storage devices A physical file system is a section of the hard disk that has been formatted to hold files The file system is organized in a hierarchical structure (inverted tree)

4 Understanding UNIX/Linux File Systems (continued)

5 UNIX File System Most versions of UNIX and Linux support the UNIX file system (ufs), which is the original native UNIX file system. ufs is a hierarchical (tree structure) file system that is expandable, supports large amounts of storage, provides excellent security, and is reliable. ufs supports journaling, if a system crashes unexpectedly, it reconstruct files or to roll back recent changes for minimal or no damage of the files. ufs also supports hot fixes by moving data automatically from damaged portions of disks to areas that are not damaged.

6 UNIX File System In Linux, the native file system is called the extended file system (ext or ext fs), which is installed by default. ext is modeled after ufs,

7 Understanding the Standard Tree Structure
The structure starts at the root level Root is the name of the file at this basic level and it is denoted by the slash character (/) Directory: file that can contain other files and directories Subdirectory: directory within a directory The subdirectory is considered the child of the parent directory

8 Using UNIX/Linux Partitions
The section of the disk that holds a file system is called a partition When installing UNIX/Linux, one of the first tasks is deciding how to partition a storage device, or hard disk Hard disks may have many partitions UNIX/Linux partitions are given names LINUX uses hda1 and hda2

9 Using UNIX/Linux Partitions (continued)
Storage devices are called peripheral devices Peripheral devices connect to the computer through electronic interfaces IDE: Integrated Drive Electronics SCSI: Small Computer System Interface


11 Setting Up Hard Disk Partitions
Partitioning your hard disk provides organized space for file systems At least 3 partitions (root, swap, /boot) often recommended Root partition holds root file system directory (/), size depends on installation but often ranges between 1.2 to 5+ GB

12 Setting Up Hard Disk Partitions (continued)
Swap partition acts as a memory extension, often has same size as RAM, enables virtual memory /boot partition used to store OS files comprising kernel, relatively small Other often used partitions include /usr, /home, /var

13 Using Inodes Inodes are associated with directories and files in ufs and ext file systems An inode contains the name, general information, and location information (a pointer) for a file or directory

14 Using Inodes The file system itself is identified by the superblock
A superblock contains information about block layout on a specific partition Without the superblock, the file system cannot be accessed. For this reason, many copies of the superblock are written into the file system at the time the file system is created through partitioning and formatting. If the superblock is destroyed, you can copy one of the superblock copies over the original, damaged superblock to restore access to the file system.

15 Exploring the Root Hierarchy
UNIX/Linux must mount a file system before any programs can access files on it To mount a file system is to connect it to the directory tree structure The root file system is mounted by the kernel when the system starts

16 Exploring the Root Hierarchy (continued)
The root directory contains sub-directories that contain files: /bin contains binaries, or executables needed to start the system and perform system tasks /boot contains files needed by the bootstrap loader as well as kernel images /dev contains system device reference files, such as the hard disks, mice, printers, consoles, modems, memory, floppy disks, and CD-ROM drives.


18 Exploring the Root File Hierarchy (continued)
Root subdirectories continued: /etc contains configuration files that the system uses when the computer starts /home is used to offer disk space for users /lib contains kernel modules, security information, and the shared library images /mnt contains mount points for temporary mounts by the system administrator. A temporary mount is used to mount a removable storage medium, such as a floppy disk or CD/DVD /proc is a virtual file system allocated in memory only

19 Exploring the Root File Hierarchy (continued)
Root subdirectories continued: /root is the home directory of the root user, or the system administrator /sbin contains essential network programs used only by the system administrator /tmp is a temporary place to store data during processing cycles, for example sorting /usr partition houses software offered to users /var contains subdirectories which have sizes that often change, such as error logs. For incoming mail and printing spooling we have /var/spool/mail subdirectory or /var/spool/lpd subdirectory,

20 Using the mount Command
Users can access mounted file systems which they have permission to access Additional file systems can be mounted at any time using the mount command To ensure system security, only the root user uses the mount command

21 Using the mount Command
Suppose you want to access files on a CD-ROM for your organization.You or the system administrator can mount a CD-ROM by inserting a disk in the CD-ROM drive, and thenusing the following mount command: mount -t iso9660 /dev/cdrom /mnt/cdrom This command mounts the CD on a device called “cdrom” located in the /dev directory. The actual mount point in UNIX/Linux is /mnt/cdrom, a directory that references the CD-ROM device. After the CD is mounted, you can access its files through the /mnt/ cdrom directory.

22 Using the unmount Command
system administrator unmounts them using the umount command before removing the storage media, umount /mnt/floppy umount /mnt/cdrom

23 Using Paths, Pathnames, and Prompts
To specify a file or directory, use its pathname, which follows the branches of the file system to the desired file A forward slash (/) separates each directory name The UNIX/Linux command prompt may indicate your location within the file system Use the UNIX/Linux pwd command to display the current path name

24 Configure Shell Prompt

25 Configure Shell Prompt

26 Configure Shell Prompt
An environment variable, PS1, contains special formatting characters that determine your prompt’s configuration. variable contains: \W]\$ Characters that begin with \ are special Bash shell formatting characters.

27 Navigating the File System
To navigate the UNIX/Linux directory structure, use the cd (change directory) command UNIX/Linux refers to a path as either: Absolute - begins at the root level and lists all subdirectories to the destination file Relative - begins at your current working directory and proceeds from there

28 Using Dot and Dot Dot Addressing Techniques
UNIX/Linux interpret a single dot (.) to mean the current working directory Two dots (..) mean the parent directory cd .. moves you up a level in the directory structure

29 Listing Directory Contents
The ls (list) command displays a directory’s contents, including files and subdirectories

30 Using Wildcards A wildcard is a special character that is used as a placeholder The * wildcard represents any group of characters in a file name The ? wildcard represents a single character in a file name

31 Creating and Removing Directories and Files
mkdir (make directory) command Create a new directory rmdir (make directory) command Delete an empty directory cp (copy) command Copy files from one directory to another rm (remove) command Delete files

32 Configuring File Permissions for Security

33 Configuring File Permissions for Security (continued)
Owner has read w Owner has write x Owner has execute Group has read - Group does not have write Group has execute Others have read Others do not have write Others have execute

34 Configuring File Permissions for Security (continued)
chmod command To set file permissions Settings are read (r), write (w), execute (x) The three types of users are owners, groups, and others Setting permissions to directories Use the execute (x) to grant access

35 Chapter Summary In UNIX/Linux, a file is the basic component for data storage and UNIX and Linux consider everything a file A file system is UNIX/Linux’s way of organizing files on mass storage devices and each file is referenced using a correct and unique pathname The section of the mass storage device that holds a file system is a partition

36 Chapter Summary (continued)
You can customize your command prompt to display the current working directory name, the current date and time, and several other items The ls command displays the names of files and directories contained in a directory Use the chmod command to set permissions such as read (r), write (w), execute (x) for files that you own

Download ppt "Introduction to Unix (CA263) File System"

Similar presentations

Ads by Google