1 / 22

Bootloader / multi-boot

Bootloader / multi-boot. Bootloaders. Grand Unified Bootloader (GRUB) Linux Load (LILO). GRUB. Discovers boot images, kernels, and root filesystems from GRUB command shell Stores boot info in a filesystems (not the MBR) Reads filesystems and kernel executables

sakina
Download Presentation

Bootloader / multi-boot

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Bootloader / multi-boot

  2. Bootloaders • Grand Unified Bootloader (GRUB) • Linux Load (LILO)

  3. GRUB • Discovers boot images, kernels, and root filesystems from GRUB command shell • Stores boot info in a filesystems (not the MBR) • Reads filesystems and kernel executables • Does not restrict user to disk geometry • OS independent • Store GRUB in a separate boot partition • Remove and reinstall OS’s w/o having to reinstall the bootloader

  4. GRUB and LILO • Can boot non-Linux systems • Windows, OS/2, BSD, etc • Chain loading • Points to OS’s bootloader (ie, Windows)

  5. MBR • First 512 bytes of the first sector of the first partition on a drive • Contains partition table and 1st stage bootloader • 1st stage is first 445 bytes • Point to 2nd stage loader • Stored in /boot directory • Remaining 66 bytes • Partition table

  6. Linux • Limited to 63 total partitions per IDE drive • 3 primary • 4th: contains up to 60 logical partitions in a single extended partition • SCSI drives • Limited to 15 partitions • 3 primaries • 12 logicals

  7. Scenario • LILO installed, you wish to install GRUB • Determine the version of grub $grub –version grub (GNU GRUB 0.94) • Hard copy your partition table fdisk –l | lpr • Hard copy lilo.conf • Back up data • Keep rescue disk handy • LILO boot or Knoppix • Leave LILO intact… in case • Create GRUB boot diskette • Install GRUB to MBR • Boot the system • Edit GRUB configuration file • menu.lst

  8. Scenario • Create GRUB boot diskette /grub/i386-pc (can vary) could be in /usr/lib or /usr/share or… • Copy stage1 and stage2 to diskette with dd command $ dd if=stage1 of=/dev/fd0 bs=512 count=1 • Reboot the system (you get the GRUB screen) • Find the root device grub> find /boot/grub/stage1 (hd0,0) • Set the root device grub> root (hd0,0) • Install GRUB to MBR grub> setup (hd0) • Set the root device (again) grub> root (hd0,0) • Enter the path to the kernel and the root filesystem (in lilo.conf) • MAKE SURE YOU APPEND “ro” (read only) grub> kernel /boot/vmlinuz-2.4.21 root=/dev/hda1 ro • Now, boot the system grub> boot

  9. Gotchas • Linux refers to drives as hd1, hd2, etc… • GRUB starts with “0” (h0, h1, etc) • Both SCSI and IDEs are hd, floppies are fd • Linux primary partitions • 1-4 • 5 and up.. Extended partitions • GRUB • 0-3 primary • 4 and up extended • Identifying the root filesystem does not use GRUB’s numbering sytem grub> kernel /boot/vmlinuz-2.4.21 root=/dev/hda1 ro

  10. Install GRUB w/o floppy • Start a grub shell # grub • Find the stage1 loader grub> find /boot/grub/stage1 (hd0,0) • Run grub> root (hd0,0) grub> setup (hd0) grub> quit • Reboot

  11. Multi-booting Linux • Standalone /boot partition • Shared /home and /swap partitions • Standard Fedora install (on 20Gb IDE) • /dev/hda1 primary 100Mb /boot • /dev/hda2 primary 2,500Mb / • /dev/hda3 primary 3,000 Mb /home • /dev/hda4 extended • /dev/hda5 256Mb /swap • Free space 14,144

  12. Disk Druid • Used to partition • Delete any existing partitions • Highlight ‘free space’ • Click ‘new’ • Mountpoint is /boot ext2, 100Mb • Select ‘free space’ again • ‘new’ • Mountpoint is “/” ext3, 2500Mb • Next • /home ext3, 3000Mb • Find “swap” no mountpoint, 256Mb • When done, save changes using Disk Druid • Continue install, using GRUB (not LILO)

  13. QTPared • Create, delete, move and resize partitions • Included on Knoppix • Can be used to set up partitions even before new Linux install • Can be used to make changes to partitions even if data on them • /swap • Performance issues, put in its own partition • Shared on multiboot system • /home • Own partition • Share between different Linux systems • Not forced to restore data from backup when installing or removing systems

  14. Adding another Linux • Add additional Linux systems into logical partitions • Create a GRUB boot menu entry for each • After 1st Linux installed • Boot install of the new Linux • Partition and drive layouts • Highlight “free” and select “new” • 2500Mb for size (mountpoint is “/”) • Select filesystem type and initialize it (/dev/hda6) • Select /dev/hda3 to “Modify” • Select /home and ext3, do not initialize it • When done, write the partition info to disk • When prompted, you should only be formatting or initialing the “/” partition • Do NOT overwrite the MBR • Do you want Linux to handle booting system? “NO” • You want boot files installed to first sector of the root partition (/dev/hda6) • Use GRUB grub> root (hd0,0) grub> kernel / boot/vmlinuz-2,4,21 root=/dev/hda6 ro grub> boot

  15. Finding the boot parameters using GRUB • As grub is booting up, hit “c” • Get to the GRUB command shell grub>root (hd0, <tab> [tab completion] • possible partitions identifies along with filesystem type and partition type • Try them if needed… grub> root (hd0,0) • Search for kernel image grub> kernel /boot/vmlinuz<tab> • May report file not found grub> root (hd0,1) grub> kernel /boot/vmlinuz<tab> possible files are: vmlinuz vmlinuz-2.4.2 grub> kernel / boot/vmlinuz-2,4,21 root=/dev/hda2 ro grub> boot

  16. Miscellaneous • grub> cat /etc/shadow • grub> root(hd<tab> • Possible disks are: hd0 hd1 • Grub can be password protected • Documentation www.gnu.org/software/grub/manual/grub.html

  17. GRUB boot menu • /boot/grub/menu.lst • “stanza” • GRUB boot entry title Fedora 1 core root (hd0,0) kernel /boot/vmlinuz-2.4.22-1 root=/dev/hda1 ro initrd /boot/initrd-2.4.22-1.img • Title: required, can be anything • Each OS requires a stanza entry • Initrd: ramdisk (not all Linux implementations require a ramdisk)

  18. GRUB boot menu • menu.lst (or grub.conf) • Default entry • Number of the stanza (sequential) • Timeout entry • How long to wait for default entry to boot • splashimage • defaultsaved • Last image used to boot is saved as the next default

  19. Adding Windows to a Linux system • Different considerations for 95 thru ME as opposed to NT/2000/XP • XP • Make sure there’s enough free space and unused primary partition • Hard copy the partition table • Note what’s installed on each partition • Install from CD • Install complete • Restore the GRUB to the MBR • Load GRUB boot floppy grub> root (hd0,0) grub> setup (hd0) grub> reboot • Boot to Linux, and make an entry for the Windows system title WindowsXP on /dev/hda4 rootnoverify (hd0,3) makeactive chainloader +1

  20. Restore GRUB to MBR w/Knoppix • If installation of Windows overwrote the MBR and GRUB with the Windows Boot Menu you can no longer boot to Linux • Boot the Knoppix CD • su to root and run GRUB • Put GRUB onto the MBR grub> Root (hd0,0) grub> setup (hd0) grub> quit • Reboot and GRUB menu appears

  21. Password protecting GRUB # grub-md5-crypt • Copy and paste the encrypted password into menu.lst before the boot stanzas password –md5 $1$riAfJ0$QTuA1S/BGqlkYHQADZejs1 Or… plaintext password can be used… password mypasswordisthis • Chmod the menu.lst file if needed (root only) • When booting GRUB, hit “p” and enter the password to unlock the command shell • Users can still select.. Just can use command shell • (**** if you forget the GRUB password, anyone can simply boot with rescue disk and edit menu.lst *****)

  22. Assignment: • Install Red Hat on box w/GRUB • Install Mandriva as second Linux • Install Windows XP as third system

More Related