This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
title My Linux root to 2nd driveroot (hd0,1)kernel /boot/vmlinuz-2.6.25.5-1.1-pae ro root=/dev/sdb1initrd /boot/initrd-2.6.25.5-1.1-pae
Boot Sector
/
MBR
/dev
/sdb
1
/dev/sdb
New drive added with custom root file system
Extra Credit LabSee Lab X2on Calendar
Adds a new drive and root file
system to the OpenSUSE VM.
GRUB is configured to root to the new root file system
CIS 191 - Lesson 5
Skills
CIS 191 - Lesson 5
Lesson 5New Skills
• Boot time GRUB edits (review)
• Changing BIOS boot order on a VM (review)
• Mounting CD ISO and floppy Image files on loopback devices
(new)
• Making a diagnostics boot diskette (new)
Boot timeGRUB edits
CIS 191 - Lesson 5
GRUB boot editsFedora 9
Press any key to get boot menu
CIS 191 - Lesson 5
GRUB boot editsFedora 9
Move up and down using arrow keys. Press e to edit selection.
CIS 191 - Lesson 5
GRUB boot editsFedora 9
Move up and down using arrow keys. Press e to edit selection.
CIS 191 - Lesson 5
GRUB boot editsFedora 9
Make changes by moving the cursor and replacing or inserting characters.
CIS 191 - Lesson 5
GRUB boot editsFedora 9
For this example we replace UUID specification of the / partition with /dev/sda5, remove the rhgb and quiet options and add single to boot up in single user mode. Hit Enter when finished.
CIS 191 - Lesson 3
GRUB boot editsFedora 9
Now press b to boot up using the changes
CIS 191 - Lesson 5
GRUB boot editsFedora 9
The system now boots into single user mode.
NOTE: The GRUB changes are temporary. /boot/grub/grub.conf must be edited to make changes permanent
NOTE: The single option on the kernel line is very handy when troubleshooting boot problems.
BIOS bootorder
CIS 191 - Lesson 3
BIOS Boot OrderVMware BIOS
1) Click inside the VM so it has the focus
2) Tap F2 repeatedly to enter BIOS configuration.
Note: You don't get much time for this so have your finger over the F2 key!
CIS 191 - Lesson 3
BIOS Boot OrderVMware BIOS
Right arrow over to the Boot menu.
CIS 191 - Lesson 3
BIOS Boot OrderVMware BIOS
Re-order to suit your needs. This VM will look first on a floppy, then a CD, then the hard drive and then try network boot.
CIS 191 - Lesson 3
BIOS Boot OrderVMware BIOS
A + means the group can be expanded (use Enter)
Noter: VMware BIOS does not support USB pen drive boots.
CIS 191 - Lesson 3
BIOS Boot OrderVMware BIOS
If you have multiple hard drives, they can be searched in order as well
CIS 191 - Lesson 3
BIOS Boot OrderVMware BIOS
Save any changes you make.
loopbackmounts
CIS 191 - Lesson 5
Lesson 5Mounting CD ISO and floppy Image files on loopback devices
Desired: Be able to directly mount an CD ISO image file. Avoids having to burn downloaded ISO's on to CD's , then loading the new CD into computer, and then finally mounting /dev/cd0.
Solution: Use loopback devices.
/boot
/dev
/
/bin /etc /mnt
cdrom/
/dev/boot /home
cis191/
grub/
lost+found/
lost+found/
floppy/
/lib
/dev/sdb1
/dev/sda1
/dev/sda5
Mounting File SystemsLike pinning the tail on the donkey
mount /dev/sdb1 /mnt
/lib
/bin
CIS 191 - Lesson 5
/
/bin /etc /mnt
bin/
/dev/boot /home
cis191/
grub/
lost+found/
lost+found/boot/
dev/
/lib
/dev/sda1
/dev/sda5
Mounting File SystemsLike pinning the tail on the donkey
/dev/sda6
mount /dev/sdb1 /mnt
lib/
CIS 191 - Lesson 5
/
/bin /etc /mnt
cdrom/
/dev/boot /home
cis191/
grub/
lost+found/
lost+found/
floppy/
/lib
/dev/sda1
/dev/sda5
Mounting Image FilesLike pinning the tail on the donkey
mount –o loop Desktop/rescue-cd.iso /mnt
rescue-cd.iso
CIS 191 - Lesson 5
/
/bin /etc /mnt
/images
/dev/boot /home
/rsimms
/grub
/lost+found
/lost+found
/isolinux
TRANS.TBL
/lib
/dev/sda1
/dev/sda5
Mounting Image FilesLike pinning the tail on the donkey
/dev/loop0
mount –o loop Desktop/rescue-cd.iso /mnt
CIS 191 - Lesson 5
HWDiags
CIS 191 - Lesson 5
Diagnostics boot disketteChecking out your system prior to installing Linux
• Check RAM quantity
• Check drive sizes
• Inspect other hardware resources as necessary
CIS 191 - Lesson 5
Diagnostics boot disk
BIOS code
Floppy with boot code for DOS
Boot order with floppy drive at top
When DOS loads, autoexec.bat run diagnostics program
3. MBR read its partition table to determine which
partition to boot into.
4. MBR loads the boot program in the active partition.
5. Boot program presents user with boot prompt menu.
6. Based upon user selection, boot program loads
desired kernel along with and supplied boot options
7. Kernel uncompresses and loads into memory.
8. Kernel detects hardware and initializes its data.
fdisk
boot order
grub.conf
grub.conf
CIS 191 - Lesson 5
Rooting the System
1. Kernel mounts the root file system2. Kernel creates and starts the init process3. init reads /etc/inittab for its instructions4. init performs system initialization:
• presents some kind of welcome banner• allows for and interactive startup• set up keyboard mapping, system fonts, plug and play
devices, …• checks for dirty file systems, can clean them if
necessary• checks disk quotas and swap space• mounts all file systems
5. Chooses which runlevel to come up in and executes those scripts via rc script
6. daemons load7. getty processes are spawned on terminal devices
/etc/inittab
grub.conf
/etc/rc.d
CIS 191 - Lesson 5
Preparing for trouble
• Record your partition and mount information (output from fdisk –l and mount)
• Make a copy of your MBR. For example:dd if=/dev/sda of=mbr bs=512 count=1
• Create a bootable rescue floppy with GRUB installed that roots to your / partition on your Linux system.
• Record grub.conf
• Record MBR xxd output
• Record /etc/inittab
CIS 191 - Lesson 5
Rescue boot devices
• Put pristine GRUB stage1 and stage2 files• Add GRUB config files for more control• Add a kernel for more options• Make vender rescue disk• Add a kernel and small root file system with tools• Use small Linux distribution like Knoppix
CIS 191 - Lesson 5
Making rescue floppyRH9 example
Boot Sector
/dev
/fd0
Method I The "simplest rescue diskette"
cd /usr/share/grub/i386-redhatcat stage1 stage2 > /dev/fd0
Note: this will allow you to boot directly into GRUB. At boot time you would manually enter (use tab completes!):grubgrub> root (hd0,0)grub> kernel /vmlinuz-2.4.20-6 ro root=/dev/sda2grub> initrd /initrd-2.4.20-6.imggrub> boot