[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: What is the best way to migrate a server to new hardware?



Chris wrote:
> On the new box: 
> Install Debian per normal.
> 
> Old Box:
> #sudo dpkg --get-selections "*" >> installed_packages.txt
> copy the file, installed_packages.txt to the new box

I have done this before and it is a good method.

> On Newly install Debian:
> #sudo dpkg --set-selections < installed_packages.txt
> #sudo apt-get -u dselect-upgrade
> 
> This will read the file installed_packages.txt
> and will install these into the new Debian system.

Yes.

> Once that's up to date, take your tarball of /etc from the old box, 
> dump it to a temp dir in the new, decompress it, copy the .conf files
> that you modified (and any other dirs/files you yourself have created
> to /etc on the new box.

The problem that almost certainly will occur is if the order of
installation of packages that create users is different on the new
machine than on the old machine then some of the installed users will
have different uids on the new machine than on the old machine.  In
which case when you copy data from the old machine you have to take
extra care to ensure that the file ownership ends up being correct on
the new machine.

To make this work seed the /etc/{password,shadow,group,gshadow} with
all of the new groups from the old system first.  Then when installing
the new packages on the new system the uids and gids will be the same
as on the old system.  That done you can very easily copy data from
the old machine to the new and the file ownerships will be correct.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: