Logo 
Search:

Unix / Linux / Ubuntu Answers

Ask Question   UnAnswered
Home » Forum » Unix / Linux / Ubuntu       RSS Feeds
  on Dec 28 In Unix / Linux / Ubuntu Category.

  
Question Answered By: Adah Miller   on Dec 28


When an OS is installed (either Windows or Linux), it is usually onto
at least its own partition if not separate disk. Installing them on a
separate disk makes a lot of sense if it can be afforded.

However, if a virus gets onto a Window hard drive (let's say only one
hard drive and partitioned separately for Linux), then if the MBR
(Master Boot Record) is also compromised by the virus, then you won't
be able to get into the Linux OS environment until that problem is
resolved.

A Grub boot loader can help as well as a separate hard drive for the
different OSes. If two hard drives cannot be afforded, then it is
always a good idea to separate your OS files from your data files in
different partitions, and if you have enough space to spare throw in a
backup partition to help recover from such problems.

Typically, but not always required, Linux can be partitioned into a
/boot, a / or root partition, and a swap partition. The / partition
has the most space, swap about 2-4 times RAM size, and the /boot the
least.

When I kicked out too early of a parallel reinstall of WinXP Pro SP2,
it damaged my MBR and I could not boot into my installed Linux on
another hard drive from a Grub boot selection menu. Luckily, I had
saved off my MBRs of both my Windows and Linux hard drives onto my
Linux drive in /root/MBRs subdirectory that I had created. Windows
was installed on /dev/sda and Linux on /dev/sdb, so it was a simple
matter to save the MBRs as follows:

To save the Windows MBR onto the Linux hard drive when logged into the
installed Linux hard drive or partition OS:
# dd if=/dev/sda of=/root/MBRs/sdambr bs=512 count=1

To save the Linux MBR onto the Linux hard drive when logged into the
installed Linux hard drive or partition OS:
# dd if=/dev/sdb of=/root/MBRs/sdbmbr bs=512 count=1

Using Ubuntu Live CD, I saved off new copies of both MBRs, compared
them with a diff command and xxd command, and found out that the
Windows MBR had been trashed meaning that since I had a copy of the
old one, I could replace it and restore the Grub boot menu function.

To restore the Windows MBR (using an Ubuntu Live CD as the root user,
i.e. sudo -i:
First, make a mount point directory and then mount the Linux hard
drive into the Live CD environment:
# mkdir /tmp/disks-conf-sdb2
# mount -v -t ext3 /dev/sdb /tmp/disks-conf-sdb2

To rewrite the Windows MBR onto the Windows hard drive:
# dd if=/tmp/disks-conf-sdb2/root/MBRs/sdambr of=/dev/sda bs=512 count=1

After rebooting, I was then able to successfully select my installed
Linux OS even though WinXP Pro SP2 was still unstable.

Share: 

 

This Question has 6 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on windows xp and ubunto on same hard drive Or get search suggestion and latest updates.


Tagged: