LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-23-2006, 01:20 PM   #1
Lastomega
LQ Newbie
 
Registered: Mar 2006
Distribution: Fedora Core 5
Posts: 25

Rep: Reputation: 15
Transferring OS to new hard drive


I recently bought a new hard drive. My old hard drive was only 10gbs so the only OS on it was linux (fedora core 5). Upon receiving the new hard drive, I had to disconnect my old one (for the IDE cable) and installed windows (to use photoshop, my scanner, etc) on a partition, leaving unformatted space for a dual-boot.

Now, after having sufficiently missed linux, I dual-booted the new hard drive with a clean installation of linux. Seeing how much work it took to get everything set up (wlan, server, etc) it would be nice not to have to do it again.

Is there any way I can just copy my old configuration onto the new installation of linux? if not, how hard would it be to transfer the old installation on the new installation's partition?
 
Old 08-23-2006, 02:09 PM   #2
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 271Reputation: 271Reputation: 271
The first thing I would try is to buy a dual IDE cable so that you can just plug the old drive in as slave.

Then just reinstall grub from the old linux into the root partition (not MBR) of the old linux. Then chainload it with the new grub. Then you shouldn't have to move the install at all...

The other option I think would be to use something like Norton Ghost to make an exact image of the old install and then copy it to the new drive. Haven't done this in a long while, so I'm not sure how it will work...
 
Old 08-23-2006, 08:14 PM   #3
Lastomega
LQ Newbie
 
Registered: Mar 2006
Distribution: Fedora Core 5
Posts: 25

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by pljvaldez
Then just reinstall grub from the old linux into the root partition (not MBR) of the old linux. Then chainload it with the new grub.
2 things:
I dont really know how to reinstall grub and don't know how to chainload it.
 
Old 08-24-2006, 02:00 AM   #4
corfe
Member
 
Registered: Dec 2004
Location: Washington State, USA
Distribution: Debian Sid
Posts: 128

Rep: Reputation: 16
It shouldn't be too hard to transfer your system to the new partition, I've done it before, although this will be a little different as you need a different grub setup than what is on that system. It's been a while since I did this, but I'm pretty sure I got everything below. Also, THIS WILL DELETE EVERYTHING ON YOUR NEW LINUX SYSTEM, ONLY KEEPING DATA FROM YOUR OLD LINUX SYSTEM. It won't affect your windows installation, as long as you don't touch the windows partition. It also shouldn't affect your old linux installation, although after you ensure the transfer worked, you probably would want to reformat the drive and use it for storage, or something.

Anyways... the easiest way to do this is probably to boot into your favorite livecd (if unsure use knoppix), make sure to leave your new drive plugged into the system in the same way (if it's primary master or whatever, leave it that way!), plug in the old drive in another IDE position, then mount both these drives.

Let's say the old drive is mounted at "/mnt/old" and the new (dual-booted, new hard drive) partition is mounted as "/mnt/new" (replace with your actual drives, such as /dev/hda1 and /dev/hdb5, or whatever it is in knoppix).

Mount the drives first:

mount /mnt/new
mount /mnt/old

Then keep a copy of the /boot/grub directory from your new dual-boot system on your old drive for safety:

cp -r /mnt/new/boot/grub /mnt/old/backupgrub

Then erase everything on the unwanted partition (the one shared on your new dual-boot drive):

rm -rf /mnt/new/*

Now copy over the entire old system over to the new partition:

cp -r /mnt/old/* /mnt/new/

Now make sure we're using the /boot/grub from your dual-boot system to your "new linux" partition:

rm -rf /mnt/new/boot/grub
mv /mnt/old/backupgrub /mnt/new/boot/grub

Now we just need to edit the grub config (/mnt/new/boot/grub/menu.lst). Make sure that boot menu options are pointing to actual kernel images on the system, you may want to look at your old system's grub config (located at /mnt/old/boot/grub/menu.lst) for some hints on what kernel images to use, and what options they might require to boot. Make sure when supplying image locations you assume that "/mnt/new" is actually just "/". So, if you have a kernel image at "/mnt/new/boot/linux-2.6.17", then in grub it should look like "/boot/linux-2.6.17".

Finally, you need to install grub into the MBR of your new drive, using the config in /mnt/new/boot/grub. You can do this by (let's say /dev/hda is your new dual-boot drive):

grub-install --root-directory=/mnt/new/ /dev/hda

Now just unplug that old linux drive, and make sure your system is set to boot from the dual boot drive. You shouldn't actually have to unplug it, but it'll make sure everything's working on your new partition.
 
Old 08-24-2006, 12:46 PM   #5
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 271Reputation: 271Reputation: 271
Quote:
Originally Posted by Lastomega
2 things:
I dont really know how to reinstall grub and don't know how to chainload it.
Once you've hooked up the second drive with the new cable, boot into your working linux. Then do the following
Code:
mkdir /mnt/temp
mount /dev/hdb1 /mnt/temp
chroot /mnt/temp
grub-install /dev/hdb1
Basically, you make a directory to mount your old drive (I'm using /dev/hdb1 assuming that your old linux takes up the whole drive, adjust it as needed), mount it, then chroot into it (which essentially makes you root on your old machine), then install grub to that partition instead of the MBR. Then just type exit to get back to your new linux.

Now go to /boot/grub/menu.lst of the new linux and add the following to the end of the file
Code:
title          Old Fedora
root           (hd1,0)
chainloader    +1
Save the file and close. Then when you reboot you should have a new menu item that says "Old Fedora". When selected, it should boot to another grub menu (the old one you had on your other drive). This grub will boot the old Fedora install.

In case you're interested in where I got all this information, I got it from here. Grub is a very powerful bootloader. If you follow Saikee's signature, he actually has over 100 OS's booting by chainloading bootloaders...
 
Old 08-24-2006, 02:22 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Tip: if the board has two connectors, DON'T attach both HDDs to the
same cable. Use it on the secondary channel (master or slave doesn't
matter), that way it will copy stuff between the drives faster.



Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Transferring Hard Drive to Newer Computer kaplan71 SUSE / openSUSE 2 11-04-2005 05:11 PM
transferring linux to an external hard drive martha123 Linux - Newbie 1 09-21-2005 10:48 AM
Transferring OS to new Hard Drive thenebula Linux - Newbie 6 10-29-2004 10:06 PM
Transferring data from a WinXP Hard drive satimis Linux - Hardware 3 08-19-2004 07:34 AM
Transferring build to new hard drive NickC Mandriva 16 07-09-2004 09:59 PM


All times are GMT -5. The time now is 03:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration