Thursday, February 26, 2009

Get the grub of your ubuntu machine

lot of my fresh to linux friends asks about how to get the grub (boot loader information) of your machine, this grub will help you to restore your ubuntu system, after installing another OS on it beside your ubuntu.

to get the grub, you need to lig on your system as root,
su root
then enter the password,
now, this is the Xfactor:
dd if=[source] of=[destination] count=1
the command dd, which copy the content of if and put it in of location,
count means how many block copied from the source to destination
now, if you want to get the grub of your machine, you'll enter this command
dd if=/dev/sda of=/home/aigdonia/grub.bin count=1

this will read the first block form /dev/sda (you need to change it according to your system) and paste it in /home/aigdonia/grub.bin (change to wherever you like to paste)

now, you've a file called grub.bin on /home/aigdonia holds the first block of your hard disk, you can now install Windows or whatever OS you like then you'll restore the grub again by doing the following simple steps:

from your ubuntu live CD, write the following in the shell window:
sudo dd if=[grub.bin] of=[/dev/sda] count=1

this will do the reverse operation, and then you can leave the live session and log normally to your ubuntu :)

0 reviews: