1 / 12

Linking Files and Disk Storage in Linux

Learn about linking files in Linux, including hard links and symbolic links, as well as managing disk storage and compressing files using utilities like tar, gzip, and rpm.

rbackus
Download Presentation

Linking Files and Disk Storage in Linux

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. Agenda The Linux File System (chapter 4 in text) • Linking Files • Hard Links / Symbolic Links • Disk Storage • Checking for Disk Space (df / du) • Archiving (Backing up) Files(tar, gzip, gunzip, rpm)

  2. Linking Files • Since UNIX is a multi-user operating system, it makes sense to allow users to share files to collaborate on projects (such as programming projects, reports, etc.) • In order to avoid duplication and inefficiency, it is better to provide links between files to give user illusion that what is edited on their file affects contents on other groups’ files.

  3. Linking Files There are two major types of links: Hard Link:ln [existing_file] [linked_file] • A directory entry containing the same “i-node number” of a file. All files have at least one hard-link - when removed, the link is removed Symbolic Link:ln -s [existing_file] [linked_file] • A directory entry containing pathname to file (i.e. a pointer). Unlike hard links, i-node numbers can be different, but possess other useful features.

  4. Linking Files • Remember to set appropriate permissions for: • your directories (such as pass-through permissions and permissions for appropriate directory) • the file to link (which groups can modify the link file, which groups can view, but not modify file, and which groups are not permitted to modify or view linked file)

  5. Hard Link Features • Cannot make hard links to directories • Cannot cross different file systems (since other file system may use i-node number for a already existing file…) • User can allow access to file to link via directory access permissions and will still allow access if user later block group & other access. • When “original file” that other user’s linked to is removed “linked file(s)’ will still exist.

  6. Soft Link Features • Can be used by users to link directories • Can link across different file systems since they are considered to be “pointers” • “Broken Links” can occur if original file is removed and link “points” to a file that does not exist.

  7. Disk Storage • It is important as a Unix or Linux administrator to periodically check on disk space to maintain efficiency. • Consequences of full disk: • Slower running System • Longer to access data • Running wrong programs or “outdated” programs by mistake

  8. Disk Storage • Unix Commands: • df displays the amount of disk space available on the filesystem containing each file name argument. If no file name is given, the space available on all currentlymounted filesystems is shown. • du summarizes disk usage of each FILE, recursively for directories

  9. Compressed Files • One way to deal with running out of disk space is to “compress” files. There are many ways in which a file may be compressed. How Do Files get Compressed? • One method of compressing text files is using Active Pattern Substitution. • Using this compression method, common patterns in text such as recurring words or “strings” are replaced or substituted with a shorter string.

  10. Example of a Compressed File Look at the following sentence: hey diddle diddle the cat and the fiddle (40 characters - including spaces) Substitute # for “the” and @ for “iddle”: hey d@ d@ # cat and # f@ (Only 24 characters - almost half the size of the original file!) Utilities and programs can be used to “compress” and “decompress” files

  11. File Compression Utilities • tar (.tz) • Tape Archive – A method used to compress files on tape (prior to disks). A compressed file using this utility is referred to as a “tarball”. • gzip / gunzip ( .g ) • A popular method for compressing files. Similar to “zip” and “unzip” commands for MS-DOS. • tar + gzip (.gtz) • Referred to as a “zipped tarball”, the file is first compressed by the tar command, and then “tarball” is further compressed by gzip command to save additional space.

  12. File Compression Utilities • rpm (.rpm) • Stands for “Red Hat Package Managers” which was developed by Red Hat Linux as a more “user-friendly” method of installing applications in Linux (as opposed to decompressing “zipped tarballs” and performing a manual installation. Please refer to the online man pages foreach utility and corresponding options…

More Related