In Boot Record

In Boot Record

In troduction to Linux System Administration for the HP-UX Administrator Rob Lucke Hewlett-Packard A m ericas T echnical Computing A dvanced T echnology Center (ATC)2 1 00/01/12 Rob Lucke R ob_Lucke@ hp.com In troduction to Linux •Linux is an open-source operating system that com es in m any different flavors, or distributions -- this sem inar is based on information from the R edhat Linux version 6.1 distribution •Linux is Unix, like HP-UX, but has differences that we need to consider as HP-UX system adm inistrators •This is not an exhaustive tutorial, just som e of the things that I have run into during my exposure to Linux, aimed at the Linux curious, not experienced Linux users or adm inistrators •We will jum p right to system adm inistration topics, excluding the actual system installation procedure 2 00/01/12 Rob Lucke Comparing the HP-UX and Linux B oot P rocesses Interactive Interactive Initial Secondary Processor Boot System System HP-UX Dependent Code ROM Loader Loader Kernel (PDC) (ISL) (hpux) Time LILO Boot LILO Second-Stage PC Linux Loader Loader BIOS Kernel (/boot/boot.b) (/boot/boot.b) Interactive Interactive 3 00/01/12 Rob Lucke The Linux Loader: LILO •LILO is a fairly com plex topic, it can boot other operating system s, like Window s •We will only introduce LILO, but there is a wealth of information in the LILO User’s Guide • B ecause of BIOS limitations, LILO’s boot program may only be located in certain places: –The boot sector of a floppy –The master boot record (MBR) of the first hard disk (the first IDE drive or SC SI address 0) –The boot sector of a primary Linux file system partition on the first hard drive –A partition boot sector of an extended partition on the first hard drive 4 00/01/12 Rob Lucke The Linux Loader: LILO (continued) •LILO is not the only way to boot a Linux system –Other Linux boot managers (bootactv, loadlin, etc.) – Commercially available boot managers (i.e. Partition Magic) –Window s NT boot manager •The im portant thing to rem em ber: whatever boot m anager is in control must be able to find and access the boot sector containing LILO’s loader •If your system ’s hard drive configuration does not meet the Linux booting requirem ents, then you can boot from a floppy disk •If your system is ONLY Linux, then things are much simpler! 5 00/01/12 Rob Lucke Data L ayout for a Floppy Disk Boot Sector 0 Data Jump to Program Code Disk Parameters MS-DOS Program Boot Sector Code Magic Number 6 00/01/12 Rob Lucke Data L ayout for a Hard Disk (without extended partitions) Master Boot Partition Partition Partition Record Boot Record Boot Record Boot Record Partition 1 Partition 2 Partition 3 Partition 4 Program Partition Table Code Up to four primary Disk Parameters partitions per hard Magic Number disk for MS-DOS. 7 00/01/12 Rob Lucke Data L ayout for a Hard Disk (without extended partitions) Master Boot Partition Partition Partition Record Boot Record Boot Record Boot Record Partition 1 Partition 2 Partition 3 Partition 4 /dev/hda /dev/hda1 /dev/hda2 /dev/hda3 /dev/hda4 Note that each partition is accessible as if it were an independent device with its own boot sector. Linux creates devices for this configuration as shown. 8 00/01/12 Rob Lucke Data L ayout for a Hard Disk (with extended partitions) Extended Master Boot Partition Partition Record Boot Record Boot Record Extended Partition 3 Partition 1 Partition 2 /dev/hda5 /dev/hda6 /dev/hda /dev/hda1 /dev/hda2 /dev/hda3 If more than four partitions are needed, one primary partition is divided into an extended partition containing several logical partitions. Note that the partition tables of the logical partitions are not accessible as the first block of some device. 9 00/01/12 Rob Lucke L esson s Learned About In stallation and B ooting •Always make a boot disk! •Try to avoid replacing the Window s M BR with LILO on a multiple boot machine (get a boot m anager instead) • Save the boot sectors that are replaced by LILO installation (/boot/boot.NNNN) in case you need to restore them •Always make a boot disk! • Y ou can place the /boot partition into a sm all partition on the first IDE/SCSI drive and still m ount the Linux root partition from elsew here • ALW AYS M AKE A BOOT DISK ! 10 00/01/12 Rob Lucke Contents of the /boot Directory •If you look into a Linux /boot directory, you might see: system .map -> system .map-2.2.12-20 system .map-2.2.12-20 initrd-2.2.12-20 map module-info -> module-info-2.2.12-20 module-info-2.2.12-20 vm linux-2.2.12-20 vm linuz -> vm linuz-2.2.12-20 vm linuz-2.2.12-20 •On an SM P system , the files might have an “sm p” suffix (vm linux-2.2.12-20sm p, etc.) 11 00/01/12 Rob Lucke P assing Param eters to the Linux K ernel •The Linux kernel, just like HP-UX, may be passed “com m and-line” param eters when it is started (rem em ber the “hpux -is disk(;0)vm uni command?) •LILO can pass the follow ing param eters (and m any more): – read-only m ount the root read-only – vga=m ode norm al(80x25), extended(80x50), ask – ram disk = < size> – root=<root_device> device nam e or “current” – append=<string> append <string> to options – literal=<string> override ALL options with <string> • LILO input: “<nam e> single” will boot into single-user mode 12 00/01/12 Rob Lucke M ore L esson s About LILO • W hen you update a kernel, you must re-run LILO • Y ou should uninstall LILO before “decom issioning” a system •The default configuration file for LILO is /etc/lilo.conf • Y ou can build a “m ini” boot partition on a floppy, either by hand or using the “/sbin/m kbootdisk” com m and •The LILO com m and may be run on a m ounted disk by specifying the “-r <directory>” option, which will do a “chroot” to that directory •Examine the “m kbootdisk” script for exam ples of what is needed to build a bootable floppy disk 13 00/01/12 Rob Lucke An E xam ple LILO Configuration File boot = /dev/fd0 # Specify boot device delay = 10 # Wait 10 seconds message = bootmessage # Text prompt read-only # Mount root RO label = linux_up # Uniprocessor image = vmlinuz-2.2.12-20 initrd = initrd-2.2.12-20.img root = /dev/hda5 label = linux_smp # Multi-processor image=vmlinuz-2.2.12-20smp initrd = initrd-2.2.12-20smp.img root = /dev/hda5 label = linux_old # Last week’s kernel image = vmlinuz_old initrd = initrd-2.2.12-20old.img root = /dev/hda5 14 00/01/12 Rob Lucke Sam ple System H ardw are Configuration Description Use Device Name IDE Drive 1 Win98/Linux /dev/hda Windows partition Windows 98 /dev/hda1 Linux partition /boot /dev/hda2 NEC CD-ROM stacker /dev/hdc HP R/W CD-ROM /dev/hdd Floppy drive /dev/fd0 SCSI address 0 swap /dev/sda1 SCSI address 0 Linux / /dev/sda5 SCSI address 1 Linux /aux /dev/sdb1 SCSI address 1 swap /dev/sdb5 15 00/01/12 Rob Lucke Sam ple System H ardw are Configuration (continued) Description Use Device Name SCSI address 2 Linux /vmdata1 /dev/sdc1 SCSI address 2 swap /dev/sdc5 SCSI address 3 Linux /vmdata2 /dev/sdd1 SCSI address 3 swap /dev/sdd5 SCSI address 4 HP Photo scanner /dev/sge SCSI address 5 HP 6200C scanner /dev/sgf SCSI address 6 JAZ 1 GB drive /dev/sde4 COM1 V.90 modem /dev/ttyS0 Parallel port HP P1000 printer /dev/lp0 16 00/01/12 Rob Lucke Sam ple /etc/fstab for Example H ardw are /dev/sda5 / ext2 defaults 1 1 /dev/hda2 /boot ext2 defaults 1 2 /dev/sdb1 /aux1 ext2 defaults 1 2 /dev/sdc1 /vmdata1 ext2 defaults 1 2 /dev/sdd1 /vmdata2 ext2 defaults 1 2 /dev/sda1 swap swap pri=1 0 0 /dev/sdb5 swap swap pri=1 0 0 /dev/sdc5 swap swap pri=1 0 0 /dev/sdd5 swap swap pri=1 0 0 /dev/fd0 /mnt/floppy ext2 owner,noauto 0 0 /dev/cdrom /mnt/cdrom iso9660 owner,noauto,ro 0 0 /dev/hdd /mnt/cd-rw iso9660 noauto,ro 0 0 /dev/sde4 /mnt/jaz vfat fat=16 0 0 /dev/hda1 /mnt/Win98 vfat fat=32 0 0 none /proc proc defaults 0 0 none /dev/pts devpts gid=5,mode=620 0 0 17 00/01/12 Rob Lucke Linux K ernel Modules • When configuring a kernel, you have the choice to build things in (monolithic) or to dynam ically load modules (slow er) but much easier ... • The “lsm od” command lists all loaded modules and their current state • The startup operation will detect hardw are and load the proper module (usually) for any supported hardw are • At boot time, the startup process runs “depm od -a”, which builds a dependency list for all m odules • The /etc/conf.m odules file contains com m ands for the module com m ands “insm od” and “m odprobe” • Unused modules are unloaded by a cron job which executes “rm m od -a” • Modules are located under “/lib/modules/<kernel_rev>” 18 00/01/12 Rob Lucke Building the Linux K ernel • Note: Redhat Linux is com piled for m aximum com patibility, for an i386 processor! • To build the kernel: – cd /usr/src/linux (a link to the current version) – Build the configurator: • make xconfig(X-window s configurator tool) • make menuconfig(VGA mode configurator tool) – Save the current configuration to a file! – Make changes using the conrigurator – Save new configuration to a file! – Build the kernel (Be prepared for a wait …) • make deps (build dependencies) • make bzIm age (a com pressed kernel) • make m odules (if you are using them ) 19 00/01/12 Rob Lucke Building the Linux K ernel (continued) – Back up the current module inform ation! – Backup the current kernel and system files! – Alw ays make a boot disk ! (/sb in/mkbootdisk ) – make m odules_install(install new modules) – Move kernel and other system files from /usr/src/linux/arch/i386/boot, this will be called “bzIm age” • Can use /sb in/installkernel <version> <boot> <m ap> – Run LILO to update map inform ation (offset into partition for kernel file) in boot record – R eboot and

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    33 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us