Skip to content

Proceso de arranque Linux

mayo 27, 2008

Proceso de arranque estándar

Tenemos una seccion de BIOS el cual es un pequeño codigo que apunta a diferentes secciones de arranque hasta llegar al disco duro.

El BIOS lee la secciòn MBR del disco duro, el cargador de arranque (GRUB) inicia el sistema operativo apropiado. El mbr Identifica una particion como activa

Inicia el Kernel, que arranca el proceso init (init). Init lee el archivo de configuración (/etc/inittab). (nivel de ejecucion)

inittab especifica el nivel de ejecuión.

Los scripts rc (run commands, scripts de arranque que corre la maquina) inician a los demonios.

Los scripts del nivel de ejecución inician los servicios principales de ese nivel.

Bootstraping -> igual en todas las computadoras, rutina que se corre para checar el hardware de la computadora.

*Cuando hacemos muchas updates se llena un directorio (/boot) y se va acabando, por default son aprox. 100Mb, se recomienda ir borrando determinado tiempo las versiones mas antiguas, pero hay que modificar el archivo menu.lst puesto que están referenciados.

[root@localhost ~]# df

Filesystem 1K-blocks Used Available Use% Mounted on

/dev/mapper/VolGroup00-LogVol00

34946880 3341576 29801428 11% /

/dev/sda2 101105 17524 78360 19% /boot

tmpfs 252236 0 252236 0% /dev/shm

Lo primero que hace el kernel es cargar el proceso init, el codigo de init esta en /sbin/init

[root@localhost ~]# file /sbin/init

/sbin/init: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped

[root@localhost ~]# ls -al /sbin/init

-rwxr-xr-x 1 root root 38620 Jan 6 2007 /sbin/init[root@localhost ~]# ls -al /sbin/init

-rwxr-xr-x 1 root root 38620 Jan 6 2007 /sbin/init

SOBRE EL INITTAB

[root@localhost ~]# cat /etc/inittab

#

# inittab This file describes how the INIT process should set up

# the system in a certain run-level.

#

# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>

# Modified for RHS Linux by Marc Ewing and Donnie Barnes

#

# Default runlevel. The runlevels used by RHS are:

# 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)

#

id:5:initdefault: -> MODO DE EJECUCION

# System initialization.

si::sysinit:/etc/rc.d/rc.sysinit

l0:0:wait:/etc/rc.d/rc 0

l1:1:wait:/etc/rc.d/rc 1

l2:2:wait:/etc/rc.d/rc 2

l3:3:wait:/etc/rc.d/rc 3

l4:4:wait:/etc/rc.d/rc 4

l5:5:wait:/etc/rc.d/rc 5

l6:6:wait:/etc/rc.d/rc 6

# Trap CTRL-ALT-DELETE

ca::ctrlaltdel:/sbin/shutdown -t3 -r now

# When our UPS tells us power has failed, assume we have a few minutes

# of power left. Schedule a shutdown for 2 minutes from now.

# This does, of course, assume you have powerd installed and your

# UPS connected and working correctly.

pf::powerfail:/sbin/shutdown -f -h +2 “Power Failure; System Shutting Down”

# If power was restored before the shutdown kicked in, cancel it.

pr:12345:powerokwait:/sbin/shutdown -c “Power Restored; Shutdown Cancelled”

# Run gettys in standard runlevels

1:2345:respawn:/sbin/mingetty tty1

2:2345:respawn:/sbin/mingetty tty2

3:2345:respawn:/sbin/mingetty tty3

4:2345:respawn:/sbin/mingetty tty4

5:2345:respawn:/sbin/mingetty tty5

6:2345:respawn:/sbin/mingetty tty6

# Run xdm in runlevel 5

Si la maquina es un servidor no tiene sentido estar en modo 5, si lo desactivamos tenemos varias alternativas paraa entrar a la maquina (webmin, vnc, putty, winscp).

Practica

cambiar la linea por id:3:initdefault

[root@dga-3 ~]# mkfs /dev/fd0

mke2fs 1.39 (29-May-2006)

Filesystem label=

OS type: Linux

Block size=1024 (log=0)

Fragment size=1024 (log=0)

184 inodes, 1440 blocks

72 blocks (5.00%) reserved for the super user

First data block=1

Maximum filesystem blocks=1572864

1 block group

8192 blocks per group, 8192 fragments per group

184 inodes per group

Writing inode tables: done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 37 mounts or

180 days, whichever comes first. Use tune2fs -c or -i to override.

[root@dga-3 ~]# e2fsdc /dev/fd0

bash: e2fsdc: command not found

[root@dga-3 ~]# e2fsck /dev/fd0

e2fsck 1.39 (29-May-2006)

Error determining size of the physical device: Device or resource busy

[root@dga-3 ~]# fdisk /dev/hda

Unable to open /dev/hda

[root@dga-3 ~]# fdisk /dev/sda

