Top Banner

of 50

Filesystem.pdf

Jul 07, 2018

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/18/2019 Filesystem.pdf

    1/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 1

    Linux Based Networks

    Instructor: Zia-ul-Haq Ch.

  • 8/18/2019 Filesystem.pdf

    2/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 2

    Today’s Agenda• 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

  • 8/18/2019 Filesystem.pdf

    3/50

    Class Meeting 3

    LINUX BASED NETWORKS  

    Filesystem Hierarchy Standards & filesystem Structure Slide : 3

    Comparison of MS-DOS & Linux

    In Linux path are separated

    by ‘/’.

    In Linux they are casesensitive

    In Linux a dot is like anyother character in a filename.

    In Linux, all file systems arepart of a single hierarchical treedescending from the root

    directory ‘/’.

    The directories in an MS-DOS

    path are separated by ‘\’ 

    In MS-DOS , file names arecase-insensitive

    The dot in an MS-DOS filename separates the name part

    from the extension.

    In MS-DOS , each file systemresides on its own drive,

    designated by ‘d:’.

    LinuxMicrosoft

  • 8/18/2019 Filesystem.pdf

    4/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 4

    In Linux , any file whoseexecute permission is turned on

    is executable , regardless of itsname.

    Linux file may have several

    name , each represented bydifferent link.

    In Linux you can set

    permissions on a file.

    In Linux , you must log in andprovide a password.

    In MS-DOS , an executable fileis one with an extension of

    .exe, .com, or .bat.

     An MS-DOS , file has only onename.

    In MS-DOS you can setattributes to make file readonly, hidden.

    In MS-DOS you areautomatically connected to your system when you turn on

     your system.

    LinuxMicrosoft

    Comparison of MS-DOS & Linux

  • 8/18/2019 Filesystem.pdf

    5/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 5

    Many Linux commands you type at a shell prompt arenot that different from the commands you would typeeither in MS-DOS or in Windows (from the MS-DOS

    prompt). In fact, some commands are identical.

    DOS to Linux Cheat Sheet

  • 8/18/2019 Filesystem.pdf

    6/50Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 6

    DOS to Linux Cheat Sheet

  • 8/18/2019 Filesystem.pdf

    7/50Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 7

    File Systems

    The file system is a combination of the partitions

    and directories that make up your Linux system.

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

    administering the system.

  • 8/18/2019 Filesystem.pdf

    8/50Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 8

    File System Types

    • Depends on the configuration of kernel, LINUX can

    support different types of FS (more than 20).

    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 notsupport writable media or hard links. (iso9660)

    nfs Network File System, the default distributed file system type

    rfs Remote File Share, AT&Ts RFS product.

    ext2 Second Extended File System. Common Linux file system.

    proc Process Access File System, allows access to active processesand 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.

    vfat

    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 notsupport writable media or hard links. (iso9660)

    nfs Network File System, the default distributed file system type

    rfs Remote File Share, AT&Ts RFS product.

    ext2 Second Extended File System. Common Linux file system.

    proc Process Access File System, allows access to active processesand 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.

    vfat

  • 8/18/2019 Filesystem.pdf

    9/50Class Meeting 3

    LINUX BASED NETWORKS 

    Filesystem Hierarchy Standards & filesystem Structure Slide : 9

    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.

    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.

      nux

  • 8/18/2019 Filesystem.pdf

    10/50Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 10

    Partitioning

    • For a large hard disk, it's better to split it intoseveral partitions (fdisk command):

    • The root partition

     – where / resides.

     – Contains all the things necessaryto start the system, (50MB to 100MB)

    • The swap partition

     – Used to support virtual memory.

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

     – Linux can support more than one swap partitionand swap file.

    /dev/hda1/dev/hda5

    /dev/sda2

    /dev/hda1/dev/hda5

    /dev/sda2

  • 8/18/2019 Filesystem.pdf

    11/50Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 11

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

    Mount Points

  • 8/18/2019 Filesystem.pdf

    12/50Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 12

    Understanding mounts

    Mount points are directories where one may mount a

    second disk partition to a first to make the second appearas part of 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.

  • 8/18/2019 Filesystem.pdf

    13/50Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 13

    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 thenetwork and the remote host were.

  • 8/18/2019 Filesystem.pdf

    14/50Class Meeting 3

    LINUX BASED NETWORKSr 

    Filesystem Hierarchy Standards & filesystem Structure Slide : 14

    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 mountedover it replace the original.

  • 8/18/2019 Filesystem.pdf

    15/50Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 15

    The mount command

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

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

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

     – After unmounting the file system, the directory (in this

    case, /flp) will be empty.

    mount -t type device dir

  • 8/18/2019 Filesystem.pdf

    16/50Class Meeting 3

    LINUX BASED NETWORKS 

    Filesystem Hierarchy Standards & filesystem Structure Slide : 16

    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 functionsome what as virtual hard drive.

    Inside each partition, you build a file system.

  • 8/18/2019 Filesystem.pdf

    17/50

  • 8/18/2019 Filesystem.pdf

    18/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 18

    File system Hierarchy Standard

    (FHS)

  • 8/18/2019 Filesystem.pdf

    19/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 19

    File system Structure

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

    The complete standard can be viewed at:

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

  • 8/18/2019 Filesystem.pdf

    20/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 20

    The Directory Tree Structure

  • 8/18/2019 Filesystem.pdf

    21/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 21

    Overview of the FHS

    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 asfor a normal user , it is dangerous to play with

    The /boot Directory

  • 8/18/2019 Filesystem.pdf

    22/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 22

    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.

  • 8/18/2019 Filesystem.pdf

    23/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 23

    The Root Directory (cont….)

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

     /bin, which contains binary files used by the systemadministrator 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 systemadministrator

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    24/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 24

    The Root Directory (cont….)

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

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    25/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 25

    The /dev Directory

    The /dev directory contains file system entries whichrepresent devices that are attached to the system. Thesefiles are essential for the system to function properly.

    Device File DeviceConsol e System console 

    cua* Deprecated—originally referred to a serial port 

    f d* Floppy drive 

    hd* IDE hard disk or CD-ROM 

    l p* Parallel port md* RAID array 

    nul l Null output device 

    r amdi sk RAM disk 

    sd* SCSI hard disk 

    sr* SCSI CD-ROM s t* SCSI tape 

    t pqi c*, nt pqi c* QIC tape r f t * , nr f t *tty Terminal or pseudoterminal ttys* Serial port

    vc* Contents of a tty device, such as a virtual consolezero Alt binary Os input device tty Serial port Contents of a tty

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    26/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 26

    The /etc Directory

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

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    27/50

    Class Meeting 3

    LINUX BASED NETWORKSr 

    Filesystem Hierarchy Standards & filesystem Structure Slide : 27

    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 s

    f s t a b F i l e s y s t e m t a b l e

    g 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 tu 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 e

    l i l o . c o n f L i n u x l o a d e r c o n f ig u r a t i o nm o t d M e s s a g e o f t h e d a y

    m t a b M o u n t e d f i l e s y s t e m t a b l e

    n 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 ig u r a t i o n o f m t o o l s u t i l i t i e s

     p a s s w d U s e r a c c o u n t s

     p 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 d

    s 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 lo g c o n f ig u r a t io ne x p o r t s L i s t o f N S P e x p o r tsf 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 io n c o n f ig 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 s

    h 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 sh 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 sin 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 dn 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 in t c a p P r in 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 lu t i o n c o n f i g u r a t io 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 ic 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

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    28/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 28

    Important Subdirectories of /etc

    Subdirectory Contents

    cron* Configuration of corn service

    httpd Configuration of http (Web) servicepam.d Configuration of PAM, Red Hat's security librarypcmcia Configuration of PCMCIA slots and devices

    ppp Configuration of PPP servicesrc.d System initialization filessecurity Security configurationskel User environment template filessysconfig System configurationXll X Window System configuration, including XF86 Config file

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    29/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 29

    The /lib Directory

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

    Do not delete anything in this directory, ever

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    30/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 30

    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 thatdirectory.

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    31/50

    Class Meeting 3

    LINUX BASED NETWORKSr 

    Filesystem Hierarchy Standards & filesystem Structure Slide : 31

    The /bin Directory

    This is where basic shell commands such as ls and mvreside. 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.

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    32/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 32

    Files in /bin

    arch  df   igawk  netstat sort ash  dmesg  ipcalc  nice  stty ash.static  dnsdomainname  kill  nisdomainname  su 

    awk  doexec  ksh ping  sync basename  domainname  linuxconf   PS  tar  bash  echo In  pwd  tcsh bash2  ed  loadkeys  red  touch 

    bsh egrep  login remadmin true cat ex ls rm umount chgrp  false mail  rmdir uname chmod fgrep mkdir   rpm  userconf  

    chown  fsconf mknod  rvi  usleep consolechars gawk mktemp  rview  vi cp gawk-3.0.3  more  sed  evie 

    And many more…………..

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    33/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 33

    The /sbin Directory

    The /sbin directory is for executables used only by the rootuser. 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

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    34/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 34

    The /usr Directory

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

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    35/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 35

    The /var Directory

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

    LINUX BASED NETWORKSr

  • 8/18/2019 Filesystem.pdf

    36/50

    Class Meeting 3

    LINUX BASED NETWORKSr 

    Filesystem Hierarchy Standards & filesystem Structure Slide : 36

    The /home Directory

    This is where your users have their accounts. If you haveadded any users other than your standard root account, theywill show up here. It can also house the directories than

    your Web Server (Apache) accesses, if you have itinstalled.

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    37/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 37

    The /mnt Directory

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

    or dos drives.

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    38/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 38

    The /opt Directory

    If you have this directory, its probably where Netscape has

    installed if you have chosen Netscape to be loaded. RedHat's Applix office suite also installs here.

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    39/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 39

    The /root Directory

    This is main account directory. The root user have thisspace to keep all your downloads, and anything else you

    want to keep in there basically

    LINUX BASED NETWORKSr

  • 8/18/2019 Filesystem.pdf

    40/50

    Class Meeting 3

    LINUX BASED NETWORKSr 

    Filesystem Hierarchy Standards & filesystem Structure Slide : 40

    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 thedetails.

    The /tmp directory contains temporary files andsubdirectories that are automatically deleted by thetmpwatch utility when they've not been used for a specifiedperiod of time (by default, 10 days).

    LINUX BASED NETWORKSr 

  • 8/18/2019 Filesystem.pdf

    41/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 41

     /lost+found: Recovered Files

    When you recover a file system, files and file data may bepartially recovered. For example, the recovery utility mayrecover a file's data but not the file's name. Such files areplaced by the utility in the/lost+found subdirectory of the

    root directory of the file system.

    LINUX BASED NETWORKSr 

  • 8/18/2019 Filesystem.pdf

    42/50

    Class Meeting 3

    LINUX BASED NETWORKS

    Filesystem Hierarchy Standards & filesystem Structure Slide : 42

    • The root filesystem includes the root directory and aminimal 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

    The Root and Standard Directories

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    43/50

    Class Meeting 3

    U S O S

    Filesystem Hierarchy Standards & filesystem Structure Slide : 43

    Basic File system Concepts

    The basis of the Linux Filesystem is firmly rooted in theproven concepts of the UNIX OS.

    Files are represented as inodes, and directories are filescontaining a list of entries and devices accessible by requestingI/O on special files.

    LINUX BASED NETWORKSr 

  • 8/18/2019 Filesystem.pdf

    44/50

    Class Meeting 3Filesystem Hierarchy Standards & filesystem Structure Slide : 44

    Data Storage Layout in ext2Data within the ext2 file system is stored in a series of

    identically sized data blocks.

    These blocks are generally 1,024 bytes, though you canset them to be a different size while making a file

    system.

    • All this information is contained within a file system object

    called an inode,

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    45/50

    Class Meeting 3Filesystem Hierarchy Standards & filesystem Structure Slide : 45

    The UNIX File System Design

    • The i-nodes – These are organized in a table format and

    created when the file system is created.

     – The inode contains more than 40 fields, such as

    number of hard links, owner, group, mode, size,time stamps, type (regular, directory, special file,etc), pointers to location of data blocks, etc.

     – Use chown, chgrp, touch commands to changesome of those information.

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    46/50

    Class Meeting 3Filesystem Hierarchy Standards & filesystem Structure Slide : 46

    The UNIX File System Design

    • The Super-block 

     – Its contains information on the size of the filesystem, the number of inodes, the number ofdata blocks, the free and used inodes, and theblock size for the file system.

     – The superblock is kept in memory and in multiplelocations on disk for each file system.

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    47/50

    Class Meeting 3Filesystem Hierarchy Standards & filesystem Structure Slide : 47

    Directories

    Directories are structured in a hierarchical tree. Each directorycan contain files and subdirectories. Directories areimplemented as a special type of files.

     Actually, a directory is a file containing a list of entries. Eachentry contains an inode number and a file name.

    LINUX BASED NETWORKSr 

  • 8/18/2019 Filesystem.pdf

    48/50

    University of Lahore [email protected] 48

    Class Meeting 3Filesystem Hierarchy Standards & filesystem Structure Slide : 48

    Steps in looking up a file

    Looking up /home/pat/ch1.txtLooking up /home/pat/ch1.txt

    i-node

    number 

    (2 bytes)

    6

    Size

    time

    132

    6 .

    1 ..

    19 user1

    30 john

    51 pat

    26 peter  

    home directory

    in block 132

    51

    Size

    time

    406

    51 .

    6 ..

    64 notes

    92 cgi

    81 ch1.txt

    17 doc

    pat directory

    in block 406

    1 .

    1 ..

    4 bin

    7 dev

    14 lib

    9 etc

    6 home

    8 tmp

    root directory

    81

    Size

    time

    512

    646

    379

    427

    81

    Size

    time

    512

    646

    379

    427

    data block (1kb)

    i-node

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    49/50

    Class Meeting 3Filesystem Hierarchy Standards & filesystem Structure Slide : 49

    Exercise:

    LINUX BASED NETWORKS

  • 8/18/2019 Filesystem.pdf

    50/50

    Homework

    • Homework this week:

    • Next week: