LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Restoring Slackware 14 x64 Boot Sector from Disk. (http://www.linuxquestions.org/questions/slackware-14/restoring-slackware-14-x64-boot-sector-from-disk-4175452558/)

tfnc99 03-03-2013 07:38 PM

Restoring Slackware 14 x64 Boot Sector from Disk.
 
Well, through work I got a copy of Windows FLP (link) and am going to install it on a 40Gig partitioin on my hard drive (end of hard drive) for some gaming (VirtualBox Direct3D... Horrible). Now the sad fact is that Windows cant help but install the MBR.
How do I reinstall LiLo from the CD command line? I am still in Slack and haven't installed it yet.

P.S. Does anyone know if Steam runs on this strange Windows FLP? .NET nor Visual Studio Do (Tested on some Work Workstations, they wont let me test Steam though ;_; ) due to some WIC missing dependencies.

P.S.S The Steam game I want isn't on Linux yet ;_;

Erik_FL 03-03-2013 09:57 PM

Windows is also going to write a disk signature to the MBR at offset 1B8 (hex). Although you can back up the MBR and then restore it after installing Windows, that could make Windows unable to boot. So, you are better off to reinstall LILO after installing Windows.

To re-install LILO using the Slackware setup disk, do the following.
  • Boot the Slackware 64-bit Setup disk
  • Mount your root partition (replace "sda1" with your root device name)
    Code:

    mount -t ext4 /dev/sda1 /mnt
  • Mount "dev" file-system so you can use "chroot".
    Code:

    mount --bind /dev /mnt/dev
  • Mount "proc" file-system so you can use "chroot".
    Code:

    mount --bind /proc /mnt/proc
  • Mount "sysfs" file-system so you can use "chroot".
    Code:

    mount --bind /sys /mnt/sys
  • Use "chroot" to make your root file-system be the root.
    Code:

    chroot /mnt
  • Edit "lilo.conf" to add a menu entry for Windows
    Code:

    cd /etc
    nano lilo.conf

  • Run the "lilo" command to re-install "lilo"
    Code:

    lilo
  • Exit from the "chroot" shell
    Code:

    exit
  • Un-mount your root file-system.
    Code:

    umount /mnt/sys
    umount /mnt/proc
    umount /mnt/dev
    umount /mnt

  • Reboot by pressing Ctrl+Alt+Delete

Here are the added lines for "lilo.conf" to boot Windows.

Code:

other = /dev/sda2
label = windows

Replace "sda2" with the correct device for your Windows partition (the partition containing "bootmgr" or "ntldr").

If you back up your MBR, be careful. If you or Windows make any partition changes afterward, restoring the MBR will undo those changes. Make any changes such as re-sizing partitions before you back up the MBR.

Here is how to back up the MBR to a file.

Code:

dd if=/dev/sda of=/mbr.bin bs=512 count=1
You can replace "/mbr.bin" with whatever path and file name you want to use for the backup of the MBR sector.

You should make another backup copy of the MBR to a different file before you restore a copy of the MBR.
To restore the MBR from a file use this command.

Code:

dd if=/mbr.bin of=/dev/sda bs=512 count=1
If Windows does not boot after restoring the MBR, you can use a Windows Setup disk to repair the Boot Configuration Database. Choose the option to start a command prompt and then use this command to repair the boot configuration.
Code:

bootrec /rebuildbcd

Alien Bob 03-04-2013 08:43 AM

Erik_FL, would you be interested to add this as an article on the Slackware Documentation Project? See http://docs.slackware.com/howtos:general_admin:start

Cheers, Eric

tfnc99 03-04-2013 09:19 PM

It worked, (FLP & Booting). Thank You~

One little problem though, Windows is now default, how do I change this?

Erik_FL 03-04-2013 09:48 PM

Quote:

Originally Posted by tfnc99 (Post 4904750)
It worked, (FLP & Booting). Thank You~

One little problem though, Windows is now default, how do I change this?

Add an option to "lilo.conf" to specify the default menu entry.

Code:

default=Linux
Replace "Linux" with the name of the desired menu entry. The name of a menu entry is the text following "label=".

You can find information about "lilio.conf" in the man pages or by searching on the Internet.
Code:

man lilo.conf

comet.berkeley 03-06-2013 06:33 PM

There is an easier way to do a chroot. The lilo command has an '-r' option.

To re-install LILO using the Slackware setup disk, do the following.
  • Boot the Slackware 64-bit Setup disk
  • If you can't remember which partition Slackware is on, list all partitions first:
    Code:

    fdisk -l
  • Mount your Slackware partition (replace "sda1" with your Slackware device name)
    Code:

    mount -t ext4 /dev/sda1 /mnt
  • Edit "/mnt/etc/lilo.conf" to add a menu entry for Windows
    Code:

    cd /mnt/etc
    vi lilo.conf

  • Run the "lilo" command to re-install "lilo" while doing a chroot to /mnt
    Code:

    /mnt/sbin/lilo -r /mnt
  • Un-mount your Slackware file-system.
    Code:

    umount /mnt
  • Reboot by pressing Ctrl+Alt+Delete


All times are GMT -5. The time now is 07:11 PM.