+ All Categories
Home > Technology > File system

File system

Date post: 22-Dec-2014
Category:
Upload: abdur-muhammadi
View: 148 times
Download: 2 times
Share this document with a friend
Description:
 
Popular Tags:
79
LINUX BASED NETWORKS Zahid Shafique, Instructor Filesystem Hierarchy Standards & filesystem Structure Slide : 1 Linux Based Networks University of Education Instructor: Muhammad Amer Irshad <[email protected] om>
Transcript
Page 1: File system

LINUX BASED NETWORKS Zahid Shafique, Instructor

Filesystem Hierarchy Standards & filesystem Structure

Slide : 1

Linux Based NetworksUniversity of Education

Instructor: Muhammad Amer Irshad

<[email protected]>

Page 2: File system

LINUX BASED NETWORKS Zahid Shafique, Instructor

Filesystem Hierarchy Standards & filesystem Structure

Slide : 2

• File system Hierarchy Standard• Linux File System

– Comparison of MS-DOS & Linux.– DOS to Linux Cheat Sheet.– File Systems– File System Types– Device Driver Names– Partitioning– The mount command– The UNIX File System Design

Page 3: File system

cal tree

LINUX BASED NETWORKS Zahid Shafique, Instructor

Comparison of MS-DOS & Linux

Filesystem Hierarchy Standards & filesystem Structure

Slide : 3

Microsoft Linux¾The directories in an MS-

DOSpath are separated by ‘\’

¾In MS-DOS, file names are case-insensitive

¾The dot in an MS-DOS file name separates the name part from the extension.

¾In MS-DOS, each file system resides on its own drive, designated by ‘d:’.

¾In Linux path are separated by ‘/’.

¾In Linux they are case sensitive

¾In Linux a dot is like any other character in a filename.

¾In Linux, all file systems are part of a single hierarchi descending from the root directory ‘/’.

Page 4: File system

LINUX BASED NETWORKS Zahid Shafique, Instructor

Comparison of MS-DOS & Linux

Filesystem Hierarchy Standards & filesystem Structure

Slide : 4

Microsoft Linux¾In MS-DOS, an executable

file is one with an extension of.exe, .com, or .bat.

¾An MS-DOS, file has only one name.

¾In MS-DOS you can set attributes to make file read only, hidden.

¾In MS-DOS you are automatically connected to your system when you turn on your system.

¾In Linux, any file whose execute permission is turned on is executable, regardless of its name.

¾Linux file may have several name, each represented by different link.

¾In Linux you can set permissions on a file.

¾In Linux, you must log in and provide a password.

Page 5: File system

LINUX BASED NETWORKS

DOS to Linux Cheat Sheet

Zahid Shafique, Instructor

Filesystem Hierarchy Standards & filesystem Structure

Slide : 5

Many Linux commands you type at a shell prompt arenot that different from the commands you would type either in MS-DOS or in Windows (from the MS-DOS prompt). In fact, some commands are identical.

Page 6: File system

LINUX BASED NETWORKS

DOS to Linux Cheat Sheet

Zahid Shafique, Instructor

Filesystem Hierarchy Standards & filesystem Structure

Slide : 6

Page 7: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

File Systems

The file systemis a combination of the partitionsand directories that make up your Linux system.

It is important to keep the file system healthy andorganized or you end up spending more time searching for files and programs than actually administering the system.

Page 8: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 7

Page 9: File system

system.proc Process Access File System, allows access to active

processes and their images. This is not a real file

LINUX BASED NETWORKS Amer Irshad, Instructor

File System Types

ufs UNIX File System, based on BSD Fat Fast File System (default).hsfs High Sierra File System, used by CDROMs and

supports Rock Ridge extensions. Very similar to ufs, except that it does not support writable media or hard links. (iso9660)

nfs Network File System, the default distributed file system type rfs Remote File Share, AT&Ts RFS product.Ext4 Fourth Extended File System. Common Linux file system.proc Process Access File System, allows access to active

processes and their images. This is not a real file system; instead, it's an interface to the Linux kernel.

msdos Used to access MS-DOS files from Linux.swap swap partitions as like virtual memory.

Page 10: File system

system.proc Process Access File System, allows access to active

processes and their images. This is not a real file vfat

Filesystem Hierarchy Standards & filesystem Structure

Slide : 8

Page 11: File system

Device driver Drive

/dev/hda Master IDE drive, primary IDE bus./dev/hdb Slave IDE drive, primary IDE bus./dev/hdc Master IDE drive, secondary IDE bus./dev/hdd Slave IDE drive, secondary IDE bus.

/dev/sda First SCSI hard drive./dev/sdb Second SCSI hard drive./dev/st0 First SCSI tape drive./dev/scd0 First SCSI CD-ROM drive.

LINUX BASED NETWORKS Amer Irshad, Instructor

Samples of Device Driver Name

Device driver Drive

/dev/hda Master IDE drive, primary IDE bus./dev/hdb Slave IDE drive, primary IDE bus./dev/hdc Master IDE drive, secondary IDE bus./dev/hdd Slave IDE drive, secondary IDE bus.

/dev/sda First SCSI hard drive./dev/sdb Second SCSI hard drive./dev/st0 First SCSI tape drive./dev/scd0 First SCSI CD-ROM drive.

Linux

Page 12: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 9

Page 13: File system

/dev/hda1/dev/hda5/dev/sda2

LINUX BASED NETWORKS Amer Irshad, Instructor

Partitioning• For a large hard disk, it's better to split

it into several partitions (fdisk command):

• The root partition– where / resides.– Contains all the things necessary

to start the system, (50MB to 100MB)

• The swap partition

– Used to support virtual memory.

/dev/hda1/dev/hda5/dev/sda2

– The minimum size is equal to the size of RAM(or 16MB), while the maximum size is roughly 2 x Physical memory.

Page 14: File system

– Linux can support more than one swap partition and swap file.

Filesystem Hierarchy Standards & filesystem Structure

Slide : 10

Page 15: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

Mount Points

A mount points is defined as the directory, such as "/" (root), under which a file system becomes accessible after beingmounted.

Page 16: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 11

Page 17: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

Understanding mounts

Mount points are directories where onemay mount a

second

disk partition to a first

to make the

second appearas

partof the first.

That is, the tree receives a "graft," another branch, at thatpoint, and the tree thus becomes that much larger.

In fact, this is the only way to add to the existing filesystem's Volume, by adding another partition to it.

Page 18: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 12

Page 19: File system

LINUX BASED NETWORKS

Understanding mounts

This additional partition could just as easily be an NFS (network file system) mount from another host across the network, but would obviously only be available when the network and the remote host were.

Page 20: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 13

Page 21: File system

LINUX BASED NETWORKS

Things to remember about mounts

Mount points must necessarily be directory names.

But the directories don't need to be empty.

No directory is truly empty, it contains at a minimum the"." and "..“

If a partition is mounted over an existing directory, thecontents of the existing directory become unavailable.

They can't be seen or used, and the disk space used

Page 22: File system

bythose files is lost. The files in the disk partition mounted over it replace the original.

Filesystem Hierarchy Standards & filesystem Structure

Slide : 14

Page 23: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

The mount command

Before a file system is accessible to the system, it must be mounted on a directory.

– For example, if you have a file system on a floppy, you must mount it under a directory, eg flp, in order to access the files on the floppy.

– After mounting the file system, all of the files in the file system appear in that directory.

– After unmounting the file system, the directory (in this case, /flp) will be empty.

mount -t type device dir

Page 24: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 15

Page 25: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

Hard Drive Overview

¾As with other operating systems, the Linux kernel plus the files associated with it are stored on a hard drive, which isa physical unit.

¾Within each hard drive are partitions, which function some what as virtual hard drive.

¾Inside each partition, you build a file system.

Page 26: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 16

Page 27: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

Linux File System

Linux uses the second extended (ext2 & etx3) file system

Page 28: File system

University of Lahore [email protected] 17

Filesystem Hierarchy Standards & filesystem Structure

Slide : 17

Page 29: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

File system Hierarchy Standard(FHS)

Page 30: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 18

Page 31: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

File system Structure

Red Hat is committed to the Filesystem Hierarchy Standard (FHS), a document that defines the names and locations of many files and directories.

The complete standard can be viewed at:

http://www.pathname.com/fhs/

Page 32: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 19

Page 33: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

The Directory Tree Structure

Page 34: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 20

Page 35: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

Overview of the FHS

The /boot Directory

This is where the Kernel is stored and LILO/GRUB gets itsinformation from, and where module information is stored.

Your best bet is to ignore this directory completely as for a normal user, it is dangerous to play with

Page 36: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 21

Page 37: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

The Root Directory ( / )

The root directory (/) of a Linux system is the directory thatcontains all other directories and files.

Other directories may be separately mounted and thus mayor may not be present at system startup.

Therefore, the file system that contains the root directorymust contain all files necessary to operate the system in single-user mode.

Page 38: File system

The root directory also contains all files needed to shutdown and recover or repair the system.

Filesystem Hierarchy Standards & filesystem Structure

Slide : 22

Page 39: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

The Root Directory (cont….)

The following directories are essential and must be part of the root file system:

/bin, which contains binary files used by the system administrator and other users

/dev, which contains device files

/etc, which contains host-specific configuration data

/lib, which contains system libraries

/sbin, which contains binary files used by the system administrator

Page 40: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 23

Page 41: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

The Root Directory (cont….)

However, Linux systems typically include several other directories, which may be used as mounting points for non- root file systems

Page 42: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 24

Page 43: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

The /dev DirectoryThe /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.

Device File DeviceConsole System consolecua* Deprecated—originally referred to a serial portfd* Floppy drivehd* IDE hard disk or CD-ROMlp* Parallel portmd* RAID arraynull Null output deviceramdisk RAM disksd* SCSI hard disk sr* SCSI CD-ROM st* SCSI tape tpqic*,ntpqic* QIC tape rft*,nrft*tty Terminal or pseudoterminalttys* Serial portvc* Contents of a tty device, such as a virtual console

Page 44: File system

zero Alt binary Os input device tty Serial port Contents of a tty

Filesystem Hierarchy Standards & filesystem Structure

Slide : 25

Page 45: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

The /etc Directory

The /etc directory is reserved for configuration files that are local to your machine.

Page 46: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 26

Page 47: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

Important Files in /etcF i l e C o n t e n t sa d j t i m e T i m e s y n c h r o n i z a t i o n d a t a f d p r m F l o p p y d i s k p a r a m e t e r sf s t a b F i l e s y s t e m t a b l eg e t t y d e f s L o g i n t e r m i n a l c h a r a c t e r i s t i c s g r o u p U s e r g r o u p s i n i t t a b S y s t e m s t a r t u p c o n f i g u r a t i o n 1 d . s o . c o n f S y s t e m l i b r a r y c a c h el i l o . c o n f L i n u x l o a d e r c o n f i g u r a t i o n m o t d M e s s a g e o f t h e d a ym t a b M o u n t e d f i l e s y s t e m t a b l en s s w i t c h . c o n f L i s t o f s q u r e e s f o r i n f o r m a t i o n o n u s e r s , h o s t s , n e t w o r k s , a n d s e r v i c e s . m t o o l s . c o n f C o n f i g u r a t i o n o f m t o o l s u t i l i t i e sp a s s w d U s e r a c c o u n t sp r o f i l e S h e l l i n i t i a l i z a t i o n s c r i p t s e c u r e t t y L i s t o f s e c u r e l o g i n t e r m i n a l ss h a d o w U s e r a c c o u n t _ e n c r y p t e d p a s s w o r d s , i f s h a d o w p a s s w o r d s e n a b l e ds h e l l s L i s t o f a p p r o v e d s h e l l ss y s l o g . c o n f S y s t e m l o g c o n f i g u r a t i o n e x p o r t s L i s t o f N S P e x p o r t sf t p * F T P c o n f i g u r a t i o n f i l e sh o s t . c o n f H o s t n a m e r e s o l u t i o n c o n f i g u r a t i o n ( s e e a l s o r e s o l v . c o n f )h o s t s L i s t o f k n o w n h o s t sh o s t s . a l l o w L i s t o f h o s t s a l l o w e d a c c e s s t o s e r v i c e s h o s t s . d e n y L i s t o f h o s t s d e n i e d a c c e s s t o s e r v i c e sh o s t s . e q u i v L i s t o f t r u s t e d h o s t si n e t d . c o n f C o n f i g u r a t i o n o f I n t e r n e t s u p e r - s e r v e r , i n e t d n e t w o r k s L i s t o f k n o w n n e t w o r k sp r i n t c a p P r i n t e r c o n f i g u r a t i o np r o t o c o l s L i s t o f k n o w n p r o t o c o l sr e s o l v . c o n f H o s t n a m e r e s o l u t i o n c o n f i g u r a t i o n ( s e e a l s o h o s t . c o n f )r p c L i s t o f R P C s e r v i c e ss e r v i c e s L i s t o f T C P / I P s e r v i c e s

Page 48: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 27

Page 49: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

Important Subdirectories of /etc

Subdirectory Contentscron* Configuration of corn servicehttpd Configuration of http (Web) servicepam.d Configuration of PAM, Red Hat's security library pcmcia Configuration of PCMCIAslots and devicesppp Configuration of PPPservices rc.d

Systeminitialization files security Security configurationskel User environment template files sysconfig

SystemconfigurationXll XWindowSystemconfiguration, including XF86 Config

Page 50: File system

file

Filesystem Hierarchy Standards & filesystem Structure

Slide : 28

Page 51: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

The /lib Directory

This is where the basic libraries for booting Linux and running standard programs reside.

Do not delete anything in this directory, ever

Page 52: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 29

Page 53: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

The /proc Directory

The /proc directory contains special files that either extract information or send information to the kernel..

I would advise against deleting anything in that directory.

Page 54: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 30

Page 55: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

The /bin Directory

This is where basic shell commands such as ls and mv

reside. This directory is always in the executable path.

The /bin directory contains binary files that are essentialto system operation in single-user mode.

These files are generally commands, which may be usedby the system administrator and by users.

Page 56: File system

Similar files not required for single user mode are placedin /usr/bin.

Filesystem Hierarchy Standards & filesystem Structure

Slide : 31

Page 57: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

Files in /bin

arch ash

df dmesg

igawk i

netstat nice

sort sttyash.static dnsdomainname kill nisdomainname su

awk doexec ksh ping syncbasename domainname linuxconf PS tarbash echo In pwd tcshbash2 ed loadkeys red touchbsh egrep login remadmin truecat ex ls rm umountchgrp false mail rmdir unamechmod fgrep mkdir rpm u

serconfchown fsconf mknod rvi usleepconsolechars

gawkgawk-3.0.3

mktempmore

rviewsed

vievie

And many more…………..

Page 58: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 32

Page 59: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

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.

arp, clock, getty, halt, init, fdisk, fsck.*, ifconfig, lilo, mkfs.*, mkswap, reboot, route, shutdown, swapoff, swapon, update

Page 60: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 33

Page 61: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

The /usr Directory

This is an interesting one. When you install programs like the GIMP, and Window maker, they need to be accessed by all users, so this is the directory they get installed into.

Page 62: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 34

Page 63: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

The /var Directory

This is where your log files, and printer files are kept.

Page 64: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 35

Page 65: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

The /home Directory

This is where your users have their accounts. If you have added any users other than your standard root account, they will show up here. It can also house the directories than your Web Server (Apache) accesses, if you have it installed.

Page 66: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 36

Page 67: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

The /mnt Directory

This is the location where you mount your cdrom, zip drives, or dos drives.

Page 68: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 37

Page 69: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

The /opt Directory

If you have this directory, its probably where Netscape has installed if you have chosen Netscape to be loaded. Red Hat's Applix office suite also installs here.

Page 70: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 38

Page 71: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

The /root Directory

This is main account directory. The root user have this space to keep all your downloads, and anything else you want to keep in there basically

Page 72: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 39

Page 73: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

The /tmp Directory

A useless directory, its short for Temporary. When you install Linux first, it creates a file in your /tmp directory with all the details.

The /tmp directory contains temporary files and subdirectories that are automatically deleted by the tmpwatch utility when they've not been used for a specified period of time (by default, 10 days).

Page 74: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 40

Page 75: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

/lost+found: Recovered Files

When you recover a file system, files and file data may be partially recovered. For example, the recovery utility may recover a file's data but not the file's name. Such files are placed by the utility in the/lost+found subdirectory of the root directory of the file system.

Page 76: File system

Filesystem Hierarchy Standards & filesystem Structure

Slide : 41

Page 77: File system

LINUX BASED NETWORKS Amer Irshad, Instructor

The Root and Standard Directories

• The root filesystem includes the root directory and a minimal set of files and subdirectories:– /boot for the kernel and boot up files;– /dev for device files;– /etc for configuration files (most important for SA);– /sbin (or /bin) for important utilities and binary files

(usually link to /usr/bin);

• Recommended in separated partitions:

– /usr for standard programs that are shareable across a whole site;– /home for home directories of users;– /var for spool directories, log files, accounting, etc.;– /tmp for temporary files;

Page 78: File system

– /proc stores images of all running process

Page 79: File system

Recommended