FreeBSD 7.1 - i386 -> amd64 migration via SSH only :)
There is a server located in a data center in Moscow. There is me who is in the county town of N ™ :-) The only access to the server is SSH and Remote PDU to reboot.
There was a need to switch to FreeBSD amd64, for one updating the software and rebuilding the kernel.
What came before:
FreeBSD hostname FreeBSD 7.1-RELEASE i386.
What happened after:
FreeBSD hostname FreeBSD 7.1-RELEASE amd64.
Short disclamer:
We take as a basis:
FreeBSD 7.x i386.
The presence of two HDD (or partitions).
To get started, we need the complete source code for the system and kernel (directory / usr / src /). You can install them through CVSup (src-all directive), or through sysinstall (sysinstall -> Distribution -> src).
In principle, the sources do not weigh much and swing quickly.
After that, we must create a new kernel config for our system. The kernel options depend on your tasks and hardware, I will not give your own here. The only thing that I advise you to add from yourself - This is useful, because in the new system at the time of the first start there will be no ipfw configurations (and by default it blocks everything, including our SSH). I got so :) I had to send the server to reboot and transfer the configuration.
After we finish configuring the kernel - “install” our config back by copying. The main thing is not to forget that we take and put the config not in sys / i386, as usual, but sys / amd64.
I personally removed from /etc/make.conf all the "extra" options that could interfere with compilation - optimization, etc., which I advise you.
After that, you need to collect the world: And the kernel: With the -s switch, we tell make that we don’t need to display each file, only the names of the directories it collects. The whole procedure (C2D E7200) took me about two - two and a half hours. Next, we assume that our second HDD is mounted in / backup /, which is clean. Install the world: Install the kernel: Install the configuration files, etc. trifle:
At this step, problems may arise with a lack of any conf. files (personally, I swore at sendmail and sshd). They can simply be copied from a working system.
Drag and drop the kernel:
cp -pr / backup / boot / kernel /boot/kernel.test
And edit \ transfer the config. files in / backup / etc. We are interested in rc.conf (hostname, network settings), sshd_conf and passwd-shadow. If you did not set default_to_accept, do not forget to open SSH in rc.firewall for yourself.
It's time to try.
For a one-time boot into the new system, we will use nextboot. This is a very good program that allows you to boot with another kernel / world ONE time. If the server is rebooted, our old system will boot again.
nextboot -D
nextboot -o vfs.root.mountfrom = ufs: / dev / ad2s1d -k kernel.test The
-D switch resets the nextboot configuration if it already existed. -o vfs.root.mountfrom indicates where the root partition is located. Naturally, instead of ad2s1d, your second drive \ partition should be specified, not mine, and -k is the path to the kernel relative to / boot /.
If all the points are completed - sudo shutdown -r now
If you did everything correctly, and you were a bit lucky and the system didn’t throw the feint with your ears, we will see working amd64 FreeBSD :)
If we didn’t see it on the network in a few minutes, we reboot the server via remote power management and look for where we made a mistake :) It
remains only to rebuild all the software you need.
There was a need to switch to FreeBSD amd64, for one updating the software and rebuilding the kernel.
What came before:
FreeBSD hostname FreeBSD 7.1-RELEASE i386.
What happened after:
FreeBSD hostname FreeBSD 7.1-RELEASE amd64.
Short disclamer:
- You do everything at your own peril and risk.
- I do not advise doing this. True. If it is possible to come or order a KVM and install the system as usual - it is better to install as usual. Installing and configuring FreeBSD takes a couple of hours, and it took me almost two days to complete this “procedure” (including reading mana and mocking Google).
- We used materials from FreeBSD.org, OpenNet.ru, lissyara.su. Well, google, where without it.
We take as a basis:
FreeBSD 7.x i386.
The presence of two HDD (or partitions).
To get started, we need the complete source code for the system and kernel (directory / usr / src /). You can install them through CVSup (src-all directive), or through sysinstall (sysinstall -> Distribution -> src).
In principle, the sources do not weigh much and swing quickly.
After that, we must create a new kernel config for our system. The kernel options depend on your tasks and hardware, I will not give your own here. The only thing that I advise you to add from yourself - This is useful, because in the new system at the time of the first start there will be no ipfw configurations (and by default it blocks everything, including our SSH). I got so :) I had to send the server to reboot and transfer the configuration.
cp /usr/src/sys/amd64/conf/GENERIC ~/<название_ядра>
ee <название_ядра>
options IPFIREWALL_DEFAULT_TO_ACCEPT
After we finish configuring the kernel - “install” our config back by copying. The main thing is not to forget that we take and put the config not in sys / i386, as usual, but sys / amd64.
I personally removed from /etc/make.conf all the "extra" options that could interfere with compilation - optimization, etc., which I advise you.
After that, you need to collect the world: And the kernel: With the -s switch, we tell make that we don’t need to display each file, only the names of the directories it collects. The whole procedure (C2D E7200) took me about two - two and a half hours. Next, we assume that our second HDD is mounted in / backup /, which is clean. Install the world: Install the kernel: Install the configuration files, etc. trifle:
cd /usr/src/
make -s buildworld TARGET_ARCH=amd64
make -s buildkernel TARGET_ARCH=amd64 KERNCONF=<имя_ядра>
make -s installworld TARGET_ARCH=amd64 DESTDIR=/backup/
make -s installkernel TARGET_ARCH=amd64 DESTDIR=/backup/ KERNCONF=<имя_ядра>
cd etc/
make -s distribution DESTDIR=/backup/
At this step, problems may arise with a lack of any conf. files (personally, I swore at sendmail and sshd). They can simply be copied from a working system.
Drag and drop the kernel:
cp -pr / backup / boot / kernel /boot/kernel.test
And edit \ transfer the config. files in / backup / etc. We are interested in rc.conf (hostname, network settings), sshd_conf and passwd-shadow. If you did not set default_to_accept, do not forget to open SSH in rc.firewall for yourself.
It's time to try.
For a one-time boot into the new system, we will use nextboot. This is a very good program that allows you to boot with another kernel / world ONE time. If the server is rebooted, our old system will boot again.
nextboot -D
nextboot -o vfs.root.mountfrom = ufs: / dev / ad2s1d -k kernel.test The
-D switch resets the nextboot configuration if it already existed. -o vfs.root.mountfrom indicates where the root partition is located. Naturally, instead of ad2s1d, your second drive \ partition should be specified, not mine, and -k is the path to the kernel relative to / boot /.
Last checklist:
- Check if the world and core are installed in the right places.
- Check if the configuration files were transferred SSHd, rc.conf, passwd, shadow ...
- Let's check if the network settings were transferred - resolv.conf, IP alias (if any), again rc.conf
- Check if / etc / fstab is migrated and fixed under the new system.
- Check the presence and contents of /boot/nextboot.conf
- Pray (depending on religiosity).
If all the points are completed - sudo shutdown -r now
If you did everything correctly, and you were a bit lucky and the system didn’t throw the feint with your ears, we will see working amd64 FreeBSD :)
If we didn’t see it on the network in a few minutes, we reboot the server via remote power management and look for where we made a mistake :) It
remains only to rebuild all the software you need.