file system
DESCRIPTION
TRANSCRIPT
LINUX BASED NETWORKS Zahid Shafique, Instructor
Filesystem Hierarchy Standards & filesystem Structure
Slide : 1
Linux Based NetworksUniversity of Education
Instructor: Muhammad Amer Irshad
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
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 ‘/’.
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.
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.
LINUX BASED NETWORKS
DOS to Linux Cheat Sheet
Zahid Shafique, Instructor
Filesystem Hierarchy Standards & filesystem Structure
Slide : 6
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.
Filesystem Hierarchy Standards & filesystem Structure
Slide : 7
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.
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
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
Filesystem Hierarchy Standards & filesystem Structure
Slide : 9
/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.
– Linux can support more than one swap partition and swap file.
Filesystem Hierarchy Standards & filesystem Structure
Slide : 10
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.
Filesystem Hierarchy Standards & filesystem Structure
Slide : 11
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.
Filesystem Hierarchy Standards & filesystem Structure
Slide : 12
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.
Filesystem Hierarchy Standards & filesystem Structure
Slide : 13
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
bythose files is lost. The files in the disk partition mounted over it replace the original.
Filesystem Hierarchy Standards & filesystem Structure
Slide : 14
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
Filesystem Hierarchy Standards & filesystem Structure
Slide : 15
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.
Filesystem Hierarchy Standards & filesystem Structure
Slide : 16
LINUX BASED NETWORKS Amer Irshad, Instructor
Linux File System
Linux uses the second extended (ext2 & etx3) file system
University of Lahore [email protected] 17
Filesystem Hierarchy Standards & filesystem Structure
Slide : 17
LINUX BASED NETWORKS Amer Irshad, Instructor
File system Hierarchy Standard(FHS)
Filesystem Hierarchy Standards & filesystem Structure
Slide : 18
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/
Filesystem Hierarchy Standards & filesystem Structure
Slide : 19
LINUX BASED NETWORKS Amer Irshad, Instructor
The Directory Tree Structure
Filesystem Hierarchy Standards & filesystem Structure
Slide : 20
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
Filesystem Hierarchy Standards & filesystem Structure
Slide : 21
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.
The root directory also contains all files needed to shutdown and recover or repair the system.
Filesystem Hierarchy Standards & filesystem Structure
Slide : 22
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
Filesystem Hierarchy Standards & filesystem Structure
Slide : 23
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
Filesystem Hierarchy Standards & filesystem Structure
Slide : 24
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
zero Alt binary Os input device tty Serial port Contents of a tty
Filesystem Hierarchy Standards & filesystem Structure
Slide : 25
LINUX BASED NETWORKS Amer Irshad, Instructor
The /etc Directory
The /etc directory is reserved for configuration files that are local to your machine.
Filesystem Hierarchy Standards & filesystem Structure
Slide : 26
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
Filesystem Hierarchy Standards & filesystem Structure
Slide : 27
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
file
Filesystem Hierarchy Standards & filesystem Structure
Slide : 28
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
Filesystem Hierarchy Standards & filesystem Structure
Slide : 29
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.
Filesystem Hierarchy Standards & filesystem Structure
Slide : 30
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.
Similar files not required for single user mode are placedin /usr/bin.
Filesystem Hierarchy Standards & filesystem Structure
Slide : 31
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…………..
Filesystem Hierarchy Standards & filesystem Structure
Slide : 32
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
Filesystem Hierarchy Standards & filesystem Structure
Slide : 33
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.
Filesystem Hierarchy Standards & filesystem Structure
Slide : 34
LINUX BASED NETWORKS Amer Irshad, Instructor
The /var Directory
This is where your log files, and printer files are kept.
Filesystem Hierarchy Standards & filesystem Structure
Slide : 35
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.
Filesystem Hierarchy Standards & filesystem Structure
Slide : 36
LINUX BASED NETWORKS Amer Irshad, Instructor
The /mnt Directory
This is the location where you mount your cdrom, zip drives, or dos drives.
Filesystem Hierarchy Standards & filesystem Structure
Slide : 37
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.
Filesystem Hierarchy Standards & filesystem Structure
Slide : 38
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
Filesystem Hierarchy Standards & filesystem Structure
Slide : 39
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).
Filesystem Hierarchy Standards & filesystem Structure
Slide : 40
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.
Filesystem Hierarchy Standards & filesystem Structure
Slide : 41
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;
– /proc stores images of all running process