The new version of Debian, due in some days (Debian 7.0, Wheezy) comes with multiarch support, which doesn't officially support migrating from 32 to 64 bits (at least I think so), but I have managed to migrate from i386 to amd64 with just one reboot to change kernels.
This is something that is not officially supported and that shouldn't be done if you don't have enough knowledge of the Debian system, as you can have some problems that may need some manual things done. I'll try to explain what I did but this is not a step by step guideline and is prone to fail in most cases needing you to install things by hand or similar things.
One more warning... you should be on Wheezy before trying to do any of this, trying to go from Squeeze i386 to Wheezy amd64 has given me some heavy problems, I also managed to do it but with too much manual intervention.
As always, I'm not liable of any problem you may have trying to do any of this.
The first thing I did as the machine was a pre i386 machine with an i386 kernel, was to install linux-image-amd64 in order to have a 64 bits kernel, this kernel will allow us to run both i386 and amd64 apps. Then I rebooted in order to run this kernel. It may be a good idea to install some extra packages like deborphan and binutils just in case we may need them later.
To allow us to install the amd64 packages we must enable the arch by using:
dpkg --add-architecture amd64
After that we can start installing the amd64 packages, what I did was:
apt-get install libc6:amd64
apt-get install apt:amd64
There I needed to answer (Yes, do as I say!) as we are installing apt and this will uninstall apt which is something you wouldn't usually want, but we want it here as we are installing apt :-)
Then I went for a
apt-get install dpkg:amd64
even though on some other tests dpkg seemed to be amd64 already after the apt installation, so maybe this is not needed.
Anyway, after that it looks like doing a
apt-get -f install
installs all the amd64 basic dependencies. But it seems that this command can break sometimes, or remove some packages on other times, what I did was note down the removed stuff in order to install them afterwards (remember that this will only remove the binaries, the config files will stay there so if you install them later they'll inherit that config, which is what we want). I had to run this command several times until I got it to end.
Getting this ended doesn't mean that we are done. Doing a
dpkg -l|grep :i386
will let us know what packages still remain on i386 arch. You can install them again with apt and they should be reinstalled on amd64 arch.
After that you can install all the stuff that had previously been removed and afterwards do some cleaning with
apt-get autoremove --purge
If you have finished cleaning up using deborphan or whatever and you do not see any i386 files on dpkg... you are done :-)
I had a problem with findutils as it seems that Debian dpkg system depends on find a lot when it tries to install findutils. To solve this I went to /var/cache/apt/archives/ and did
dpkg -x findutils... /tmp/findutils
and then had to cp the find binary to its place and then dpkg -i findutils...
I had similar problem with bash and dash which go together, again I had to apply the same solution as on the findutils case.
On some heavy problems you may end up with dpkg not working at all, you can then use
ar x package.deb
to extract that data.tar.?z and then tar to extract the binaries of the package out if there.
A useful command is
dpkg -l|grep ^rc
to see the packages that have been removed but still have configs around.
This is something I used to try to identify targets to install:
deborphan -a -n|sed -n "s/[^ ]* *\(.*\):i386/\1:amd64/p"