61
Booting and Installing the Operating System Selecting and preparing installation media The boot process Preparing the disks. Basic disk partitioning Sharing disks among O.S.s Boot loaders Booting and Installing the Operating System C.A.I.T. 2012 Departamento de Computaci´ on Facultad de Inform´ atica Universidad de Coru˜ na Antonio Y´ nez Izquierdo (Antonio Y´ nez Izquierdo) Booting and Installing the Operating System 1 / 61

Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

Booting and Installing the Operating SystemC.A.I.T. 2012

Departamento de ComputacionFacultad de InformaticaUniversidad de Coruna

Antonio Yanez Izquierdo

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 1 / 61

Page 2: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

Contents I

1 Selecting and preparing installation mediainstalling an O.S.installation mediapreparing the media

2 The boot processbootingbooting steps

3 Preparing the disks. Basic disk partitioningdiskspartitions

4 Sharing disks among O.S.ssharing disks among O.S.s

5 Boot loaderslilogrub

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 2 / 61

Page 3: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

installing anO.S.

installationmedia

preparing themedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

Selecting and preparing installation media

installing an O.S.installation mediapreparing the media

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 3 / 61

Page 4: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

installing anO.S.

installationmedia

preparing themedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

Installing an O.S.

the most common use of O.S.s is having them “installed”onto computers, and be run from the computer’s storagedevices

there are also some “live” O.S.s that don’t requireinstallation but usually have limitations concerning whatsoftware can be added and what users can do

installing is the process by which we put the O.S. files inone (or more) of the storage units of the system, thusallowing the system to execute the OS directly

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 4 / 61

Page 5: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

installing anO.S.

installationmedia

preparing themedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

Installing an O.S.

the process of installing an O.S. usually includes thefollowing steps

a booting the system from some installation mediab writing the O.S. files to some storage mediac doing some configuration to allow the O.S. to be booted

from the storage mediad rebooting the system

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 5 / 61

Page 6: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

installing anO.S.

installationmedia

preparing themedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

Installing an O.S.

a to boot the system from some installation media we,obviously, need the installation media

we can get the media already preparedwe have to prepare them ourselves

b writing the O,S. files to some storage media usuallyrequires partitioning the drive

c allowing the O.S. to be booted from the storage mediarequires installing a boot loader

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 6 / 61

Page 7: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

installing anO.S.

installationmedia

preparing themedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

Installation media

the installation media we use depends on the devices thesystem is capable of booting from

nowadays floppy disks and tapes are seldom used, apartfrom disks, the most como devices used for booting are

CD/DVD devicesusb devicesNetwork Interface Cards

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 7 / 61

Page 8: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

installing anO.S.

installationmedia

preparing themedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

Booting from the network

modern systems are capable of booting from the network(usually via the Netboot or PXE protocol)

booting from the network requires the existence andconfiguration of a boot server, that provides both thenetwork configuration and the data necessary to boot

one of the most usual ways of installing O.S.s is what it’scalled a network installation, which consists of

booting from a CD/DVD or usb devicedoing some basic network configurationretrieve the O.S. files from the network, usually throughthe http or ftp protocols

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 8 / 61

Page 9: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

installing anO.S.

installationmedia

preparing themedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

Preparing the media

commercial operating systems usally provide theinstallation media

non commercial operating systmes usually provideinstallation images to be downloaded from the network

full sized images: this images may contain all the filesnecessary to perform the complete installationsmaller images to perform a network installation

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 9 / 61

Page 10: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

installing anO.S.

installationmedia

preparing themedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

Installation images

the most common images nowadays are

ISO images (to be burnt directly on CD/DVD)special images to be copied to an usb stick

if we are using some virtualization software we can installdirectly from the ISO image

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 10 / 61

Page 11: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

installing anO.S.

installationmedia

preparing themedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

ISO images

ISO images are to be burn directly to the CD/DVD media

they contain an image of the filesystem, they are not afile to be copied into a CD/DVD file systemmost CD/DVD burning software has an option burn imageor something similar

booting CD/DVD media can be created with any burningsoftware (cdrecord, k3b, nero ...)

the images contain the booting code in them

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 11 / 61

Page 12: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

installing anO.S.

installationmedia

preparing themedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

usb images

although is less common, sometimes usb images aresupplied

in order to provide the usb with the adecuate boot code:usb images must be copied directly to the usb device

