System Administration – Part 2. Devices in UNIX are files: A device can be accessed with different file names All device files are stored in /dev or its.

Slides:



Advertisements
Similar presentations
Va-scanCopyright 2002, Marchany Unit 8 – Solaris File Systems Randy Marchany VA Tech Computing Center.
Advertisements

Chapter 12: File System Implementation
Linux+ Guide to Linux Certification, Second Edition
Chapter 9 Part III Linux File System Administration
File Management.
More on File Management
Basic Unix system administration
Linux can be generally divided into four major components: 1. KERNEL – OS, ultimate boss The kernel is the core program that runs programs and manages.
Linux Installation LINUX INSTALLATION. Download LINUX Linux Installation To install Red Hat, you will need to download the ISO images (CD Images) of the.
A Guide to Unix Using Linux Fourth Edition
Operating system services Program execution I/O operations File-system manipulation Communications Error detection Resource allocation Accounting Protection.
Allocation Methods - Contiguous
Chapter 10: File-System Interface
1 Chapter 11: File-System Interface  File Concept  Access Methods  Directory Structure  File System Mounting  File Sharing  Protection  Chapter.
File System Interface CSCI 444/544 Operating Systems Fall 2008.
Introduction to Unix (CA263) File System
2000 Copyrights, Danielle S. Lahmani UNIX Tools G , Fall 2000 Danielle S. Lahmani Lecture 12.
Exploring the UNIX File System and File Security
File Management Systems
CS 333 Introduction to Operating Systems Class 18 - File System Performance Jonathan Walpole Computer Science Portland State University.
Operating Systems File Systems (Select parts of Ch 6)
Guide To UNIX Using Linux Third Edition
File System Implementation
Operating Systems File Systems (Select parts of Ch 11-12)
Laksh mi.  fdisk is an interactive utility to manipulate disk partitions.  Use fdisk –l to review the disks and partitions on the system.  Use fdisk.
Backup and Recovery Part 1.
File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.
Guide To UNIX Using Linux Fourth Edition
Unix File System Internal Structures By C. Shing ITEC Dept Radford University.
Linux Installation and Administration – Lesson 5 Tutor: George Papamarkos Topic: Devices in Linux.
Manage Directories and Files in Linux
1 Chapter 12 File Management Systems. 2 Systems Architecture Chapter 12.
Guide to Linux Installation and Administration, 2e 1 Chapter 9 Preparing for Emergencies.
Chapter 6: Linux Filesystem Administration
Chapter Two Exploring the UNIX File System and File Security.
1 Interface Two most common types of interfaces –SCSI: Small Computer Systems Interface (servers and high-performance desktops) –IDE/ATA: Integrated Drive.
1 Objectives Manage and install new file systems.
File System Interface. File Concept Access Methods Directory Structure File-System Mounting File Sharing (skip)‏ File Protection.
Chapter 2 (Cont.) The Unix Way Essential System Administration, 3rd Edition.
Manage Directories and Files in Linux. 2 Objectives Understand the Filesystem Hierarchy Standard (FHS) Identify File Types in the Linux System Change.
Chapter Two Exploring the UNIX File System and File Security.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Implementation.
Linux+ Guide to Linux Certification Chapter Six Linux Filesystem Administration.
UNIX File System (UFS) Chapter Five.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop V Files and the File System Part B – File System.
Slide: 1 UNIX FILE SYSTEM By:Qing Yang ID: Operating System Research Topic December, 2000.
Agenda The Linux File System (chapter 4 in text)
Chapter 6 File Systems. Essential requirements 1. Store very large amount of information 2. Must survive the termination of processes persistent 3. Concurrent.
File system In computing, a file system is a method of storing and organizing computer files and the data they contain to make it easy to find and access.
Filesystem Management and Backups. 2 Section Overview Devices and Files Filesystem Management Network Filesystems Backups.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
1 The File System. 2 Linux File System Linux supports 15 file systems –ext, ext2, xia, minix, umsdos, msdos, vfat, proc, smb, ncp, iso9660, sysv, hpfs,
File System Department of Computer Science Southern Illinois University Edwardsville Spring, 2016 Dr. Hiroshi Fujinoki CS 314.
ORAFACT The Linux File System. ORAFACT Filesystem Support Support for dozens of filesystem types including: Minix, ext2, MS-DOS, UMSDOS, VFAT, NTFS, NFS,
Memory management. Linux Memory Management Total memory available for processes = real memory + paging space - 1MB. First megabyte of real memory is used.
Linux Filesystem Administration
tar: The tape archive program _______________________ Amber Jain IC-2K7-05 _______________________.
Chapter 8 Unix & Linux.
Chapter 8 Adding a Disk.
Jonathan Walpole Computer Science Portland State University
Filesystem Management and Backups
Chapter 11: File System Implementation
Chapter 12: File System Implementation
Chapter 6 File Systems CSNB113 SYSTEM ADMINISTRATION
Introduction to Computers
Exploring the UNIX File System and File Security
File Structure 2018, Spring Pusan National University Joon-Seok Kim
Lecture 43 Syed Mansoor Sarwar
Overview Continuation from Monday (File system implementation)
Presentation transcript:

System Administration – Part 2

Devices in UNIX are files: A device can be accessed with different file names All device files are stored in /dev or its sub-directories Device files can be grouped in to 2 main categories: b (block devices) include floppy, CD-ROM, disk drives, DVD All data is read & written in blocks an uses a buffer cache. Example file listing: brw-rw-rw- fd0 c (character devices) include terminals, printers and tape drives. Also known as raw devices. Example file listing: crw-rw-rw- tty1A Device file do not contain any data. Devices in UNIX

How the UNIX File System Is Organized on Disk Drives Each drive is organized in the form of a directory structure with own sub-root Each disk must have at least 1 file system on it UNIX usually resides on multiple file systems. Mounting combines them into one logical system Root File System: Contains bare-bones UNIX - /root, /bin, /etc, /dev, /lib UNIX often has a swap file system where the kernel temporarily moves processes out of memory while it is waiting, e.g., I/O transfers, to swap in once process is ready to run again.

Secondary Disk drives must be mounted to be known to the kernel: When a new file system is created, root does not know of it. mount attaches all secondary file systems to the root file system.  Enables root to be main file system with the root directory the directory of a unified file system. Example: mount –F ufs /dev/dsk/ct08d0s1 /oracle  mount command by it self lists all mounted drives.  A mount point is the location in the operating system's directory structure where a mounted file system appears by the name provided, i.e., a child directory of root. Example: /oracle is the device’s mount-point in the above Mounting Disk Drives in UNIX

Unmounting Disk Drives in UNIX The umount (note spelling!) command disassociates and detaches a secondary file system. Example (system-dependent, like mount ): umount /oracle # linux umount /dev/hda3 /oracle # linux umount /dev/dsk/ct08d0s1 # solaris o If a mounted file system is being used by a user, i.e., the user has cd ’ to /oracle, the umount command will fail. # umount: /oracle busy o To use umount, the user must be in a directory closer to root than the file system being detached.

What’s in a UNIX File System? Boot block: Referred to as Master Boot Record (MBR). Contains small boot program and the partition table. Superblock: Contains global info about the file sytem, includes a list of free inodes and data blocks. inode blocks: Contains the inode value for each file of the file system. When file is created, its inode entry is allocated here. Contains array of disk block addresses. Data blocks: Contains all user created data and programs. Although disk blocks are numbered consecutively, the file’s data may be arranged in non-contiguous blocks on the drive. Note: Blocks are usually 512 bytes (or 1024 bytes in Linux).

When Good File Systems Go Bad Every 30 seconds the update daemon writes copies of the superblock to disk using sync. But what happens if power is lost before a sync is performed? The file system can lose its integrity in ways like:  two inodes can claim the same disk block  a used block is marked free  a free block is not listed in the superblock There is a periodic need to check (and sometimes repair) a file system that may have gone bad.

Checking the File System fsck – File System Consistency Check Used if file system fails to mount. Checks and repairs damaged file system (dirty, not clean). Damage often occurs from abnormal shutdown due to hardware failure, power failure or switching off without proper shutdown. If cannot be repaired, then reinstallation of system may be required. Example: # fsck /dev/da0s1a ** phase 1 - Check Blocks and Sizes ** phase 2 - Check Pathnames ** phase 3 - Check Connectivity ** phase 4 - Check Reference Counts ** phase 5 - Check Free List # (checks out ok, otherwise answer questions to fix)

Monitoring Free Disk Space df - reports amount of free space for each file system (separately). $ df -k Filesystem 1024-blocks Free %Used Iused %Iused Mounted on /dev/hd % % / /dev/hd % % /usr /dev/hd9var % 518 4% /var /dev/hd % % /tmp /dev/hd % 421 1% /home /proc /proc /dev/hd10opt % 654 4% /opt

Monitoring Disk Space Used du - reports used disk space for each subordinate directory (separately). Example: directory usage listed in kilobytes: $ du -k * /junk /junk2 Example: directory usage in human-readable format: $ du -h * 149M./junk1 1.8G./junk2 1.3K./junk3 Example: report usage of all subdirectories and files including hidden files, sorted by filesize : $ du -k.[A-z]* * | sort -n

Backing Up Files Using tar tar – backup and restore files (tape archive, but other devices are OK too) Example: # cd /home # tar –cvf /dev/rdsk/f0q18dt./rick -c creates a new archive -v displays the progress of the backup (verbose mode) -f use the specified backup device The files being backed up are specified using a relative pathname so they can be restored in a different directory if needed.

Restoring Files Using tar Use the –t option to display the table of contents. Use –x to restore the files. Example: Create an incremental backup and then restore it. # tar –cvf /dev/rct0 `find /home/rick –newer.lt –print` # touch.lt # tar –tvf /dev/rct0 rw-r--r-- 203/ Jun 4 09: /grades rwxr-xr-x 203/ Jun 4 10: /test.sh rwxr-xr-x 203/ Jun 3 02: /a.out # tar –xvf /dev/rct0 x /home/rick/grades 169 bytes, 1 tape blocks x /home/rick/test.sh 4855 bytes, 10 tape blocks x /home/rick/a.out 7505 bytes, 15 tape blocks