The number of cylinders for this disk is set to 9730.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): m

Command action

a toggle a bootable flag

b edit bsd disklabel

c toggle the dos compatibility flag

d delete a partition

l list known partition types

m print this menu

n add a new partition

o create a new empty DOS partition table

p print the partition table

q quit without saving changes

s create a new empty Sun disklabel

t change a partition’s system id

u change display/entry units

v verify the partition table

w write table to disk and exit

x extra functionality (experts only)

PARTICIONES

[root@dga-3 ~]# mformat a:

[root@dga-3 ~]# fdisk /dev/fd0

Command (m for help): p

Disk /dev/fd0: 1 MB, 1474560 bytes

2 heads, 18 sectors/track, 80 cylinders

Units = cylinders of 36 * 512 = 18432 bytes

Device Boot Start End Blocks Id System

/dev/fd0p1 * 1 80 1440 1 FAT12

Command (m for help): m

Command action

a toggle a bootable flag

b edit bsd disklabel

c toggle the dos compatibility flag

d delete a partition

l list known partition types

m print this menu

n add a new partition

o create a new empty DOS partition table

p print the partition table

q quit without saving changes

s create a new empty Sun disklabel

t change a partition’s system id

u change display/entry units

v verify the partition table

w write table to disk and exit

x extra functionality (experts only)

Command (m for help): l

0 Empty 1e Hidden W95 FAT1 80 Old Minix be Solaris boot

1 FAT12 24 NEC DOS 81 Minix / old Lin bf Solaris

2 XENIX root 39 Plan 9 82 Linux swap / So c1 DRDOS/sec (FAT-

3 XENIX usr 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT-

4 FAT16 <32M 40 Venix 80286 84 OS/2 hidden C: c6 DRDOS/sec (FAT-

5 Extended 41 PPC PReP Boot 85 Linux extended c7 Syrinx

6 FAT16 42 SFS 86 NTFS volume set da Non-FS data

7 HPFS/NTFS 4d QNX4.x 87 NTFS volume set db CP/M / CTOS / .

8 AIX 4e QNX4.x 2nd part 88 Linux plaintext de Dell Utility

9 AIX bootable 4f QNX4.x 3rd part 8e Linux LVM df BootIt

a OS/2 Boot Manag 50 OnTrack DM 93 Amoeba e1 DOS access

b W95 FAT32 51 OnTrack DM6 Aux 94 Amoeba BBT e3 DOS R/O

c W95 FAT32 (LBA) 52 CP/M 9f BSD/OS e4 SpeedStor

e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi eb BeOS fs

f W95 Ext’d (LBA) 54 OnTrackDM6 a5 FreeBSD ee EFI GPT

10 OPUS 55 EZ-Drive a6 OpenBSD ef EFI (FAT-12/16/

11 Hidden FAT12 56 Golden Bow a7 NeXTSTEP f0 Linux/PA-RISC b

12 Compaq diagnost 5c Priam Edisk a8 Darwin UFS f1 SpeedStor

14 Hidden FAT16❤ 61 SpeedStor a9 NetBSD f4 SpeedStor

16 Hidden FAT16 63 GNU HURD or Sys ab Darwin boot f2 DOS secondary

17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fd Linux raid auto

18 AST SmartSleep 65 Novell Netware b8 BSDI swap fe LANstep

1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid ff BBT

1c Hidden W95 FAT3 75 PC/IX

Command (m for help): m

Command action

a toggle a bootable flag

b edit bsd disklabel

c toggle the dos compatibility flag

d delete a partition

l list known partition types

m print this menu

n add a new partition

o create a new empty DOS partition table

p print the partition table

q quit without saving changes

s create a new empty Sun disklabel

t change a partition’s system id

u change display/entry units

v verify the partition table

w write table to disk and exit

x extra functionality (experts only)

Command (m for help): t

DESPLEGAR INFORMACION DE LOS SISTEMAS MONTADOS

[root@dga-3 ~]# cat /etc/mtab

/dev/mapper/VolGroup00-LogVol00 / ext3 rw 0 0

proc /proc proc rw 0 0

sysfs /sys sysfs rw 0 0

devpts /dev/pts devpts rw,gid=5,mode=620 0 0

/dev/sda2 /boot ext3 rw 0 0

tmpfs /dev/shm tmpfs rw 0 0

none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0

sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0

[root@dga-3 ~]# mount

/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

/dev/sda2 on /boot type ext3 (rw)

tmpfs on /dev/shm type tmpfs (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

[root@dga-3 ~]# df

Filesystem 1K-blocks Used Available Use% Mounted on

/dev/mapper/VolGroup00-LogVol00

34946880 3342144 29800860 11% /

/dev/sda2 101105 17524 78360 19% /boot

tmpfs 252236 0 252236 0% /dev/shm

No comments yet

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

A %d blogueros les gusta esto: