10

I currently have packages, modules, settings, etc. for Eclipse, MySQL, Python, Firefox, etc. set up on Kubuntu. I have also optimally configured Kubuntu for my needs. I would like to duplicate my environment on another machine that has a different processor (currently on an Intel Q9450, the new processor is an i7). As I understand, my applications are compiled for use with my specific processor, so making a straight partition copy is out of the question.

Is there any way to duplicate my environment onto this other machine, short of re-installing and re-configuring everything?

5
  • This question is incredible to me...I was asking the same thing!
    – dag729
    Jan 29, 2010 at 5:38
  • "As I understand, my applications are compiled for use with my specific processor": Where did you get that idea? I don't know any distro (except of course Gentoo) which does that.
    – sleske
    Jan 29, 2010 at 9:33
  • @sleske: have you ever tried to install a amd64 package on a ppc version of Debian? ;)
    – dag729
    Jan 29, 2010 at 16:37
  • 1
    @dag729: Of course, if you change processor architecture, you'll need new packages. But Intel Q9450 and i7 are both x86 processors.
    – sleske
    Jan 31, 2010 at 22:22
  • 1
    I thought my i7 was x86_64. I am running 64-bit applications on this machine. Am I incorrect?
    – curious
    Feb 1, 2010 at 5:31

6 Answers 6

3

As I understand, my applications are compiled for use with my specific processor, so making a straight partition copy is out of the question.

What leads you to this conclusion? At least for x86, the packages installed by Kubuntu are compiled to run on practically all non-prehistoric CPUs. I believe they will run on anything newer than a 486, which probably does not pose a problem in your case :-).

So a straight partition copy should work just fine:

  • copy partitions (or just copy the files using cp -a , if your partition layout changed)
  • adapt /etc/fstab to new partition layout
  • reconfigure bootloader for new partitions, and reinstall bootloader
  • boot & enjoy

Problems are only to be expected for:

  • self-compiled packages, but even there, most will by default compile for all modern CPUs, unless you play with compiler options
  • device drivers

Most modern kernels autodetect hw on boot, so usually even drivers should be ok, but if things fail, you can usually boot in single-user mode and fix any driver issues.

1
  • If this works my life will be much easier. Thanks! I will try this first.
    – curious
    Jan 30, 2010 at 1:41
7

You can take your home directory without any changes. Almost everything that goes into a home directory is designed to be sharable over something like NFS, so you are good.

Also, save your package selection with

sudo dpkg --get-selections '*' >file.txt

and restore it on the other machine with

sudo dpkg --set-selections <file.txt

Similarly, save your debconf settings with

sudo debconf-get-selections >file2.txt

and restore with

sudo debconf-set-selections <file2.txt

For the rest of the configuration in /etc that is not managed by debconf, it is hard to track what was manually changed, unless you have used something like etckeeper (perhaps an idea for the future). For that reason, I tend to keep most of my configuration in my home directory. But since you know which programs you are interested in, it should be easy to find the relevant files in /etc and check and copy them manually.

1
  • 1
    Yes, if you are migrating to a different architecture, this is the way to go. As a side note: Just make a copy of /etc/ somewhere safe, then you can selectively restore config files when you need them on the new system.
    – sleske
    Jan 29, 2010 at 9:34
1

You can backup your home, and restore it to the other machine. This cannot fully fulfill your need, but it will restore all the configuration. You have to reinstall the packages yourself, though.

1

A vast majority of custom configurations will be in /home/, with most of the rest in /etc/. some of the /etc files have machine or hardware specific information (/etc/X11/xorg.conf, /etc/hostname, /etc/fstab off the top of my head), but much of it can just be copied over if you are going to be using the same OS version.

1
  • Of the things you listed, MySQL is the only one that will likely have configuration in /etc/ you may want to copy, the rest are in /home/ Jan 29, 2010 at 6:56
1

Seconding the get,set selections thing.

To know exactly which conffiles have changed, run this:

dpkg-query --show --showformat='${Conffiles}\n' |sort -u | \
while read f m obsolete; do \
  [[ -r $f ]] || continue; m2=$(md5sum "$f") ;
  [[ $m2 != "$m  $f" ]] && echo "$f";
done |xargs -n1 dlocate  |tee ~/edited-conffiles

If you don't have dlocate installed already, you can replace it with dpkg -S or skip that part.

To back up all conffiles:

dpkg-query --show --showformat='${Conffiles}\n' |sort -u | \
while read f m obsolete; do \
  echo "$f"
done |sudo tar cjf ~/conffiles.tbz2 -T -
1

Hmm. If you don't mind a bit of fiddling you could plug the new HDD into your box, mount it then use dd. For example, if your current root is set to /dev/sda3 and you mounted the new HDD to /dev/sdb2 you would use

dd if=/dev/sda3 of=/dev/sdb2

You'll need to do that as root, of course. After that you'll be wanting to install Grub, so you need to put an Ubuntu LiveCD in and use that.

Or you could take a look at this link: http://www.ehow.com/how_4924091_clone-hard-drive-linux.html - It looks like a pretty good walk through for cloning a Linux hard drive, though I haven't tested that site out myself.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.