Presentation is loading. Please wait.

Presentation is loading. Please wait.

Week Nine Agenda Administrative Issues Link of the Week This Week’s Expected Outcomes Review for midterm exam Moving around in UNIX Break-Out Problems.

Similar presentations


Presentation on theme: "Week Nine Agenda Administrative Issues Link of the Week This Week’s Expected Outcomes Review for midterm exam Moving around in UNIX Break-Out Problems."— Presentation transcript:

1

2

3 Week Nine Agenda Administrative Issues Link of the Week This Week’s Expected Outcomes Review for midterm exam Moving around in UNIX Break-Out Problems Upcoming Deadlines Hands-on Information Lab Assistance, Questions, and Answers

4 Announcements Sign up for your open source topic if you have not done so yet. Open source presentations July 26 (week 14) and August 2 (week 15).

5 Link of the week http://en.wikipedia.org/wiki/Firmware This Web site contains information on: - The evolution of firmware Uses of firmware: - Cell phones (Nexus Smart phone) - Drones - Map navigator - Laptops Firmware hacking is also another avenue used to gain control of systems.

6 Link of the week http://www.driver-fix.com/driverdetective.php?t=Firmware DiverDetective Download driver updates automatically and safely. This software utility will keep your system up-to-date by automatically retrieving the latest drivers from your hardware’s manufacturer.

7 Link of the week Firmware is a computer program that is embedded in the hardware device. Firmware can be stored in flash memory or as a binary image file that can be uploaded onto existing hardware by a user. In summary, firmware is a combination of hardware and software.

8 Link of the week Firmware applications include the following: - BIOS found in IBM-compatible PCs. - Open Firmware, used in computers marketed by Sun Microsystems and Apple Computers. - Computer peripherals - The iPod’s control menus. - Automobiles with on-board computers/sensors - Cisco IOS

9 This Week’s Expected Outcomes Upon successful completion of this module, the student will be more knowledgeable about the: File system integrity /proc directories ASCII and EBCDIC Character set CMOS BIOS Linux boot-up procedure (System 5) Red Hat Enterprise Release 6.0 boot-up procedure (Upstart)

10

11 UNIX Operating System Unix File Descriptors Unix has three file descriptors 0 – Input (stdin) 1 – Output (stdout) 2 – Error (stderr) cat /tmp/text_file.txt Hello Franklin University 2016

12 UNIX Operating System In the previous example, the cat command displayed the contents of the /tmp/text_file.txt file. The output of the cat command was displayed or re-directed to the terminal which is the output file descriptor by default. To prove it, lets try this:

13 UNIX Operating System Enter: tty /dev/pts/1 Enter: cat /tmp/text_file.txt > /dev/pts/1 Hello Franklin University 2016

14 UNIX Operating System The tty command provides the terminal information. As shown previously, when we specify the /dev/pts/1 as the output file, the contents are displayed on the terminal. The output of a command can be re-directed to a file or a terminal using the re-direction operator (>). Also, note the value of the output file descriptor "1" is not specified previously. It is so because the symbol ">" defaults to output.

15 UNIX Operating System cat /tmp/text_file.txt 1> /dev/pts/1 Hello Franklin University 2016 In this case, the output file descriptor is specified explicitly to redirect the output to a terminal. Note: There should be no space between 1 and > symbol. If a space is provided, the cat command treats 1 as a filename.

16 UNIX Operating System Similarly, to re-direct the output of a command to another file: cat /tmp/text_file.txt 1> /tmp/text_file2.txt cat /tmp/text_file2.txt Hello Franklin University 2016

17 UNIX Operating System /tmp>cat /tmp/text_file.txt > /tmp/text_file2.txt /tmp>cat /tmp/text_file2.txt Hello Franklin University 2016

18 UNIX Operating System Error File Descriptor Let us try to display the content of a non-existent file. /tmp>cat abc.txt cat: abc.txt: No such file or directory The above shown output is an error message of the cat command. Please note that the error message also got re-directed to the terminal which means the terminal is the default file descriptor for the errors.

19 UNIX Operating System Let us try to re-direct this error message to a file as in the case of output re- direction: >cat abc.txt > /tmp/abc_error.txt cat: abc.txt: No such file or directory >cat /tmp/abc_error.txt /export/home/dandrear/Winter_2016_Soluti ons>

20 UNIX Operating System What happened? The error message did not get re-directed to the file /tmp/abc_error.txt. As we said earlier, when we use ">", only the output gets re-directed to the terminal. /tmp>cat abc.txt 2> /dev/null In the above example, no error message is displayed on the terminal because the errors are now redirected to a null terminal.

21 UNIX Operating System One of the common instances where we don’t intend to use error messages is during the find command. When find searches in directories where the user does not have the read permissions, it outputs an error message. To redirect those errors: find. -mtime -10 2>/dev/null

22 UNIX Operating System Input File Descriptor Now, lets come to our last part: input descriptor. Like output and error, the terminal is the default input descriptor. /tmp>read x 20 /tmp>echo $x 20

23 UNIX Operating System The read command expects input from the user. When the read command is typed in, it prompts the user for an input. The input value is displayed on the terminal, which in turn is saved in the variable x in this case. The input can also come from a file.

24 UNIX Operating System /tmp>cat /tmp/text_file.txt 20 /tmp>read x < /tmp/text_file.txt /tmp>echo $x 20 The file text_file.txt contains the value 20. The read command is made to take the input value from file text_file.txt. Note the symbol "<" is used for input re-direction. The value in turn is saved in the variable x.

25 UNIX Operating System If you run fsck, the filesystem check and repair command, it might find data fragments that are not referenced anywhere in the filesystem. In particular, fsck might find data that looks like a complete file but doesn't have a name on the system — an inode with no corresponding file name. This data is still using up space, but it isn't accessible by any normal means.

26 UNIX Operating System If you tell fsck to repair the filesystem, it will turn these almost-deleted files back into files. The thing is, the file had a name and location once, but that information is no longer available. So fsck deposits the file in a specific directory, called lost+found.

27 UNIX Operating System Files that appear in lost+found are typically files that were already unlinked (i.e. their name had been erased) but still opened by some process (so the data wasn't erased yet) when the system halted suddenly (kernel panic or power failure). If that's all that happened, these files were slated for deletion anyway, you don't need to care about them.

28 UNIX Operating System Files can also appear in lost+found because the filesystem was in an inconsistent state due to a software or hardware bug. If that's the case, it's a way for you to find files that were lost but that the system repair managed to salvage. The files may or may not contain useful data, and even if they do they may be incomplete or out of date; it all depends how bad the filesystem damage was.

29 UNIX Operating System On many filesystems, the lost+found directory is a bit special because it pre-allocates a bit of space for fsck to deposit files there. (The space isn't for the file data, which fsck leaves in place; it's for the directory entries which fsck has to make up.) If you accidentally delete lost+found, don't re- create it with mkdir, use mklost+founf if available.

30 UNIX Operating System File System Integrity Checks File systems are usually mounted read- only. This makes it possible to check the file system while it is mounted; it is not a good idea to check a file system that is mounted read-write.

31 UNIX Operating System Fsck Phases If the superblock is corrupted the file system still can be repaired using alternate superblocks created while making a new file system. The first alternate superblock number is 32 and other superblock numbers can be found using the following command: newfs -N /dev/rdsk/c0t0d0s6

32 UNIX Operating System Fsck Phases Video on fsck utility. https://www.youtube.com/watch?v=nm9tjoOZF-4 https://www.youtube.com/watch?v=zk9dfLQ2sJU

33 UNIX Operating System /proc/filesystems The /proc/filesystems is a file used to detect file systems supported by the running kernel. If a file system is listed, you will be able to mount it. This text listing of the file system is compiled into the kernel. The “nodev” string in the first column means that file system does not require a block device to be mounted, it’s called a virtual file system.

34 UNIX Operating System /proc/filesystems It is a special file system in UNIX-like systems that presents information about processes and other system information in a hierarchical file like structure, providing a more convenient and standardized method for dynamically accessing process data held in the kernel than traditional tracing methods or direct access to kernel memory. Typically, it is mapped to a mount point named /proc at boot time.

35 UNIX Operating System /proc/filesystems The /proc/filesystems file provides a method of communication between kernel space and user space.

36 UNIX Operating System /proc/filesystems Is a file used to detect filesystems supported by running kernel. You can quickly run grep or the cat command to display the list of all supported file systems. Nodev indicates that the file system is not associated with a physical device such as /dev/sdb1. If you see ext3 or vfat, it means you will be able to mount ext3 and vfat based file systems.

37 UNIX Operating System /proc/filesystems The Linux implementation of /proc is a clone of Plan 9. Under Linux, /proc includes a directory for each running process (including kernel processes) at /proc/PID, containing information about that process. Plan 9 is an enhancement of the V8 Plan. Rather than have just one file containing all the information about a process, Plan 9 created a hierarchy of separate files to provide those functions, and made /proc a real part of the file system

38 UNIX Operating System /proc/filesystems /proc/PID/cmdline, which contains the command that originally started the process. /proc/PID/cwd, a symlink to the current working directory of the process. /proc/PID/environ, a file containing the names and contents of the environment variables that affect the process. /proc/PID/exe, a symlink to the original executable file, if it still exists (a process may continue running after its original executable has been deleted or replaced).

39 UNIX Operating System /proc/filesystems /proc/PID/fd, a directory containing a symbolic link for each open file descriptor /proc/PID/fdinfo, a directory containing files which describe the position and flags for each open file descriptor. /proc/PID/maps, a text file containing information about mapped files and blocks (like heap and stack).

40 UNIX Operating System /proc/filesystems /proc/PID/mem, a binary file representing the process's virtual memory, can only be accessed by a ptrace'ing process. /proc/PID/root, a symlink to the root path as seen by the process. For most processes this will be a link to / unless the process is running in a chroot jail. /proc/PID/status, a file containing basic information about a process including its run state and memory usage.

41 UNIX Operating System /proc/filesystems /proc/PID/task, is a directory containing hard links to many tasks that have been started by this (i.e.: the parent) process.

42 UNIX Operating System File Representation A file format is a particular way to encode information for storage in a computer file. Disk drives or computer storage are represented in bits. A computer must convert information to 0s and 1s and vice-versa. A computer file format can be represented as either a binary image or ASCII file. ASCII is used on most PCs and Macintoshes. EBCDIC (Extended Binary-Coded Decimal Interchange Code is an IBM code for representing characters as numbers. IBM uses EBCDIC widely on their large computers.

43 UNIX Operating System EBCDIC character set EBCDIC is an 8 bit character encoding used on IBM mainframes and AS/400s. Single byte EBCDIC takes up eight bits, which are divided in two pieces. The first four bits are called the zone and represent the category of the character, whereas the last four bits are called the digit and identify the specific character.

44 UNIX Operating System File Representation Binary image files represent 256 different binary codes.

45 UNIX Operating System Binary Oct Dec Hex Char 100 0001101 65 41 A 100 0010102 66 42 B 100 0011103 67 43 C 110 0001141 97 61 a 110 0010142 98 62 b 110 0011143 99 63 c

46 UNIX Operating System In the past, binary image files were used to represent more character codes than ASCII because eight bit bytes were used, whereas ASCII files used seven bits. Now Extended ASCII uses eight bit bytes and can represent 256 character Executable software, mostly word processing files and databases, spread sheets and multimedia files are binary. However, text and source program files as well as HTML and XML files are ASCII.

47 UNIX Operating System What does the CMOS do? The CMOS memory stores information your computer needs when it boots up, such as, disk drive, keyboard type, configuration details of the PCI Bus slots, and Video Interface information. If the power to the CMOS memory is lost, your computer will boot with the CMOS defaults. In most cases, this will prevent use of your disk drives until this information is supplied.

48 UNIX Operating System CMOS specifications The information stored in the CMOS memory is battery backed up. The CMOS memory is a 64 or 128 byte memory that is part of the system clock chipset chips. The CMOS memory is made from Complementary Metal Oxide Semiconductor (CMOS). This material can be backed up by battery, which requires a very low current to keep the data in the memory current when the power is turned off.

49 UNIX Operating System How is the CMOS information used? The CMOS information is required by your computers Basis Input/Output System (BIOS). The system BIOS is a 64K by 8 bit wide ROM mounted on the motherboard. If the BIOS ROM were accessed during normal operation the computer would be greatly reduced. Instead, the information is copied to some RAM where it can be accessed 32 or 64 bits at a time, thus increasing the system performance. The differences in access speed between RAM device and ROM’s is approximately 3 times faster.

50 UNIX Operating System How is the CMOS information used? Read-only memory or ROM is a form of data storage in computers and other electronic devices that can not be easily altered or reprogrammed. RAM is referred to as volatile memory and is lost when the power is turned off whereas ROM in non-volatile and the contents are retained even after the power is switched off.

51 UNIX Operating System How is the CMOS information used? Random Access Memory (RAM) is a form of data storage that can be accessed randomly at any time, in any order and from any physical location in contrast to other storage devices, such as hard drives, where the physical location of the data determines the time taken to retrieve it. RAM is measured in megabytes and the speed is measured in nanoseconds and RAM chips can read data faster than ROM.

52 UNIX Operating System

53 Role of system BIOS It is to test the system, initialize some I/O devices, recognize the hardware devices (basic power test), and load the operating system. Once, the operating system is loaded, the BIOS works with the operating system to enable access to the hardware devices. At this point, the BIOS provide basic input/output services to the operating system and applications.

54 UNIX Operating System

55

56

57 What is Unified Extensible Firmware Interface (UEFI)? UEFI is a specification defined between the operating system and the platform firmware. UEFI was developed to replace the Basic I/O System firmware interface system. The UEFI can support remote diagnostics and repair of computers, even with another operating system.

58 UNIX Operating System UEFI

59 UNIX Operating System UEFI

60 UNIX Operating System Initializing or Booting a System 1.CPU is pre-set to RESET mode 2.CPU pre-programmed to seek 0xfffffff0 address location 3.BIOS reads MBR (Track 0, Sector 1) 4.First part of MBR contains the boot partition table and executable code 5.Second part of the MBR is used to locate the boot loader. It resides on the “active” partition known as the Boot Sector. 6.Device drivers are loaded (initrd-2.4.20-8.img) 7.Kernel is invoked 8.Init process invoked

61 UNIX Operating System Linux Boot Procedure 1. The system startup stage depends on the hardware device that Linux is being booted on. Floppy disk, CD-ROM, a partition on a hard disk, a device on the network, or a USB flash memory stick. Linux is usually booted from a hard disk. 2. After the system locates the boot device, the first part of the boot loader is loaded into RAM and executed. Normally, the first part of the boot loader is less than 512 bytes and is responsible for loading the second part of the boot loader.

62 UNIX Operating System Linux Boot Procedure 3. The first 446 bytes are considered the primary boot loader, which contains both executable code and error message text. 4. The second sixty four bytes are the partition tables, which contains a record for each of the four partitions. 5. The last two bytes are the magic number which serves as a validation check of the Master Boot Record (MBR).

63 UNIX Operating System Linux Boot Procedure 6. When the second part of the boot loader is loaded into RAM and executed, a pop up screen displays Linux and the optional initial RAM being loaded into memory. 7. The second part of the boot loader is called the kernel loader. After the boot images are loaded, the second part of the boot loader passes control to the kernel image. At this point, the kernel is decompressed and initialized

64 UNIX Operating System Linux Boot Procedure 8. The second part of the boot loader checks the system hardware, lists attached hardware devices, mounts the root device, and loads the kernel modules.

65 UNIX Operating System What is the Master Boot Record (MBR) It is a small program that is a special type of boot sector that manages the boot process. The MBR is not located in a partition, but located at the beginning of partitioned computer mass storage devices, such as, fixed disks or removable devices.

66 UNIX Operating System What is the Master Boot Record (MBR) The organization of the partition table in the Master Boot Record sets the boundaries for the maximum addressable storage space of a disk to 2 TB (2 exp32 x 512 bytes)

67 UNIX Operating System Master Boot Record (MBR) When a data storage device has been partitioned with the MBR Partition Table scheme the master boot record contains the primary partition entries in its partition table. By convention, there are exactly four primary partition table entries in the MBR Partition Table scheme.

68 UNIX Operating System In Linux, and other Unix-like operating systems, the /boot directory holds files used in booting the operating system. vmlinuz is the Linux kernel. initrd.img is a temporary file system, used prior to loading the kernel. system.map is a symbol lookup table.

69 UNIX Operating System Boot Loaders The following /boot directory contains all the important files which are required for successful booting process: Demonstrate: /boot Red Hat Linux kernels Kernel configuration files for Red Hat Linux Demonstrate: /boot/grub The Linux Loader (LILO) is the combination of parts one and two boot loaders. Because of some disadvantages in the LILO loader, the GRand Unified Bootloader (GRUB) has become more widely used.

70 UNIX Operating System Boot loader The role of the boot loader is to place the operating system of the system in memory. In Linux, the most commonly used boot- loading tool is LILO, the Linux Loader. During the installation process, Linux will generate LILO values and ask you to verify them. At that point, you are given the opportunity to insert additional LILO options. Such options might be to include more partitions, and identify the operating system to be installed.

71 UNIX Operating System Boot loader First, what exactly is GRUB? GRUB is a boot loader, which means it passes control of the boot process from the Power-On Self Test (POST) to the kernel of your GNU/Linux distribution. GRUB works in a modular, layered fashion so that any unneeded modules are not loaded. Not only does this reduce execution time, but it saves valuable resources when running from removable media.

72 UNIX Operating System Boot loader GRUB optionally loads its configuration file at run /boot time, so you don’t have to type in commands manually each time. However, the command-line option is still available in case there is an error in your configuration file.

73 UNIX Operating System When a computer with Red Hat Enterprise Linux is turned on, the operating system is loaded into memory by a special program called a boot loader. A boot loader usually exists on the system's primary hard drive (or other media device) and has the sole responsibility of loading the Linux kernel with its required files or (in some cases) other operating systems into memory.

74 UNIX Operating System So why use GRUB when there are other options out there? The beauty of free software is that you have choices. Alternatives to GRUB include LILO, syslinux and isolinux. The benefit of GRUB is that it will work with many different types of boot devices, but you only need to learn one set of menu commands. In addition, GRUB can work on other forms of bootable storage, such as CD-R/W,

75 UNIX Operating System With the release of Red Hat Enterprise Linux (RHEL) 6, Red Hat will utilize the new Upstart boot service. This service will replace the System V init boot procedure that is based on run levels directories that contained scripts that all had to be started. Upstart is event driven, so it contains scripts that are activated on demand, which makes the boot process a lot faster.

76 UNIX Operating System In an attempt to simplify the new concept, Upstart still utilizes the services from the init process. The /sbin/init, which is the mother of all user services

77 UNIX Operating System Init Process Location: /sbin/init First process to execute in user space Executes: background Process ID: 1 (one) Parent Process ID: 0 (zero) Owner: root Highlight the relationship of the init process to all other executing processes.

78 UNIX Operating System Red Hat Enterprise Release 6.0 (Upstart) Handles initialization by starting the most fundamental services. /etc/init/rcS.conf Handles starting the individual runlevels /etc/init/rc.conf The following two areas specify how terminals are to be handled. /etc/init/tty.conf and /etc/init/serial.conf There were some additional configuration files included to the /etc/sysconfig/init file.

79 UNIX Operating System The /etc/inittab file is referenced only for determining the default run level of the system. All other previous tasks are handled by the new Upstart procedures. The following statement is the only one used in the /etc/inittab file by Red Hat Enterprise 6.0. id:3:initdefault

80 UNIX Operating System UNIX-like runlevels 0 - halt (Do NOT set initdefault to this) 1 - Single user mode 2 - Multiuser, without NFS (The same as 3, if you do not have networking) 3 - Full multiuser mode 4 - unused 5 - X11 6 - reboot (Do NOT set initdefault to this)

81 UNIX Operating System UNIX-like performance tools Sar is a command is performance monitoring tool. It can find out what Linux is doing all the time. It can generate report and email them to sys admin. Vmstat is a command that reports information about processes, memory, paging, block IO, traps, and cpu activity. free command displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel.

82 UNIX Operating System Linux performance tools Iostat is a command is used for monitoring system input/output device loading by observing the time the devices are active in relation to their average transfer rates i.e. it is useful to monitor disk throughput.

83 UNIX Operating System UNIX-like shutdown command The shutdown command is used to shutdown the system in a safe way. After bringing the system down, the shutdown command can halt or reboot the system according to the options that are specified. Example: shutdown –h now

84 UNIX Operating System /etc/rc.d init.d rc0.d rc2.d rc4.d rc6.d rc.sysinit rc rc1.d rc3.d rc5.d rc.local /etc rc rc4.d init.d rc0.drc5.d rc.sysinit rc1.d rc6.d rc2.d rc.d rc3.d rc.local

85 UNIX Operating System /etc/rc.d/rc0.d Explain the k and s script prefixes Explain the two digit numbering Knoppix software directory names are similar but slightly different.

86 UNIX Operating System Roles of the kernel 1. Responsive - users 2. Autonomous - daemons The kernel consists of a collection of low level procedures. These procedures are called system calls and they are the primary means for a program to interact with other parts of the system.

87 UNIX Operating System The kernel supports the following file systems: Demonstrate: /proc cat filesystems Demonstrate: Execute newuid.pl and process.sh scripts

88 UNIX Operating System Points of interest MBRs are not present on non-partitioned media like floppies, super floppies or other storage devices.

89 Moving Around in UNIX uptime w who –r who am i

90 Break-out problems What functionality does the mingetty or getty perform? Define the kernel responsive and autonomous functions? What system functionality does the /etc/fstab file provide? What functionality does the /etc/sysconfig directory provide? What functionality does the /etc/inittab file provide?

91 Hands on information Lab Assignment 8-1, Installation Exercise due June 26, 2016. Lab Assignment 9-1,Startup /Shutdown due July 3, 2016. Lab Assignment 10-1, 10-2 Account/LDAP/Process due July 10, 2016.

92 After class assistance Questions Comments Concerns I am available after this Franklin Live session to discuss any problems and/or concerns regarding the lab assignments

93 Lab Assistance available by phone and/or email


Download ppt "Week Nine Agenda Administrative Issues Link of the Week This Week’s Expected Outcomes Review for midterm exam Moving around in UNIX Break-Out Problems."

Similar presentations


Ads by Google