Part Workbook 5. the Linux Filesystem Table of Contents

Total Page:16

File Type:pdf, Size:1020Kb

Part Workbook 5. the Linux Filesystem Table of Contents Part Workbook 5. The Linux Filesystem Table of Contents 1. File Details ................................................................................................................... 5 Discussion .............................................................................................................. 5 How Linux Save Files ...................................................................................... 5 What's in an inode? .......................................................................................... 6 Viewing inode information with the stat command ................................................. 9 Viewing inode information with the ls command .................................................. 10 Identifying Files by Inode ................................................................................ 10 Examples .............................................................................................................. 11 Example 1. Comparing file sizes with ls -s and ls -l ............................................... 11 Example 2. Listing files, sorted by modify time ..................................................... 11 Example 3. Decorating listings with ls -F ............................................................. 12 Online Exercises .................................................................................................... 13 Online Exercise 1. Viewing file metadata ............................................................. 13 Specification .......................................................................................... 13 Deliverables ........................................................................................... 13 Suggestions ........................................................................................... 13 Questions .............................................................................................................. 13 2. Hard and Soft Links ..................................................................................................... 17 Discussion ............................................................................................................. 17 The Case for Hard Links ................................................................................. 17 Hard Link Details ........................................................................................... 17 The Case for Soft Links .................................................................................. 19 Soft Link Details ............................................................................................ 20 Creating Links with the ln Command ................................................................. 20 Issues with Soft Links ..................................................................................... 21 Dangling Links ...................................................................................... 21 Recursive links ....................................................................................... 22 Absolute vs. Relative Soft Links ............................................................... 23 Comparing Hard and Soft Links ........................................................................ 23 Examples .............................................................................................................. 23 Example 1. Working with hard links ................................................................... 23 Example 2. Working with soft links .................................................................... 24 Example 3. Working with soft links and directories ................................................ 25 Online Exercises .................................................................................................... 25 Online Exercise 1. Creating and Managing Links ................................................... 25 Specification .......................................................................................... 25 Deliverables ........................................................................................... 26 Online Exercise 2. Sharing a Hard Linked File ...................................................... 26 Specification .......................................................................................... 26 Deliverables ........................................................................................... 27 Questions .............................................................................................................. 27 3. Directories and Device Nodes ........................................................................................ 30 Discussion ............................................................................................................. 30 Directories ..................................................................................................... 30 Directory Structure ................................................................................. 30 Directory Links ...................................................................................... 31 Device Nodes ................................................................................................ 33 Block and Character Device Nodes ............................................................ 33 Terminals as Devices .............................................................................. 34 Device Permissions, Security, and the Console User ...................................... 35 Examples .............................................................................................................. 36 2 The Linux Filesystem Example 1. Interpreting Directory Links Counts .................................................... 36 Questions .............................................................................................................. 37 4. Disks, Filesystems, and Mounting ................................................................................... 40 Discussion ............................................................................................................. 40 Disk Devices ................................................................................................. 40 Low Level Access to Drives ............................................................................. 41 Filesystems .................................................................................................... 42 Mounting Filesystems ...................................................................................... 43 Viewing Mount Points ............................................................................. 44 Why Bother? ......................................................................................... 44 Mounting Temporary Media: The /media directory. ....................................... 45 Mounting Issues ..................................................................................... 46 Examples .............................................................................................................. 47 Example 1. Using an Unformatted Floppy ............................................................ 47 Example 2. Using a DOS Formatted Floppy ......................................................... 48 Example 3. Floppy Images ................................................................................ 49 Online Exercises .................................................................................................... 49 Online Exercise 1. Using Floppies ...................................................................... 49 Setup .................................................................................................... 49 Specification .......................................................................................... 50 Deliverables ........................................................................................... 50 Possible Solution .................................................................................... 50 Cleaning Up .......................................................................................... 50 Online Exercise 2. Imaging a Floppy ................................................................... 50 Setup .................................................................................................... 51 Specification .......................................................................................... 51 Deliverables ........................................................................................... 51 Possible Solution .................................................................................... 51 Cleaning Up .......................................................................................... 51 Questions .............................................................................................................. 51 5. Locating Files with locate and find ................................................................................. 55 Discussion ............................................................................................................. 55 Locating Files ................................................................................................ 55 Using Locate ................................................................................................. 55 Using find ....................................................................................................
Recommended publications
  • Fundamentals of UNIX Lab 5.4.6 – Listing Directory Information (Estimated Time: 30 Min.)
    Fundamentals of UNIX Lab 5.4.6 – Listing Directory Information (Estimated time: 30 min.) Objectives: • Learn to display directory and file information • Use the ls (list files) command with various options • Display hidden files • Display files and file types • Examine and interpret the results of a long file listing • List individual directories • List directories recursively Background: In this lab, the student will use the ls command, which is used to display the contents of a directory. This command will display a listing of all files and directories within the current directory or specified directory or directories. If no pathname is given as an argument, ls will display the contents of the current directory. The ls command will list any subdirectories and files that are in the current working directory if a pathname is specified. The ls command will also default to a wide listing and display only file and directory names. There are many options that can be used with the ls command, which makes this command one of the more flexible and useful UNIX commands. Command Format: ls [-option(s)] [pathname[s]] Tools / Preparation: a) Before starting this lab, the student should review Chapter 5, Section 4 – Listing Directory Contents b) The student will need the following: 1. A login user ID, for example user2, and a password assigned by their instructor. 2. A computer running the UNIX operating system with CDE. 3. Networked computers in classroom. Notes: 1 - 5 Fundamentals UNIX 2.0—-Lab 5.4.6 Copyright 2002, Cisco Systems, Inc. Use the diagram of the sample Class File system directory tree to assist with this lab.
    [Show full text]
  • Copy on Write Based File Systems Performance Analysis and Implementation
    Copy On Write Based File Systems Performance Analysis And Implementation Sakis Kasampalis Kongens Lyngby 2010 IMM-MSC-2010-63 Technical University of Denmark Department Of Informatics Building 321, DK-2800 Kongens Lyngby, Denmark Phone +45 45253351, Fax +45 45882673 [email protected] www.imm.dtu.dk Abstract In this work I am focusing on Copy On Write based file systems. Copy On Write is used on modern file systems for providing (1) metadata and data consistency using transactional semantics, (2) cheap and instant backups using snapshots and clones. This thesis is divided into two main parts. The first part focuses on the design and performance of Copy On Write based file systems. Recent efforts aiming at creating a Copy On Write based file system are ZFS, Btrfs, ext3cow, Hammer, and LLFS. My work focuses only on ZFS and Btrfs, since they support the most advanced features. The main goals of ZFS and Btrfs are to offer a scalable, fault tolerant, and easy to administrate file system. I evaluate the performance and scalability of ZFS and Btrfs. The evaluation includes studying their design and testing their performance and scalability against a set of recommended file system benchmarks. Most computers are already based on multi-core and multiple processor architec- tures. Because of that, the need for using concurrent programming models has increased. Transactions can be very helpful for supporting concurrent program- ming models, which ensure that system updates are consistent. Unfortunately, the majority of operating systems and file systems either do not support trans- actions at all, or they simply do not expose them to the users.
    [Show full text]
  • Administering Unidata on UNIX Platforms
    C:\Program Files\Adobe\FrameMaker8\UniData 7.2\7.2rebranded\ADMINUNIX\ADMINUNIXTITLE.fm March 5, 2010 1:34 pm Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta UniData Administering UniData on UNIX Platforms UDT-720-ADMU-1 C:\Program Files\Adobe\FrameMaker8\UniData 7.2\7.2rebranded\ADMINUNIX\ADMINUNIXTITLE.fm March 5, 2010 1:34 pm Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Notices Edition Publication date: July, 2008 Book number: UDT-720-ADMU-1 Product version: UniData 7.2 Copyright © Rocket Software, Inc. 1988-2010. All Rights Reserved. Trademarks The following trademarks appear in this publication: Trademark Trademark Owner Rocket Software™ Rocket Software, Inc. Dynamic Connect® Rocket Software, Inc. RedBack® Rocket Software, Inc. SystemBuilder™ Rocket Software, Inc. UniData® Rocket Software, Inc. UniVerse™ Rocket Software, Inc. U2™ Rocket Software, Inc. U2.NET™ Rocket Software, Inc. U2 Web Development Environment™ Rocket Software, Inc. wIntegrate® Rocket Software, Inc. Microsoft® .NET Microsoft Corporation Microsoft® Office Excel®, Outlook®, Word Microsoft Corporation Windows® Microsoft Corporation Windows® 7 Microsoft Corporation Windows Vista® Microsoft Corporation Java™ and all Java-based trademarks and logos Sun Microsystems, Inc. UNIX® X/Open Company Limited ii SB/XA Getting Started The above trademarks are property of the specified companies in the United States, other countries, or both. All other products or services mentioned in this document may be covered by the trademarks, service marks, or product names as designated by the companies who own or market them. License agreement This software and the associated documentation are proprietary and confidential to Rocket Software, Inc., are furnished under license, and may be used and copied only in accordance with the terms of such license and with the inclusion of the copyright notice.
    [Show full text]
  • Ubuntu Kung Fu
    Prepared exclusively for Alison Tyler Download at Boykma.Com What readers are saying about Ubuntu Kung Fu Ubuntu Kung Fu is excellent. The tips are fun and the hope of discov- ering hidden gems makes it a worthwhile task. John Southern Former editor of Linux Magazine I enjoyed Ubuntu Kung Fu and learned some new things. I would rec- ommend this book—nice tips and a lot of fun to be had. Carthik Sharma Creator of the Ubuntu Blog (http://ubuntu.wordpress.com) Wow! There are some great tips here! I have used Ubuntu since April 2005, starting with version 5.04. I found much in this book to inspire me and to teach me, and it answered lingering questions I didn’t know I had. The book is a good resource that I will gladly recommend to both newcomers and veteran users. Matthew Helmke Administrator, Ubuntu Forums Ubuntu Kung Fu is a fantastic compendium of useful, uncommon Ubuntu knowledge. Eric Hewitt Consultant, LiveLogic, LLC Prepared exclusively for Alison Tyler Download at Boykma.Com Ubuntu Kung Fu Tips, Tricks, Hints, and Hacks Keir Thomas The Pragmatic Bookshelf Raleigh, North Carolina Dallas, Texas Prepared exclusively for Alison Tyler Download at Boykma.Com Many of the designations used by manufacturers and sellers to distinguish their prod- ucts are claimed as trademarks. Where those designations appear in this book, and The Pragmatic Programmers, LLC was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf and the linking g device are trademarks of The Pragmatic Programmers, LLC.
    [Show full text]
  • System Calls System Calls
    System calls We will investigate several issues related to system calls. Read chapter 12 of the book Linux system call categories file management process management error handling note that these categories are loosely defined and much is behind included, e.g. communication. Why? 1 System calls File management system call hierarchy you may not see some topics as part of “file management”, e.g., sockets 2 System calls Process management system call hierarchy 3 System calls Error handling hierarchy 4 Error Handling Anything can fail! System calls are no exception Try to read a file that does not exist! Error number: errno every process contains a global variable errno errno is set to 0 when process is created when error occurs errno is set to a specific code associated with the error cause trying to open file that does not exist sets errno to 2 5 Error Handling error constants are defined in errno.h here are the first few of errno.h on OS X 10.6.4 #define EPERM 1 /* Operation not permitted */ #define ENOENT 2 /* No such file or directory */ #define ESRCH 3 /* No such process */ #define EINTR 4 /* Interrupted system call */ #define EIO 5 /* Input/output error */ #define ENXIO 6 /* Device not configured */ #define E2BIG 7 /* Argument list too long */ #define ENOEXEC 8 /* Exec format error */ #define EBADF 9 /* Bad file descriptor */ #define ECHILD 10 /* No child processes */ #define EDEADLK 11 /* Resource deadlock avoided */ 6 Error Handling common mistake for displaying errno from Linux errno man page: 7 Error Handling Description of the perror () system call.
    [Show full text]
  • Complete Issue 40:3 As One
    TUGBOAT Volume 40, Number 3 / 2019 General Delivery 211 From the president / Boris Veytsman 212 Editorial comments / Barbara Beeton TEX Users Group 2019 sponsors; Kerning between lowercase+uppercase; Differential “d”; Bibliographic archives in BibTEX form 213 Ukraine at BachoTEX 2019: Thoughts and impressions / Yevhen Strakhov Publishing 215 An experience of trying to submit a paper in LATEX in an XML-first world / David Walden 217 Studying the histories of computerizing publishing and desktop publishing, 2017–19 / David Walden Resources 229 TEX services at texlive.info / Norbert Preining 231 Providing Docker images for TEX Live and ConTEXt / Island of TEX 232 TEX on the Raspberry Pi / Hans Hagen Software & Tools 234 MuPDF tools / Taco Hoekwater 236 LATEX on the road / Piet van Oostrum Graphics 247 A Brazilian Portuguese work on MetaPost, and how mathematics is embedded in it / Estev˜aoVin´ıcius Candia LATEX 251 LATEX news, issue 30, October 2019 / LATEX Project Team Methods 255 Understanding scientific documents with synthetic analysis on mathematical expressions and natural language / Takuto Asakura Fonts 257 Modern Type 3 fonts / Hans Hagen Multilingual 263 Typesetting the Bangla script in Unicode TEX engines—experiences and insights Document Processing / Md Qutub Uddin Sajib Typography 270 Typographers’ Inn / Peter Flynn Book Reviews 272 Book review: Hermann Zapf and the World He Designed: A Biography by Jerry Kelly / Barbara Beeton 274 Book review: Carol Twombly: Her brief but brilliant career in type design by Nancy Stock-Allen / Karl
    [Show full text]
  • Filesystems HOWTO Filesystems HOWTO Table of Contents Filesystems HOWTO
    Filesystems HOWTO Filesystems HOWTO Table of Contents Filesystems HOWTO..........................................................................................................................................1 Martin Hinner < [email protected]>, http://martin.hinner.info............................................................1 1. Introduction..........................................................................................................................................1 2. Volumes...............................................................................................................................................1 3. DOS FAT 12/16/32, VFAT.................................................................................................................2 4. High Performance FileSystem (HPFS)................................................................................................2 5. New Technology FileSystem (NTFS).................................................................................................2 6. Extended filesystems (Ext, Ext2, Ext3)...............................................................................................2 7. Macintosh Hierarchical Filesystem − HFS..........................................................................................3 8. ISO 9660 − CD−ROM filesystem.......................................................................................................3 9. Other filesystems.................................................................................................................................3
    [Show full text]
  • System-Level I/O „ I Have Modified Them and Added New Slides
    JDEP 284H Giving credit where credit is due Foundations of Computer Systems Most of slides for this lecture are based on slides created by Drs. Bryant and O’Hallaron, Carnegie Mellon University. System-Level I/O I have modified them and added new slides. Dr. Steve Goddard [email protected] http://cse.unl.edu/~goddard/Courses/JDEP284 2 Topics A Typical Hardware System CPU chip register file Unix I/O ALU Robust reading and writing system bus memory bus Reading file metadata I/O main bus interface Sharing files bridge memory I/O redirection Standard I/O I/O bus Expansion slots for other devices such USB graphics disk as network adapters. controller adapter controller mouse keyboard monitor disk 3 4 Reading a Disk Sector: Step 1 Reading a Disk Sector: Step 2 CPU chip CPU chip CPU initiates a disk read by writing a Disk controller reads the sector and register file command, logical block number, and register file performs a direct memory access (DMA) destination memory address to a port transfer into main memory. ALU ALU (address) associated with disk controller. main main bus interface bus interface memory memory I/O bus I/O bus USB graphics disk USB graphics disk controller adapter controller controller adapter controller mouse keyboard monitor mouse keyboard monitor disk disk 5 6 Page 1 Reading a Disk Sector: Step 3 Unix Files CPU chip When the DMA transfer completes, the register file disk controller notifies the CPU with an A Unix file is a sequence of m bytes: interrupt (i.e., asserts a special “interrupt” B , B , ...
    [Show full text]
  • Oracle® Solaris 11.3 Desktop User's Guide
    ® Oracle Solaris 11.3 Desktop User's Guide Part No: E54809 April 2020 Oracle Solaris 11.3 Desktop User's Guide Part No: E54809 Copyright © 2011, 2020, Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable: U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, shall be subject to license terms and license restrictions applicable to the programs. No other rights are granted to the U.S.
    [Show full text]
  • Protecting an Industrial AC Drive Application Against Cyber Sabotage
    Erno Pentzin Protecting an Industrial AC Drive Application against Cyber Sabotage School of Electrical Engineering Thesis submitted for examination for the degree of Master of Science in Technology. Espoo 2013-01-28 Thesis supervisor: Asst. Prof. Marko Hinkkanen Thesis instructor: M.Sc. (Tech.) Mika J. K¨arn¨a Aalto University School of Electrical A'' Engineering aalto university abstract of the school of electrical engineering master’s thesis Author: Erno Pentzin Title: Protecting an Industrial AC Drive Application against Cyber Sabotage Date: 2013-01-28 Language: English Numberofpages:15+119 Department of Electrical Engineering Professorship: Electric Drives Code: S3016 Supervisor: Asst. Prof. Marko Hinkkanen Instructor: M.Sc. (Tech.) Mika J. K¨arn¨a Discovered in 2010, the highly advanced computer virus called Stuxnet, also de- scribed as the first weapon of cyber warfare, reportedly destroyed at least 1,000 gas centrifuges enriching uranium in Iran. This kind of act of cyber sabotage was conducted by compromising the industrial control system, disabling protection functions of AC drives running the centrifuges, and making them spin at such high speeds that centrifugal forces caused their rotors to rupture. Decanters are another type of centrifuges used to separate solids from liquids in many industries including water treatment and mining for example. Also known as solid-bowl, scroll-discharge centrifuges, decanters are commonly powered by induction motors and AC drives. Assuming havoc similar to the Stuxnet case can be prevented with suitable safety systems, a review was conducted on the protection methods for decanter centrifuges based on literature and the current security and safety features of the following modern AC drives with Ethernet- based fieldbus connectivity: ABB ACS880-01, Rockwell Allen-Bradley PowerFlex 755, and Siemens SINAMICS S110.
    [Show full text]
  • System Programming Processes, Memory and Communication
    System Programming Processes, memory and communication Thomas Ropars [email protected] 2021 1 The slides are available at: https://m1-mosig-os.gitlab.io/ 2 References Main references: • Advanced Programming in the Unix Environment by R. Stevens • The Linux Programming Interface by M. Kerrish • Operating Systems: Three Easy Pieces by R. Arpaci-Dusseau and A. Arpaci-Dusseau (introduction chapter) • Computer Systems: A Programmer's Perspective by R. Bryant and D. O'Hallaron The content of these lectures is inspired by: • The lecture notes of Prof. J.F. Mehaut. • The lecture notes of R. Lachaize. 3 Agenda What is an operating system? Unix File System The Shell Processes Inputs/Outputs 4 Agenda What is an operating system? Unix File System The Shell Processes Inputs/Outputs 5 Purpose of an operating system Operations run by a program: • Executing instructions • Reading/writing to memory • Reading/writing files • Accessing devices The operating system is here to make it easier to write and run programs, and to manage resources. 6 What is an operating system? Figure by R. Bryant and D. O'Hallaron The operating system is a layer of software interposed between the application program and the hardware Application programs Software Operating system Processor Main memory I/O devices Hardware Two main roles: • Virtualization • Resource management 7 Virtualization Transforms the physical resources into virtualized resources: • It hides the low-level interface of the hardware and provides higher-level abstractions: I easy to use I more general (hides the differences between different hardwares) I powerful I prevents programs from misusing the hardware It provides an API (Application Programming Interface) that allows user programs to interact with OS services: • A set of libraries • System calls 8 Resource management The OS allows several programs to run on the machine at the same time.
    [Show full text]
  • GNU Findutils Finding Files Version 4.8.0, 7 January 2021
    GNU Findutils Finding files version 4.8.0, 7 January 2021 by David MacKenzie and James Youngman This manual documents version 4.8.0 of the GNU utilities for finding files that match certain criteria and performing various operations on them. Copyright c 1994{2021 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled \GNU Free Documentation License". i Table of Contents 1 Introduction ::::::::::::::::::::::::::::::::::::: 1 1.1 Scope :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 1 1.2 Overview ::::::::::::::::::::::::::::::::::::::::::::::::::::::: 2 2 Finding Files ::::::::::::::::::::::::::::::::::::: 4 2.1 find Expressions ::::::::::::::::::::::::::::::::::::::::::::::: 4 2.2 Name :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 4 2.2.1 Base Name Patterns ::::::::::::::::::::::::::::::::::::::: 5 2.2.2 Full Name Patterns :::::::::::::::::::::::::::::::::::::::: 5 2.2.3 Fast Full Name Search ::::::::::::::::::::::::::::::::::::: 7 2.2.4 Shell Pattern Matching :::::::::::::::::::::::::::::::::::: 8 2.3 Links ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 8 2.3.1 Symbolic Links :::::::::::::::::::::::::::::::::::::::::::: 8 2.3.2 Hard Links ::::::::::::::::::::::::::::::::::::::::::::::: 10 2.4 Time
    [Show full text]