using the dd commandusing the cat or cp command directly to the device file

sometimes we are given a boot block to be copied to theusb device using dd and a file (or set of files) to be copiedto the usb file system

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 12 / 61

Page 13: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

installing anO.S.

installationmedia

preparing themedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

usb images from iso files

in the case we are given only the iso images but we needto boot from an usb device

a some iso files con be copied directly to the usb deviceb install a boot loader onto the usb and copy the iso image

to itc use one of the utilities that does b) in an automated way,

for example unetbootin

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 13 / 61

Page 14: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

booting

booting steps

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

The boot process

bootingbooting steps

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 14 / 61

Page 15: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

booting

booting steps

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

booting

booting is the process by which the O.S. is loaded and thesystem is ready to be used by users

as the O.S. provides the services necessary for the systemto be usable

those services would be necessary to load the O.S.the O.S. must be loaded without those services in what wecall the bootstrapping processusually a loader of the O.S. is loaded and executed and itis this loader thar loads the O.S.

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 15 / 61

Page 16: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

booting

booting steps

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

automatic booting

the booting process is very hardware dependent

we can distinguish between two ways of booting

automaticmanual

automatic booting is the way the systems boots most ofthe times.

it does not requiere human interventionthe sistem boots by it’s own and an multiuserenvironmment is available after booting

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 16 / 61

Page 17: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

booting

booting steps

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

manual booting

in manual booting the system boots to single user mode:only the root can login

single user mode is also called maintenance modeusually the system boots to single user mode when itencounters some problem during boot, although it can alsobe told to boot this waySystem V distinguish several multi-user modes, BSD onlyhas single user mode and one multi-user mode

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 17 / 61

Page 18: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

booting

booting steps

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

booting steps

although it is very dependent on the hardware, the bootingprocess can be thought of consisting of the following steps

1 loading and executing the motherboard firmware (BIOS)boot program

2 loading and executing the boot loader3 loading and executing the unix kernel4 running the initialization scripts and starting the system

services

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 18 / 61

Page 19: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

booting

booting steps

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

first booting step

1 loading and executing the motherboard firmware (BIOS)boot program

by construction, when the system is powered on (or whena reset is done) the motherboard executes the code atcertain memory addressesthis code contains some initialization routines andsometimes access to a system configuration menua device is defined as the first boot device (CD/DVD, disk,tape, usb, floppy . . . ). An attempt is made to boot fromthat device, if unsuccessful, the defined as second bootdevice is tried and so on

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 19 / 61

Page 20: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

booting

booting steps

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

second booting step

2 loading and executing the boot loader

code from the booting device (typically the first block) isloaded and executedat this stage is where we usually find the boot loader

it can be as simple as reading a table, loading a blockfrom disk and transfering the control to it (in this case toanother loader)it can be more sophisticated (understanding filesystems,reading configuration files and loading a kernel in memory)

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 20 / 61

Page 21: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

booting

booting steps

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

second booting step (cont)

it is at this step that if we are in a multiboot environment,we are presented the choice of booting several O.S.sthis step either loads an Operating System kernel oranother boot loader.typically the root file system of the system is specified atthe boot loader

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 21 / 61

Page 22: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

booting

booting steps

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

third booting step

3 loading and executing the unix kernelthe kernel is loaded in memory and trasfered control

in linux the kernel resides in the file /boot/vmlinuz....

in solaris 10 the kernel resides in the fileplatform/i86pc/multiboot

in openBSD the kernel resides in the file /bsd

it creates its data structures, probes for devices andperforms initialization routinescreates some special system processes (sched, paged....)and init, the first “user process“ in the system

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 22 / 61

Page 23: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

booting

booting steps

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

fourth booting step

4 running the initialization scripts and starting the systemservices

init reads its configuration file (/etc/inittab)if there is some kind of error or the system is configured toboot into single user mode, a root shell is created withonly the root filesystem mountedotherwise the scripts initiating the system services arestarted (/etc/rc* on BSD systems or the scripts indirectories /etc/rc?.d on System V systems)

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 23 / 61

Page 24: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

Preparing the disks. Basic disk partitioning

diskspartitions

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 24 / 61

Page 25: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

disks

disks still are the method of choice to run the OperatingSystem from

nowadays all disk use Logical Block Addressing instead theold CHS interface although they still report a (fake) CHSgeometry

the disks also report a sector size of 512 bytes althoughinternally a 4096 byte sector might be used

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 25 / 61

Page 26: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

disks

disk are used to create filesystems on them

several filesystems can exist on a disk device in what weusually call partitions

several partitions can be combined into one filesystem viaLogical Volume Management

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 26 / 61

Page 27: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

partitions

a disk is usually divided into several units called partitions

BSD systems sometimes refer to partitions as slices

filesystems are created in partitions, usually one filesystemin each partition although several partitions can becombined into one filesystem via Volume ManagementSoftware

we even can install different O.S. in different partitions

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 27 / 61

Page 28: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

partition tables

each disk has a table, usually located at the first block,that defines the partitions on that disk

there are many standard formats to that table

MBR partitionsBSD disklabelGUID Partition Table (GPT)others. . . (Amiga Rigid Disk Block, RDB), (Apple PartitionMap, APM)

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 28 / 61

Page 29: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

MBR partitions

the partition is located in the first sector of the disk

widespread in PC architecture

used mainly in Windows a linux systems

defines 4 partitions in a disk called primary partitions

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 29 / 61

Page 30: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

MBR table format

offset size Description

0x000 446 reserved

0x1be 16 partition entry 1

0x1ce 16 partition entry 2

0x1de 16 partition entry 3

0x1ee 16 partition entry 4

0x1fe 2 0xaa55 (little endian)

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 30 / 61

Page 31: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

MBR partitions

one of the partitions can be defined as extended partition

this partition can be subdivided into what is called logicalpartitions

the first sector of that partition, called EBR (ExtendedBoot Record), has the same format as the MBR tableexcept for

only the first two entries are usedif more partitions are needed one of these two is defined asextended partition, thus allowing for and ”infinite” numberof partitions

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 31 / 61

Page 32: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

EBR format

offset size Description

0x000 446 reserved

0x1be 16 partition entry 1

0x1ce 16 partition entry 2

0x1de 16 zeroes

0x1ee 16 zeroes

0x1fe 2 0xaa55 (little endian)

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 32 / 61

Page 33: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

format of a partion entry

offset size Description

0x00 1 byte 80h for active partition, otherwise 00h

0x01 1 head of partition start

0x02 2 cylinder/sector (10/6bits) of partition start

0x04 1 code of partition type

0x05 3 CHS of partition end

0x08 4 LBA partition start

0x0C 4 partition size

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 33 / 61

Page 34: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

creating MBR partitions

partitions on disks using the MPR partition scheme arelimited to 2 Terabytes

MBR partitions can be created, and manipulated with

fdisk utility on BSD systemsfdisk or cfdisk utility on linux systemsfdisk on solaris/intel systems

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 34 / 61

Page 35: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

BSD disklabel

BSD systems and derivatives use disklabels to partitionthe disk

a disklabel can contain up to 8 partitions, designed withletters (a through h)

openBSD disklabel can hold up to 16 partitions, designedwith letters (a through p)

partition a is the root filesystem (also contains the bootcode)

partition b is the swap space

partition c represents the whole disk

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 35 / 61

Page 36: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

BSD disklabel

when installing a BSD O.S. on a system which has MBRpartitions

the MBR partition is labeled with code a6 (openBSD), a5(FreeBSD), a9 (netBSD) . . .a disklabel is created in the first sector of the MBRpartitionthe MBR partitions are often refered as slicespartition c of the disklabel represents the whole disk, notjust the *BSD MBR partition

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 36 / 61

Page 37: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

BSD disklabel

for a partition to be mounted it has to be defined in thedisklabel, even if its an MBR partition

disklabel partitions are restricted to 2 Terbytes (is Solaristo 1 Terabyte)

openBSD disklabels do not have the 2 Tb limitation

Solaris system uses a variation of the BSD disklabel calledVTOC (Volume Table Of Contents).

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 37 / 61

Page 38: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

BSD disklabel

to access the disklabel, the following commands can beused

disklabel on openBSD and netBSDbsdlabel on freeBSDformat on Solaris

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 38 / 61

Page 39: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

GUID Partition Table

defined as part of the EFI (Extensible Firmware Interface)standard

sometimes refered to as the EFI label, or EFI partitiontable

the MBR uses 32 bits for Logical Block Adressing, henceits limitations in size

GPT uses 64 bits for LBA, this limits the maximunpartition size to 264 − 1 sectors

most modern O.S. support GBT although some still havesome restrictions to boot from such partitions

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 39 / 61

Page 40: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

GUID Partition Table

two copies of the GPT exist, the primary GPT at thebeginning of the disk, and the secondary GPT at the end

GBT uses logical block addessing

the first sector of the disk has a MBR partition tablecalled protective MBR that allows the disk to be bootedfrom a system with traditional BIOS

following sector is the header of the primary GPT

the GPT partition table consists of 128 bytes entries. Theminimun size of the table is 16Kbytes

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 40 / 61

Page 41: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

format of a GPT partion entry

offset size Description

0x00 16 bytes GUID partition type

0x10 16 bytes Partition GUID

0x20 8 bytes Partition start LBA

0x28 8 bytes Partition end LBA

0x30 8 bytes Attribute flags

0x38 72 bytes Partition name

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 41 / 61

Page 42: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

Comparision of MBR and GPT

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 42 / 61

Page 43: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

disks

partitions

Sharing disksamong O.S.s

Boot loaders

GPT Partition Table

to access the GPT the following commands can be used

parted and gdisk on linuxgpart on freeBSDgpt on netBSDformat -e on Solaris

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 43 / 61

Page 44: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

sharing disksamong O.S.s

Boot loaders

Sharing disks among O.S.s

sharing disks among O.S.s

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 44 / 61

Page 45: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

sharing disksamong O.S.s

Boot loaders

sharing disks between O.S.s

with the term sharing disks between O.S.s we can refer totwo diferrent things

a have several O.S.s installed on the same diskb have some disk space that can be accesed from different

O.S.s

We’ll deal now with a), as item b) usually impliesrecognizing the partition table format, having support forthe filesystem in question and mounting it

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 45 / 61

Page 46: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

sharing disksamong O.S.s

Boot loaders

sharing disks between O.S.s

two issues must be considered when having several O.S.on the same disk

allocating space to each one of thembeing able to boot any of them

allocating space to different O.S.s on the same disk isdone through partitions

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 46 / 61

Page 47: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

sharing disksamong O.S.s

Boot loaders

sharing disks between O.S.s

linux and windows system can share disks via the MBR orGPT partitions

BSD systems require a disklabel, in order to share diskwith other systems (BSD or not BSD) a disklabel must becreated into one of the MBR partitions for each BSD-typesystems

some BSD systems lack support for GPT

certain O.S.s cannot boot from GPT partitions

sometimes an EFI BIOS is needed to boot from GPTpartitions

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 47 / 61

Page 48: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

sharing disksamong O.S.s

Boot loaders

booting different O.S.s on the same disk

as seen in a previous section, an O.S. needs a boot loaderto be booted

installing the boot loader is part of the installation processof the O.S.

some boot loaders are only capable of booting one O.S.

other boot loaders are capable of booting different O.S.s

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 48 / 61

Page 49: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

sharing disksamong O.S.s

Boot loaders

booting different O.S.s on the same disk

we have several solutions to booting different O.S.

install boot loaders for each O.S. and change the activepartition to boot one of theminstall a boot loader capable of booting all of the O.S. andget that boot loader loaded when the system startsinstall boot loaders for each O.S. and have a boot loadercapable of loading the other O.S. or chainload their bootloaders loaded at boot time

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 49 / 61

Page 50: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

lilo

grub

Boot loaders

lilogrub

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 50 / 61

Page 51: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

lilo

grub

boot loaders

BSD systems have their own specific boot loaders,

freeBSD can change the Master Boot Record for a verysimple program that gives the option to chainload to other(primary) partitions

linux has lilo, silo (for Sparc), and grub which isbecoming the standard today

Solaris had its own boot loader, but since version 10, ituses grub as its boot loader

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 51 / 61

Page 52: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

lilo

grub

boot loaders that can load several O.S.s

the silo bootloader, which is specific for the Sparcarchitecture, can load Solaris and other O.S.s

lilo can chainload to other boot loaders

grub can chainload to other loaders, and load directlylinux, FreeBSD, netBSD, openBSD, Solaris

to load Solaris a specially modified version of grub is used

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 52 / 61

Page 53: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

lilo

grub

lilo

it was the boot loader of choice in linux

