1 / 33

Devices, Linux Filesystems,and the Filesystem Hirarchy standard

Devices, Linux Filesystems,and the Filesystem Hirarchy standard. Objectives. Create Partisions and Filesystems Maintain the integrity of filesystems Control filesystem mounting and unmounting Set and view disk quotas Use file premissions to control access to files Manage file ownership

gema
Download Presentation

Devices, Linux Filesystems,and the Filesystem Hirarchy standard

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Devices, Linux Filesystems,and the Filesystem Hirarchy standard

  2. Objectives • Create Partisions and Filesystems • Maintain the integrity of filesystems • Control filesystem mounting and unmounting • Set and view disk quotas • Use file premissions to control access to files • Manage file ownership • Create and change hard and symbolic links • Find system files and place files in the correct location

  3. Disk Drives Under Linux • Linux supports all sorts of drives and file system types • The two most widley used types are IDE and SCISI • IDE = Intergrated Device Electronics drive. • SCSI ( pronounced “scuzzy”) , Small Computer System Interface drive.

  4. Hard disk devices IDE • /dev/hda = primary Master • /dev/hdb = primary Slave • /dev/hdc = Secondary Master • /dev/hdd = Secondary Slave • These may change in the future as the politicaly correct are trying to do away with the terms “Master “ and “Slave”...

  5. Hard disk Drives SCSI • /dev/sda first SCSI drive • /dev/sdb Second SCSI drive , sdc,sdd,sde , and so on ... • Can be up to 15 devices on a single interface , most of the innards are on the interface card where under IDE the innards are on the drive itself. • SCSI are typlicaly more expensive and considered more reliable and are used on servers and workstations , where IDE's are typicaly found on desktop machines .

  6. Disk partitions • Disk can contain up to 16 partitions. • The drive partition is expressed as a number after the drive name , such as “/dev/hda1” for the first partition on the primary master drive.

  7. Partition Types • Primary - This type contains a filesystem, up to four may exist. One must be marked as active and contain the operating system so the BIOS can find and load it at boot time. • Extended – a varient of the primary , a container for logical partitions. Only one per disk. • Logical – from 1 to 12 logical partiitions can be created , logical partitions are numbered from 5 to 16.

  8. The root filesystem and mount points • / - the root directory • /bin and /sbin - Contains system binarys. • /etc – configuration files. • /lib - program libraries. • /boot - Kernal images and other files used to boot the system.

  9. Mount points cont... • /home – user files area. • /temp – temporay files space • /var – log files • /usr – user commands , source files , documentation, ect... • /swap – used to enable virtual memory.

  10. Managing Partitions • Fdisk [device] • Example to work with the primary master drive the command “fdisk /dev/hda” would be used , that by the way is also the default , if no drive is invoked. • Swiches , a ,d,l,m,n,p,t,w • Demonstration of fdisk

  11. Creating Filesystems • Mkfs [ -t fs_type] [fs_options] device • Where fs_type is one of the supported file systems like msdos or ext2 or ext3 • And fs_options , see man pages for options • Device - the partitision you want to work on • - mksf is like format command in DOS..

  12. Swap files • Syntax – mkswap device • Such as “mkswap /dev/hdb3” for make a swap partitition on the first IDE interface , Slave drive, partition number 3 please ...

  13. Maintain the integrity of filesystems • Monitor free disk space and Inodes • Monitor disk usage • Checking filesystem integrity

  14. Df command • Syntax – df [options] [directories] • “ df ” command gives information about disk space and inode utilization. • Options , -h information about space , -i information about inodes. • “df -h /dev/hda” , tell me about the space on the primary master drive ....

  15. Du Command or Disk Utilization • Syntax: du[options][directories] • -a , shows all files , not just directories. • -c, grand total. • -h , produces out put in a form that us lowly humans can understand ! • -s , prints summery • -S, Excludes subdirectories from count and totals. • Example :

  16. Checking Filesystem Integrity • Filesystems can become scrambles because of power failure and othere things. • The “fsck” program allows you to restore the superblock with a good copy. • Syntax: fsck[-t type] [fs-options] filesystem • Example: fsck -f /dev/hda5

  17. Controling Filesystem Mounting and Unmounting • Each filesysyem is mounted as a directory to the root file system. • To automaticaly mount filesystems at boot time use the “/etc/fstab “ file . • The “fstab” file tell the kernal what and where the filesystems are and how they are to be used.

  18. Managing fstab • There are 6 fields that make up each line in the fstab file. Each field preforms a different function. • Device, mount point, Filesystem type , mount options , Dumb frequency and pass number . • Example :

  19. Mounting Filesystems • The Mount command is used to mount filesystems. • Syntax • mount [command_line_options] device derectory • Example: to mount a cdrom • Mount -t iso9660 /dev/hdc /mnt/cdrom

  20. Unmounting a filesystem • Command : umount [options] device | directory • Example : umount /cdrom or umount /dev/hdc

  21. Quotas • Per-user hard limit • Per-user soft limit • Per-group hard limit • Per-group soft limit • Grace period

  22. Quota Commands • quota [-u | -g] [options] user | group • Displays quota limits. • Qutaon [options] [filesystems] • Turns on Quotas. • Quotaoff [options] [filesystem] • Turns off Quotas. • Quotacheck [options] filesystems • Compiles quota databases , should be run weekly via cron.

  23. Quota Commands cont. • Edquota [-p proto-user] [options] names • Used to edit quotas for users and groups , it uses vi editor . It is interactive . • Repquota [options] filesystems • Used to report quotas for users and groups

  24. Enabling Quotas • Set options in /etc/fstab , add userquota and grpquota to the default options. • Create a “quota.user and quota.group files at the top of the /home filesystem and make it a root access only. • Run quotacheck to make the database. • Run quotaon to enabel the quota system. • Check to see if it's starting up in your init script at boot. • Make a cron job to run quotacheck.

  25. Use File Permissions to control access to files. • Three Classes of users • User – The user that owns the file. • Group – The group that owns the file. • Other – All others users on the system.

  26. File Permissions • Read , mnemonic = r , examine contents of file and list directory contents. • Write , mnemonic = w , Write to or change the file and create and remove files in the directory. • Execute , mnemonic = x , run the file as a program also read and write files in a directory.

  27. File permissions cont. • From left to right user, group, other • Mnemonic are used to indicte tru and “-” indicates false. • Rw-rw-r-- • User has read write permissions ,group has read write permissions and others have only read permissions.

  28. SUID , SGID and Sticky • SUID(Set User ID) is for executable files only , if the SUID bit is set the files owner owns the resulting process , no mater who launched the program. • SGID(Set Group ID) works the same for groups as SUID does . When set on a directory all files created inside that directory belong to the group. • Sticky keeps a program in memory after execution . When used in a team inviroment it allows groups to create and modify files but only file owners can delete or rename them.

  29. Setting Access Modes • Umask, used to set initial file modes for a shell session. • Chmod , changes mode of a file • Chmod [options] symbolic_mode ... files , example: chmod u=rw,go=w aflie • chmod[options] octal_mode files, example: chmod 666 afile • Chmod +r afile , makes it readable for all class of users ...

  30. Manage file ownership • Use chown and chgrp • Chown can be used to change both user and group of a file . • Chown [options] user-owner files • Chown [options] user-owner.group-owner files • Chown [options] .group-owner files • Chown [options] –reference=rfile files , uses rfile as a template for permissions of files .

  31. Hard and symbolic links • A link is pseudofile that creats a shortcut to a file. • Symbolic links are tiny flies that contain a pointer to another file. • Hard links are not realy a link but a copy of another directory entry. Two directory entries have different names but point to the same inode

  32. Link commands • Ln creats a link • Ln [options] file link • To find the file pointed to by the link use the ls -l command.

  33. Finding files and placing them in the proper location • Locating files , commands.. • Which , example : which tcsh • Find • Locate • Updatedb • Whatis • Apropos

More Related