View previous topic :: View next topic |
Author |
Message |
majin_boy n00b
Joined: 01 Feb 2006 Posts: 24
|
Posted: Tue Nov 20, 2007 4:57 am Post subject: Transplanting Existing Gentoo Install |
|
|
Firstly, forgive me if this is in the wrong section. But it is the best one that I could think of for my problem.
Now, sometime within the next week, I plan to upgrade the hard drive in my laptop and get an external enclosure for my present hard drive. I was wondering whether there is a method by which I could transplant the Gentoo install which is on my present hard drive onto the new hard drive?
One idea I had was this: Once the new hard drive is installed and the old one is in the external enclosure, I would boot the livecd and do a Code: | dd if=/dev/sdb4 of=/dev/sda2 | Where /dev/sdb4 is the root partition in the old hard drive and /dev/sda2 would be the root partition in the new hard drive. Would everything work fine? Granted, GRUB would have to be re-installed, but otherwise would it work?
Is there some other method which is known to work?
Thanks,
Alex. |
|
Back to top |
|
|
EzInKy Veteran
Joined: 11 Oct 2002 Posts: 1742 Location: Kentucky
|
Posted: Tue Nov 20, 2007 5:10 am Post subject: |
|
|
cp -a has always worked for me. _________________ Time is what keeps everything from happening all at once. |
|
Back to top |
|
|
jcat Veteran
Joined: 26 May 2006 Posts: 1337
|
Posted: Tue Nov 20, 2007 6:01 am Post subject: Re: Transplanting Existing Gentoo Install |
|
|
majin_boy wrote: |
One idea I had was this: Once the new hard drive is installed and the old one is in the external enclosure, I would boot the livecd and do a Code: | dd if=/dev/sdb4 of=/dev/sda2 | Where /dev/sdb4 is the root partition in the old hard drive and /dev/sda2 would be the root partition in the new hard drive. Would everything work fine? Granted, GRUB would have to be re-installed, but otherwise would it work?
|
Your suggested approach will only work if both disks are physically identical (cylinder size, no. etc...). Even then it's maybe not the best way because it copies empty sectors (so it's quite inefficient), but on the plus side it would take care of the boot sector as well (you wouldn't have to install grub in the boot sector).
I would create your partitions first using fdisk, then format as required, then copy the data over. There are a number of ways to do the copy, I've seen all sorts before now, like piped tar command etc, but as EzInKy suggests, cp -a will be fine
Cheers,
jcat |
|
Back to top |
|
|
majin_boy n00b
Joined: 01 Feb 2006 Posts: 24
|
Posted: Tue Nov 20, 2007 7:57 am Post subject: |
|
|
Thanks for the suggestions guys. I'll try cp -a once I get my hands on the new disk.
Cheers,
Alex. |
|
Back to top |
|
|
djinnZ Advocate
Joined: 02 Nov 2006 Posts: 4831 Location: somewhere in L.O.S.
|
Posted: Tue Nov 20, 2007 11:59 am Post subject: |
|
|
better rsync IMHO or:
build binary packages with Code: | for i in `qpkg -nc -v -I` ; do if [ ! -f /usr/portage/packages/All/`echo $i | sed "s/^.*\///"`.tbz2 ]; then quickpkg =$i; fi; done | copy the make.conf and /etc/portage/... configuration files and install on a new stage3 with Code: | emerge -eDNuK world |
_________________ scita et risus abundant in ore stultorum sed etiam semper severi insani sunt
mala tempora currunt...mater stultorum semper pregna est
Murpy'sLaw:If anything can go wrong, it will - O'Toole's Corollary:Murphy was an optimist
Last edited by djinnZ on Tue Nov 20, 2007 4:59 pm; edited 2 times in total |
|
Back to top |
|
|
RuncZ n00b
Joined: 20 Nov 2007 Posts: 4
|
Posted: Tue Nov 20, 2007 1:09 pm Post subject: |
|
|
and don't forget that /etc/fstab |
|
Back to top |
|
|
ali3nx l33t
Joined: 21 Sep 2003 Posts: 722 Location: Winnipeg, Canada
|
Posted: Sun Jun 01, 2008 6:51 am Post subject: |
|
|
Thanks for posting an update for using quickpkg. The script i used was naturally a bit outdated due to some of the changes in portage over the last year. It seems that even portage-utils has changed as the syntax for qpkg mentioned above isn't valid any longer.
Here's some updated commands for using quickpkg to build binary packages. Note that I included the option for quickpkg to include config files. If you dont use this important scripts are excluded by default!
Code: | for i in `qlist -C -v -I` ; do if [ ! -f /usr/portage/packages/All/`echo $i | sed "s/^.*\///"`.tbz2 ]; then quickpkg --include-config=y =$i; fi; done |
The above example will only build packages for any package not found in /usr/portage/packages/All/
It may occasionally be desirable to rebuild every package.
Code: | for i in `qlist -C -v -I` ; do quickpkg --include-config=y =$i; done |
|
|
Back to top |
|
|
cwr Veteran
Joined: 17 Dec 2005 Posts: 1969
|
Posted: Sun Jun 01, 2008 9:30 am Post subject: |
|
|
I've used dd a couple of times when changing hard drives; obviously you need
two drives attached, but otherwise it's straightforward. I copied partitions,
not the whole drive, and I made very sure that the old and the new partitions
had exactly the same number of blocks of exactly the same size.
The sequence was:
copy the original partition to an image (file) on the second drive
change out the first drive
boot from a Live CD
set up the partitions on the first drive
copy the second drive's images to partitions on the first drive
set up grub on the first drive
reboot
Since a number of partitions were bigger than 2G, the maximum file size on
my system, I wrote a script to copy big partitions in chunks - basically telling
dd to skip X blocks and then copy Y blocks to an intermediate file. I wrote
it as a script so that I had a record of what I'd done, to avoid mistakes
when reinstalling.
Good luck - Will |
|
Back to top |
|
|
Exil Apprentice
Joined: 10 Oct 2005 Posts: 251 Location: Nibylandia
|
|
Back to top |
|
|
|