can chainload other O.S. bootloaders

it is configured through the file /etc/lilo.conf

it can’t read any configuration file when booting so aftermaking any change to its configuration file, /sbin/lilomust be run

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 53 / 61

Page 54: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

lilo

grub

example lilo configuration

example of lilo configuration file chainloading another O.S.

...

image=/boot/vmlinuz-2.6.38-2-amd64

label="linux 2.6.38"

initrd=/boot/initrd.img-2.6.38-2-amd64

read-only

other=/dev/sda3

label="openBSD"

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 54 / 61

Page 55: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

lilo

grub

grub

it is the boot loader of choice in present distributions oflinux

it can chainload other boot loaders or load directly a greatvariety of O.S.

a modified version capable of booting solaris is suppliedwith that O.S.

two versions available

older version of grub: often refered to as grub legacynew version of grub: grub 2

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 55 / 61

Page 56: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

lilo

grub

grub

grub reads it’s configuration file when it loads andunderstands several filesystem structures so it can loadkernels directly

it can be installed either in the MBR or in the boot blockof the partition

the configuration file is

/boot/grub/menu.lst for grub legacy/boot/grub/grub.cfg for grub2

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 56 / 61

Page 57: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

lilo

grub

grub legacy

configuration resides in the file /boot/grub/menu.lst

an example of configuration file booting linux and freeBSD

title linux with kwenel 2.4.7-10

root (hd0,4)

kernel /boot/vmlinuz-2.4.7-10 ro root=/dev/hda5

initrd /boot/initrd-2.4.7-10.img

title FreeBSD

root (hd0,2,a)

kernel /boot/loader

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 57 / 61

Page 58: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

lilo

grub

grub legacy

an example of configuration file booting opensolaris andchainloading linux and openBSD

title Opensolaris-snv130

findroot (pool_rpool,0,a)

bootfs rpool/ROOT/Opensolaris-snv130

splashimage /boot/solaris.xpm

foreground d25f00

background 115d93

kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS,console=graphics

module$ /platform/i86pc/$ISADIR/boot_archive

#============ End of LIBBE entry =============

title OpenBSD

rootnoverify (hd0,2)

chainloader +1

title linux 64 bits

rootnoverify (hd0,5)

chainloader +1

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 58 / 61

Page 59: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

lilo

grub

grub2

configuration resides in the file /boot/grub/grub.cfg

this file should not be modified directly as it generatedautomatically with the command update-grub2

manual configuration of grub2 should be done in files inthe /etc/grub.d directory and then run update-grub2

the contents of the files 40 custom and 41 custom getcopied into /boot/grub/grub.cfg

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 59 / 61

Page 60: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

lilo

grub

grub2

examples of the menuentries to load freeBSD and netBSD

menuentry "FreeBSD" {

insmod ufs2

set root=’(/dev/ad4,msdos1)’

search --no-floppy --fs-uuid --set 4c0029f407b3cd1d

kfreebsd /boot/kernel/kernel

kfreebsd_loadenv /boot/device.hints

kfreebsd_module /boot/splash.bmp type=splash_image_data

set kFreeBSD.vfs.root.mountfrom=ufs:ad4s1a

}

menuentry "NetBSD on sda1" {

insmod ufs2

set root=(hd0,msdos1)

knetbsd /netbsd --root=wd0a

}

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 60 / 61

Page 61: Booting and Installing the Operating Systemafyanez/Docencia/DOCS2013/AOS-2-Installing.pdf · Operating System Selecting and preparing installation media The boot process Preparing

Booting andInstalling the

OperatingSystem

Selecting andpreparinginstallationmedia

The bootprocess

Preparing thedisks. Basicdiskpartitioning

Sharing disksamong O.S.s

Boot loaders

lilo

grub

grub2

examples of the 40 custom file to chainload Solaris andopenBSD

#!/bin/sh

exec tail -n +3 $0

# This file provides an easy way to add custom menu entries. Simply type the

# menu entries you want to add after this comment. Be careful not to change

# the ’exec tail’ line above.

menuentry "Solaris grub" {

set root=(hd0,msdos2)

parttool (hd0,msdos2) boot+

chainloader +1

}

menuentry "openBSD" {

set root=(hd0,msdos3)

chainloader +1

}

(Antonio Yanez Izquierdo) Booting and Installing the Operating System 61 / 61