# Moving a server to another machine

A CrushMFT server is its folder. To move it, you install the program on the new machine and bring the folder over. Users notice nothing if the name, the keys and the files come along.

## What moves

| | Where it is | Moves how |
|---|---|---|
| the server: settings, users, jobs, keys, records | the CrushMFT folder | by copying the folder |
| keys and keystores outside the folder | where your settings name them | by copying, to the same paths |
| the users' files | where the users' folders point | depends: see below |
| the server's name | DNS, or the load balancer | by pointing it at the new machine |
| Java | the machine | install it on the new one |

## Plan

1. **The users' files.** Three cases:
   - they are on a file server or in cloud storage: nothing moves. The new machine needs the same access: the same account for a file server, the same network path.
   - they are on a disk of the old machine: copy them. For much data, copy once ahead of time and again, only the changes, on the day.
   - they are on a disk that can be attached to the new machine: attach it.
2. **The paths.** If the files will be at the same paths on the new machine, no user has to be changed. If a path changes, every user's folder that names it must be corrected. Keeping the paths is worth some trouble. On a new operating system the paths change in any case: see below.
3. **The ports and the firewall.** The new machine needs the same ports open.
4. **The name.** Lower the time-to-live of the DNS record some days before, so that the switch is quick.

## The day

1. **Install on the new machine**: Java, and the same version of CrushMFT, unpacked but not started. [Install on Windows](Install-Windows.md), [Install on macOS](Install-macOS.md), [Install on Linux](Install-Linux.md).
2. **Stop the old server.** From now on nothing changes there.
3. **Copy the CrushMFT folder** from the old machine over the new installation's folder: everything except the starters that belong to the system (`CrushMFT.exe`, the `service` folder, `CrushMFT.app`, `crushmft_init.sh`), which the new installation already has in the right form.
4. **Copy outside keys** to the same paths.
5. **Bring the files**, or the last changes to them.
6. **Start the new server**, without the service at first: the control panel's temporary server, or `crushmft_init.sh start`.
7. **Check**: [Startup notices](Admin-Startup-Notices.md); a login as administrator; a login as a user, and their files; a job.
8. **Install the service** on the new machine: [The Windows service](Windows-Service.md), [The Linux service](Linux-Service.md). Set the memory: [Java and memory settings](Java-and-Memory.md).
9. **Point the name** at the new machine.
10. **Remove the service** on the old machine, so that it cannot start by accident.

Keep the old machine, stopped, for some days.

## What users see

Nothing, if these came along:

| | Or else |
|---|---|
| the **SSH host keys** (`ssh_host_*` in the folder) | every SFTP client warns that the server's key changed, and scripts stop |
| the **certificate** and its key | browsers warn |
| the **name** | everybody needs the new address |
| the **users** folder | nobody can log in |

They are all in the folder, or named by its settings: that is why the whole folder is copied.

## To another operating system

The folder works on every system. What differs:

| | |
|---|---|
| **paths** | a user's folder at `D:\data\acme\` does not exist on Linux. Every folder of every user that points at a local path must be changed: in the User Manager, or with the [API](API-Users.md) for many users. Folders in cloud storage or on other servers are not affected. |
| **upper and lower case** | Windows and macOS do not tell `Report.pdf` from `report.pdf`; Linux does. Users and scripts that were careless about case find files "missing". |
| **the account and rights** | on Linux, the account the server runs as must own the folder: [The Linux service](Linux-Service.md) |
| **paths of keystores and keys** in the settings | correct them in Preferences |
| **jobs that run programs** | the programs and their paths are the old system's |
| **ports below 1024** | free on Windows and macOS; on Linux only for root: [Install on Linux](Install-Linux.md#ports-below-1024) |
| **line ends and file names** in the users' files | copied as they are |

Try a move to another system on a copy first.

## To a newer version at the same time

Do one thing at a time. Move with the same version, see that it works, then update. Or update first, then move. For the step from version 11, see [Upgrading from CrushFTP 11](Upgrade-from-11.md).

## A second server instead of a move

If the reason for the move is that one machine is no longer enough, or must not be the only one, see [High availability](High-Availability.md): a second server that shares users and settings with the first.

## Things to know

- **Never run both** the old and the new server on the network at once with the same folder's keys: jobs would run twice, and in a cluster two servers would claim one identity.
- **The licence** is in the settings and moves with them. Whether your licence allows the old machine to stay as a spare is a question of the licence.
- **Jobs with schedules start as soon as the new server runs.** If the files are not there yet, disable schedules first, or bring the files first.
- **A virtual machine** can simply be moved whole. Then nothing on this page is needed but the name.

## Not tried for this page

A move between machines was not run for this page. That a copied CrushMFT folder starts as the same server was seen many times while this wiki was written, on one machine. A move between operating systems was not tried.
