Search

Recent Posts

Tags


« | Main | »

Linux – lost your boot?

By Dale Reagan | May 24, 2009

Ok, you made YAW (yet another whoops!) and need a fix but you don’t quite recall the tool or the steps needed – you just need a quick ‘refresh’…

The (Linux) system is not boot-able.  If you are using the Grub boot-loader, then one possible approach to fixing/restoring normal boot:

  1. Boot from the Linux release CD/DVD into “Rescue” mode (usually a ‘menu option’ for recent releases)
  2. chroot /mnt/sysimage
  3. then run grub-install /dev/BOOT_DISK

BOOT_DISK is your computer’s boot disk –  if you are not sure which disk then try the command:

dmesg | grep “.d[a-z]: “

The above should list all drives (which will usually be named  hda, hdb, …  OR sda, sdb, sdc…)

What about Grub?

If you are using the Grub boot-loader AND you have access to the file system then you can review the beginning of the file for boot-disk information.  When the grub.conf file is created it should include reference to your boot disk (i.e.  /boot/grub/grub.conf.)  In the example below the Linux boot disk is /dev/sda9 which refers to the BIOS disk hd0,8 (first physical disk, 9th partition since numbering begins with partition ‘0’…)   [Ever experimented with your BIOS boot-sequencing?  i.e.  CD/DVD, disk 0, disk 1, USB drive, etc. ]


# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,8)
# kernel /boot/vmlinuz-version ro root=/dev/sda9
# initrd /boot/initrd-version.img
#boot=/dev/sda9

After your fix the problem (or perhaps before you have it!) you should note which drives are being used for booting.  You can use the ‘df‘ command to list your current drives – should work for any Unix/Linux type OS.

[root@mybox]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda9             40313964  23910368  14355712  63% /
tmpfs                  2936424         0   2936424   0% /dev/shm
/dev/sda10           148206236 123370908  17306872  88% /mnt/virt_disks
/dev/sda6             49594196  26024540  21009700  56% /mnt/backup
/dev/sdb6             41326960  21044852  18182816  54% /var/www/cobbler
/dev/sda8               200568     78112    122456  39% /media/DOS_32_E
/dev/sdb1               529060        16    529044   1% /media/DOS_32_H
/dev/sdb2            104862716  28031084  76831632  27% /media/NTFS_F_100_GB
/dev/sdb8             19968760     88232  19880528   1% /media/kvm_ntfs
/dev/sdb10            79144188  64576552  14567636  82% /media/vdi_masters

Use the ‘fdisk’ command to list which drives are current enabled for ‘booting’ on hardware start-up (of course it is possible to configure your system to boot from both different physical disks as well as from logical partitions…)

The example listing below shows multiple physical disks as well as several logical disk partitions using Linux, DOS, NTFS and swap file system types.  In the example below the computer system could boot from either hd0 (/dev/sda – partition sda2) or hd1 (/dev/sdb – partition sdb1.)  Once the BIOS reads the boot information from the selected partition then any OS level boot choices/settings are implemented.   I use this type of configuration to select booting into Windows XP, Vista, other DOS-type OSes as well as for Linux.  With the arrival of relatively simple to use virtual machines (i.e. VirtualBox from Sun) I expect that the adoption of multi-os BIOS boot options will decline for physical hardware since you can now have even more options using virtual machines (and you can run multiple OSes on the same physical system – provided you have enough RAM/CPU resources…)

[root@mybox ~]# fdisk -l
Disk /dev/sda: 640.1 GB, 640135028736 bytes
255 heads, 63 sectors/track, 77825 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x2f5ab7fc
Device     Boot      Start         End      Blocks   Id  System
/dev/sda1               1        2023    16249716    7  HPFS/NTFS
/dev/sda2   *        2024        9672    61440000+   7  HPFS/NTFS
/dev/sda3            9673       65667   449776773    5  Extended
/dev/sda4           65668       77825    97659135    7  HPFS/NTFS
/dev/sda5            9673       22420   102398278+  83  Linux
/dev/sda6           22421       28794    51199123+  83  Linux
/dev/sda7           28795       29049     2048256   82  Linux swap / Solaris
/dev/sda8           29050       29074      200781    b  W95 FAT32
/dev/sda9           29075       34173    40957686   83  Linux
/dev/sda10          34174       52918   150569181   83  Linux
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000864cf
Device     Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1          66      530113+   b  W95 FAT32
/dev/sdb2              67       13121   104862720    7  HPFS/NTFS
/dev/sdb3           13122       60801   382989600    5  Extended
/dev/sdb5           13122       29694   133122591   83  Linux
/dev/sdb6           29695       34921    41985846   83  Linux
/dev/sdb7           34922       38285    27021298+  83  Linux
/dev/sdb8           38286       40771    19968763+   7  HPFS/NTFS
/dev/sdb9           40772       41853     8691133+  83  Linux

Topics: Computer Technology, Problem Solving, Unix-Linux-Os | Comments Off on Linux – lost your boot?

Comments are closed.


________________________________________________
YOUR GeoIP Data | Ip: 73.21.121.1
Continent: NA | Country Code: US | Country Name: United States
Region: | State/Region Name: | City:
(US only) Area Code: 0 | Postal code/Zip:
Latitude: 38.000000 | Longitude: -97.000000
Note - if using a mobile device your physical location may NOT be accurate...
________________________________________________

Georgia-USA.Com - Web Hosting for Business
____________________________________