Sunday, October 3, 2010

What the hell did I install ?!

So I got a new laptop from my work. I have already my IBM x60s running Gentoo. I want to install my new Lenovo x200 with about the same configuration.
So what did I installed on my IBM x60s?
cat /var/lib/portage/world
shows you all the packages you have ran 'emerge package'. It will not show you all the dependencies that portage have added, so its a clean list of packages you installed.

I copy the world file to my fresh install and edit it deleting packages I don't need.
But wait! Don't install this packages yet. You will download lot of blobs that you have already.
In my x60s all the packages are stored in /usr/portage/distfiles/.
So I just copy all the files from the old computer to the new computer. I do it with rsync, but you can do it with scp, cp+sshfs etc.
rsync -avPn --exclude=svn-src /usr/portage/distfiles/* x200/usr/portage/distfiles/
Lets make sure we have all the blobs:
emerge --fetchonly $(cat copied.world.file)

Now we can install everything ;-)
emerge $(cat copied.world.file)

Simple!

Regards,
Kfir

3 comments:

  1. I have Gentoo installed on a Lenovo T60 and X61.
    Awesome!

    ReplyDelete
  2. Nice trick. I have a question. Do you know how to replicate whole server while it's running. I'm buying new machine and I want to have as less down time as possible. I'm aware that databases and other dynamic stuff needs to be copied offline, but I have those on separate drive. I only want to copy working system to new machine, swap necessary hardware and make it go.

    ReplyDelete
  3. dr4cul4:
    Your question is very different then what I have suggested in my post.
    Few points to consider:
    1. Ask your question in the gentoo-user mailing list. People there are very knowledgeable.
    2. Make sure your compiled stuff on your servers will run on your new hardware. If not the code you copy to the new server will not run. Check make.conf for the cpu compilation parameter. If it's not i686 you will need to take care.
    3. rsync is a very good utility to copy live system from one running computer to the other. You will need to use the --exclude parameter to exclude directories such as /sys /proc /tmp/ /var... etc. My guess is that rsync can really work, if you take care of the dynamic stuff after syncing server to server.

    Regards,
    Kfir

    ReplyDelete