• Like
File system
Upcoming SlideShare
Loading in...5
×

File system

  • 145 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
145
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
12
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. LINUX BASED NETWORKS Zahid Shafique, Instructor Linux Based Networks University of Education Instructor: Muhammad Amer Irshad <aamer.irshad@yahoo.com> Filesystem Hierarchy Standards & filesystem Structure Slide : 1
  • 2. LINUX BASED NETWORKS Zahid Shafique, Instructor • 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 Filesystem Hierarchy Standards & filesystem Structure Slide : 2
  • 3. LINUX BASED NETWORKS Zahid Shafique, Instructor Comparison of MS-DOS & Linux Microsoft Linux ¾The directories in an MS-DOS path are separated by ‘’ ¾In Linux path are separated by ‘/’. ¾In MS-DOS, file names are case-insensitive ¾In Linux they are case sensitive ¾The dot in an MS-DOS file name separates the name part from the extension. ¾In Linux a dot is like any other character in a filename. ¾In MS-DOS, each file system resides on its own drive, designated by ‘d:’. Filesystem Hierarchy Standards & filesystem Structure ¾In Linux, all file systems are part of a single hierarchi cal tree descending from the root directory ‘/’. Slide : 3
  • 4. LINUX BASED NETWORKS Zahid Shafique, Instructor Comparison of MS-DOS & Linux Microsoft Linux ¾In MS-DOS, an executable file is one with an extension of .exe, .com, or .bat. ¾In Linux, any file whose execute permission is turned on is executable, regardless of its name. ¾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. Filesystem Hierarchy Standards & filesystem Structure ¾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. Slide : 4
  • 5. LINUX BASED NETWORKS Zahid Shafique, Instructor DOS to Linux Cheat Sheet Many Linux commands you type at a shell prompt are not 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. Filesystem Hierarchy Standards & filesystem Structure Slide : 5
  • 6. LINUX BASED NETWORKS Zahid Shafique, Instructor DOS to Linux Cheat Sheet Filesystem Hierarchy Standards & filesystem Structure Slide : 6
  • 7. LINUX BASED NETWORKS Amer Irshad, Instructor 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 and organized or you end up spending more time searching for files and programs than actually administering the system. Filesystem Hierarchy Standards & filesystem Structure Slide : 7
  • 8. LINUX BASED NETWORKS Amer Irshad, Instructor File System Types ufs UNIX File System, based on BSD Fat Fast File System (default). ufs • Depends Sierra System, used by CDROMs and supports Rock hsfs HighHigh File the configuration Sierra on File System, used of kernel, and LINUX can Rock Ridge by CDROMs extensions. Very similar to ufs, except that it does not supports support different support writable media or hardtypes (iso9660) (more FS Ridge extensions. links. of Very similar to than 20) nfsufs, Network File System, the default distributed file system type except . that it does not support writable media or RFS links. (iso9660) rfs Remote File Share, AT&Ts hard product. nfs Network File System, the default distributed file system type Ext4 Fourth Extended File System. Common Linux file system. rfs Remote File Share, System, allows access to active processes proc Process Access File AT&Ts RFS product. ext2 and their images. File System. real file system;file system. an Second Extended This is not a Common Linux instead, it's interface to the Linux kernel. proc Process Access File System, allows access to active processes msdos Usedtheir images. This is notfrom Linux.system; instead, it's an and to access MS-DOS files a real file interface to the Linux virtual swap swap partitions as like kernel. memory. msdos Used to access MS-DOS files from Linux. vfat swap swap partitions. vfat Filesystem Hierarchy Standards & filesystem Structure Slide : 8
  • 9. LINUX BASED NETWORKS Amer Irshad, Instructor Samples of Device Driver Name Device driver Device driver /dev/hda /dev/hda /dev/hdb /dev/hdb /dev/hdc /dev/hdc /dev/hdd /dev/hdd /dev/sda /dev/sda /dev/sdb /dev/sdb /dev/st0 /dev/st0 /dev/scd0 /dev/scd0 Drive Drive Master IDE drive, primary IDE bus. Master IDE drive, primary IDE bus. Slave IDE drive, primary IDE bus. Slave IDE drive, primary IDE bus. Master IDE drive, secondary IDE bus. Master IDE drive, secondary IDE bus. Slave IDE drive, secondary IDE bus. Slave IDE drive, secondary IDE bus. First SCSI hard drive. First SCSI hard drive. Linux Second SCSI hard drive. Second SCSI hard drive. First SCSI tape drive. First SCSI tape drive. First SCSI CD-ROM drive. First SCSI CD-ROM drive. Filesystem Hierarchy Standards & filesystem Structure Slide : 9
  • 10. 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 /dev/hda1 /dev/hda1 – where / resides. /dev/hda5 /dev/hda5 – Contains all the things necessary /dev/sda2 /dev/sda2 to 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 2 x Physical memory. – Linux can support more than one swap partition and swap file. Filesystem Hierarchy Standards & filesystem Structure Slide : 10
  • 11. 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 being mounted. Filesystem Hierarchy Standards & filesystem Structure Slide : 11
  • 12. LINUX BASED NETWORKS Amer Irshad, Instructor Understanding mounts Mount points are directories where one may mount a second disk partition to a first to make the second appear as part of the first. That is, the tree receives a "graft," another branch, at that point, and the tree thus becomes that much larger. In fact, this is the only way to add to the existing file system's Volume, by adding another partition to it. Filesystem Hierarchy Standards & filesystem Structure Slide : 12
  • 13. 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
  • 14. 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, the contents of the existing directory become unavailable. They can't be seen or used, and the disk space used by those files is lost. The files in the disk partition mounted over it replace the original. Filesystem Hierarchy Standards & filesystem Structure Slide : 14
  • 15. 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
  • 16. 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 is a 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
  • 17. LINUX BASED NETWORKS Amer Irshad, Instructor Linux File System Linux uses the second extended (ext2 & etx3) file system University of Lahore zahidshafiq@linuxmail.org Filesystem Hierarchy Standards & filesystem Structure 17 Slide : 17
  • 18. LINUX BASED NETWORKS Amer Irshad, Instructor File system Hierarchy Standard (FHS) Filesystem Hierarchy Standards & filesystem Structure Slide : 18
  • 19. 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
  • 20. LINUX BASED NETWORKS Amer Irshad, Instructor The Directory Tree Structure Filesystem Hierarchy Standards & filesystem Structure Slide : 20
  • 21. LINUX BASED NETWORKS Amer Irshad, Instructor Overview of the FHS The /boot Directory This is where the Kernel is stored and LILO/GRUB gets its information 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
  • 22. LINUX BASED NETWORKS Amer Irshad, Instructor The Root Directory ( / ) The root directory (/) of a Linux system is the directory that contains all other directories and files. Other directories may be separately mounted and thus may or may not be present at system startup. Therefore, the file system that contains the root directory must contain all files necessary to operate the system in single-user mode. The root directory also contains all files needed to shut down and recover or repair the system. Filesystem Hierarchy Standards & filesystem Structure Slide : 22
  • 23. 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
  • 24. 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 nonroot file systems Filesystem Hierarchy Standards & filesystem Structure Slide : 24
  • 25. LINUX BASED NETWORKS Amer Irshad, Instructor 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. Device File Device Console cua* fd* hd* lp* md* null ramdisk sd* sr* st* tpqic*,ntpqic* rft*,nrft* tty ttys* vc* zero System console Deprecated—originally referred to a serial port Floppy drive IDE hard disk or CD-ROM Parallel port RAID array Null output device RAM disk SCSI hard disk SCSI CD-ROM SCSI tape QIC tape Terminal or pseudoterminal Serial port Contents of a tty device, such as a virtual console Alt binary Os input device tty Serial port Contents of a tty Filesystem Hierarchy Standards & filesystem Structure Slide : 25
  • 26. 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
  • 27. LINUX BASED NETWORKS Amer Irshad, Instructor Important Files in /etc F ile C o n te n ts a d jtim e T im e s y n c h ro n iz a tio n d a ta fd p rm F lo p p y d is k p a ra m e te rs fs ta b F ile s y s te m ta b le g e tty d e fs L o g in te rm in a l c h a ra c te ris tic s g ro u p U ser g ro u p s in itta b S y s te m s ta rtu p c o n fig u ra tio n 1 d .s o .c o n f S y s te m lib ra ry c a c h e lilo .c o n f L in u x lo a d e r c o n fig u ra tio n m o td M e s s a g e o f th e d a y m ta b M o u n te d file s y s te m ta b le n s s w itc h .c o n f L is t o f s q u r e e s fo r in f o rm a tio n o n u s e r s , h o s ts ,n e tw o r k s ,a n d s e r v ic e s . m to o ls .c o n f C o n fig u ra tio n o f m to o ls u tilitie s p assw d U s e r a c c o u n ts p ro file S h e ll in itia liz a tio n s c rip t s e c u re tty L is t o f s e c u re lo g in te rm in a ls sh ado w U s e r a c c o u n t_ e n c ry p te d p a s s w o rd s , if s h a d o w p a s s w o rd s e n a b le d s h e lls L is t o f a p p r o v e d s h e lls s y s lo g . c o n f S y s t e m lo g c o n f ig u r a t io n e x p o rts L is t o f N S P e x p o r t s ftp * F T P c o n f ig u r a t io n f ile s h o s t.c o n f H o s t n a m e r e s o lu t io n c o n f ig u r a t io n ( s e e a ls o r e s o lv . c o n f ) h o s ts L is t o f k n o w n h o s t s h o s t s . a llo w L is t o f h o s t s a llo w e d a c c e s s t o s e r v ic e s h o s ts .d e n y L is t o f h o s t s d e n ie d a c c e s s t o s e r v ic e s h o s ts .e q u iv L is t o f t r u s t e d h o s t s in e t d . c o n f C o n f ig u r a t io n o f I n t e r n e t s u p e r - s e r v e r , in e t d n e tw o rk s L is t o f k n o w n n e t w o r k s p r in t c a p P r in t e r c o n f ig u r a t io n p r o t o c o ls L is t o f k n o w n p r o t o c o ls r e s o lv . c o n f H o s t n a m e r e s o lu t io n c o n f ig u r a t io n ( s e e a ls o h o s t . c o n f ) rp c L is t o f R P C s e r v ic e s s e r v ic e s L is t o f T C P / I P s e r v ic e s Filesystem Hierarchy Standards & filesystem Structure Slide : 27
  • 28. LINUX BASED NETWORKS Amer Irshad, Instructor Important Subdirectories of /etc Subdirectory Contents cron* Configuration of corn service httpd Configuration of http (Web) service pam.d Configuration of PAM, Red Hat's security library pcmcia Configuration of PCMCIAslots and devices ppp Configuration of PPPservices rc.d Systeminitialization files security Security configuration skel User environment template files sysconfig Systemconfiguration Xll XWindowSystemconfiguration, including XF86 Config file Filesystem Hierarchy Standards & filesystem Structure Slide : 28
  • 29. 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
  • 30. 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
  • 31. 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 essential to system operation in single-user mode. These files are generally commands, which may be used by the system administrator and by users. Similar files not required for single user mode are placed in /usr/bin. Filesystem Hierarchy Standards & filesystem Structure Slide : 31
  • 32. LINUX BASED NETWORKS Amer Irshad, Instructor Files in /bin arch ash ash.static awk basename bash bash2 bsh cat chgrp chmod chown consolechars cp df dmesg dnsdomainname doexec domainname echo ed egrep ex false fgrep fsconf gawk gawk-3.0.3 igawk ipcalc kill ksh linuxconf In loadkeys login ls mail mkdir mknod mktemp more netstat nice nisdomainname ping PS pwd red remadmin rm rmdir rpm rvi rview sed sort stty su sync tar tcsh touch true umount uname userconf usleep vi evie And many more………….. Filesystem Hierarchy Standards & filesystem Structure Slide : 32
  • 33. 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
  • 34. 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
  • 35. 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
  • 36. 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
  • 37. 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
  • 38. 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
  • 39. 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
  • 40. 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
  • 41. 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
  • 42. 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