Chapter Four
Host Management
1
Computer startup and shutdown
• The two most fundamental operations which one can perform
on a host are to start it up and to shut it down.
• every multitasking operating system provides a procedure for
shutting down safely.
• A safe shutdown avoids damage to disks by mechanical
interruption, but it also synchronizes hardware and memory
caches, making sure that no operation is left incomplete
2
Booting Unix
• Unix systems can boot in several different modes or run levels.
• The most common modes are called multi-user mode and
single-user mode.
• In single-user mode no external logins are permitted.
– The purpose is to allow the system administrator access to
the system without fear of interference from other users.
• The Unix boot procedure is controlled entirely by the init
program;
– init reads a configuration file called /etc/inittab.
• The idea behind inittab is to make Unix installable in packages
3
Cont’d
• Boot:
– To boot, we must normally specify the name of a kernel file, normally
linux.
– The correct run-level should be determined from the file /etc/inittab
• Shutting down Unix
– Anyone can start a Unix-like system, but we have to be an administrator
or superuser‟ to shut one down correctly.
– The correct way to shut down a Unix system is to run one of the
following programs
• halt: Stops the system immediately and without warning.
• reboot: As halt, but the system reboots in the default manner
immediately.
• shutdown: This program is the recommended way of shutting down
the system.
4
Cont’d
▪ To reboot
▪ $ shutdown -r now
▪ $ reboot
▪ $ telinit 6
▪ To halt
▪ $ shutdown -h now
▪ $ halt
▪ $ telinit 0
▪ $ poweroff
5
Cont’d
Example:
• shutdown -h +4 "System halting in four minutes, please log out"
• shutdown -r +4 "System rebooting in four minutes"
– The -h option implies that the system will halt and not reboot
automatically.
– The -r option implies that the system will reboot automatically.
The times are specified in minutes.
6
Booting and shutting down Windows
• To boot the system, it is simply a matter of switching on the
power.
• To shut it down, one chooses shutdown from the Start Menu.
• The Windows boot procedure on a PC begins with the BIOS, or
PC hardware.
– This performs a memory check and looks for a boot-able disk.
• A boot-able disk is one which contains a master boot record
(MBR).
– Normally the BIOS is configured to check the floppy drive
A: first and then the hard-disk C: for a boot block
7
Cont’d
• The boot block is located in the first sector of the boot-able
drive.
– It identifies which partition to be used to continue with the
boot procedure.
– On each primary partition of a boot-able disk, there is a
boot program which knows‟ how to load the operating
system it finds there
• Windows has a menu-driven boot manager program which
makes it possible for several OSs to coexist on different
partitions
8
Cont’d
BIOS(Basic Input / Output System)
✓ Contains information about the machine’s configuration.
✓ Eg. IDE controller, NIC
✓ PC knows which device to boot from via BIOS
✓ PC tries to run code from the MBR, ie. 1st 512 bytes, of the disk
✓ MBR tells the PC to load the boot loader from certain disk partition
✓ The boot loader loads the kernel
9
Installation of the operating system
▪ The installation process is one of the most destructive things we can do to a
computer.
▪ Everything on the disk will disappear during the installation process.
• In order to answer the questions about installing a new host, information
must be collected and some choices made:
1. We must decide a name for each machine.
2. We need an unused Internet address for each.
3. We must decide how much virtual memory (swap) space to allocate.
4. We need to know the local timezone.
10
Linux installation
• Installing GNU/Linux is simply a case of inserting a CD-ROM and booting
from it, then following the instructions.
• GNU/Linux installations assume that you are setting up a stand-alone PC which
is yours to own and do with as you please.
• Although GNU/Linux is a multiuser system, it is treated as a single-user system.
Little thought is given to the effect of installing services like news servers and
web servers.
11
Windows Installation
• The installation of Windows is similar to both of the above. One
inserts a CDROM and boots.
– On rebooting, we are asked whether we wish to install
Windows anew, or repair an existing installation.
– Windows reboots several times during the installation
procedure, though this has improved somewhat in recent
versions.
– here are several installation models for Windows
workstations
– . Having chosen one of these, one is asked to enter a license
key for the operating system
– After various other questions, the host reboots and we can
log in as Administrator.
12
Software installation
• There are two kinds of software installation:
– the installation of software from binaries and
– the installation of software from source.
• Commercial software is usually installed from a CD by running
an installation program and following the instructions carefully;
• Free software and open source software usually come in source
form and must therefore be compiled.
• Compiled software can be collected in a special area, with a bin
directory and a lib directory .
– The directory chosen for installed software is called /usr/local.
– One then makes subdirectories /usr/local/bin and /usr/local/lib
13
Linux Logging Basics
• Operating system logs provide a wealth of diagnostic
information about your computer, and Linux is no exception.
• Everything from kernel events to user actions are logged by
Linux,
• Linux has a special directory for storing logs called /var/log.
• This directory contains logs from
✓ the OS itself,
✓ services, and
✓ various applications running on the system
14
Maintaining Log Files
• Log files are generated by system processes to record
activities for subsequent analysis.
– They can be useful tools for troubleshooting system
problems and also to check for inappropriate activity.
– Log files can be very useful resources for security
incident investigations.
• In LINUX, system logs are stored in /var/log.
• System messages are recorded /var/log/messages.
15
File System Repair
▪ fsck is a Unix utility for checking and repairing file
system inconsistencies
▪ Abnormal shutdown due to hardware failure ,
power failure or switching off the system without
proper shutdown
▪ Modes of operation: fsck operates in two modes
✓ interactive and
✓ non interactive
16
Cont’d
▪ Interactive : the fsck examines the file system and stops at
each error
▪ it finds in the file system and gives the problem description
and ask for user response usually whether to correct the
problem or continue without making any change to the file
system.
▪ Non-interactive: fsck tries to repair all the problems
▪ it finds in a file system without stopping for user response
useful in case of a large number of inconsistencies in a file
system
17
Backup
▪ Backup is an additional copy of data that can be used
for restore and recovery purposes
• Backups are a standard sysadmin service
▪ This Backup copy can be created by:
▪ Simply coping data (there can be one or more
copies)
▪ Mirroring data (the copy is always updated with
whatever is written to the primary copy)
18
Cont’d
• Basics of backup are:
✓ Physical location: A backup should be kept at a different physical
location than the original.
✓ How often? Depends on How often does the data change significantly
✓ Relevant and irrelevant files: backup only the files which cannot be
recovered from the CD-ROM, without having to backup everything
✓ Backup policy: Some sites might have rules for defining what is
regarded as valid information
19
Cont’d
Types of backup
▪ Full: this transfers a copy of all the companies data
within the scope of the media , regardless of if the data
was changed since the last backup.
▪ Differential: this backs up the files that since the last
backup.
▪ Incremental: only files that have changed since the
backup will be backed up.
20
Windows Backup Commands
▪ Windows provides a utility to perform file system
backups.
▪ The Windows backup-and-restore utility
(backup.exe) provides for backups, and restores.
▪ In backup mode, the operator is given the ability to
select which disk and/or files to back up
21
Cont’d
▪ The Windows backup utility also provides the interface to
restore function.
▪ In restore mode, the utility displays a catalog of the tape,
allowing the user to select which files/directories need to
be restored.
▪ The operator is also given the choice of where the file is
to be restored.
▪ the Sys admin at a commercial site may decide that the
Windows backup utility is not the first choice for backup
software at the site.
▪ Many third-party backup utilities are available for Windows
systems backup suite.
22
Recovery from loss
▪ When loss occurs, we have to recover files from the backups
▪ Reasons for Restores
✓ Accidental file deletion. A customer has accidentally erased
one or more files and needs to have them restored.
✓ Disk failure. A hard drive has failed, and all data needs to
be restored.
23
Kernel Customization
• The operating system kernel is that most important part of the system which
drives the hardware of the machine and shares it between multiple processes.
• If the kernel does not work well, the system as a whole will not work well.
• The main reason for making changes to the kernel is to fix bugs and to upgrade
system software
• Many operating system kernels are monolithic,
– statically compiled programs which are specially built for each host
24
Windows Kernel Initialization
• The window NT kernel and hw abstraction layer are
loaded into memory
• The initialization of kernel subsystem is done two phase
➢ The basic internal structure is created and each CPU
interrupt controller is initialized
➢ The memory manager initialized, create areas for file
system
25
Linux Kernel initialization
1. The kernel initialize hw as well as kernel data
structure
2. Kernel command line is saved
3. Hared-drive information is retrieved from
BIOS
4. The memory size is determined , through the
BIOS
5. The hardware is prepared to move to
protected mode
26
Cont’d
▪ Kernel initialization, a process called init is created
with PID 1
▪ init runs startup scripts (normal shell scripts) to
perform specific tasks, eg.
✓ Setting the hostname, time zone, etc
✓ Checking and mouting the disks
✓ Configuring network interfaces
✓ Starting up daemons and network services
27