# Upgrading from CrushBalance 11

## What carries over

At its first start CrushBalance 27 imports the CrushBalance 11 `prefs.XML` as far as it has the settings:
- **Imported:** every listener (address, port or port range, on or off) with its endpoints (host, port, weight, health-check interval, the PROXY v1 header), the global and per-endpoint IP restrictions (same order, same evaluation), the registration, the admin port and address, the log size, and the GeoIP key. A listener whose endpoints terminated TLS becomes a `tls` listener (with the CrushBalance 11 TLS versions CrushBalance 27 supports and its generated certificate); IP stickiness, a Prometheus check (as an HTTP health check) and a Prometheus metric (`metric` balancing) carry over too.
- **Not imported:** the admin password (finish the admin setup), keystore passwords (set the keystores again), the log file name (CrushBalance 27 writes `CrushBalanceServer.log`), nearest- endpoint routing, HTTP header redirects and settings CrushBalance 27 does not have. Anything CrushBalance 27 rejects is left out: an endpoint or listener it does not accept, and an IP restriction list it cannot read, which then denies every client, as it did in CrushBalance 11.
- Each setting that was not imported is listed in the log (`not imported from the v11 prefs.XML: …`).
- Settings mean what the CrushBalance 27 documentation says, even where a name looks like a CrushBalance 11 name.

## Before the swap

- Have the CrushFTP 11 Enterprise registration ready, in case it needs entering again.
- Copy the CrushBalance 27 jar to the host under another name and run, in the install folder: `java -jar CrushBalance27.jar -check-config` (Java 25 or newer). On a CrushBalance 11 `prefs.XML` it prints `[FATAL] …/prefs.XML is not a CrushBalance 27 file. …` and `Result: not a CrushBalance 27 file.`, with exit code 3. It never writes anything.
- Confirm Java 25 or newer for the Windows service. On Linux the CrushBalance 27 script finds Java itself, and downloads one when the host has no Java 21 or newer ([Install on Linux](Install-Linux.md)).

## Upgrade in place

1. Stop CrushBalance 11 (`systemctl stop crushbalance` on a systemd host, otherwise `./crushbalance_init.sh stop`; on Windows remove the CrushBalance 11 service with the CrushBalance 11 jar's `-r`) and replace `CrushBalance.jar`. On Linux, also replace `crushbalance_init.sh` with the CrushBalance 27 copy and set `CRUSH_DIR` and `CRUSH_USER` in it. Then, as root, run `./crushbalance_init.sh uninstall` and `./crushbalance_init.sh install`: that replaces the service the CrushBalance 11 script registered with the new one ([Install on Linux](Install-Linux.md)) and starts CrushBalance.
2. On Windows, run `java -jar CrushBalance.jar -i [heapMB]` in the install folder ([Install on Windows](Install-Windows.md)). It installs the service "CrushBalance Server" and starts it.
3. Start it (Linux: the `install` of step 1 already did). Then do the admin setup ([First-run setup](First-Run-Setup.md)), check the licence ([Registering](Registering.md)) and the imported listeners ([Listeners](Listeners.md)). The setup token is in `nohup.out` or the journal (Linux) or `service\wrapper.log` (Windows), and in `setup-token.txt`.

## What happens to the old `prefs.XML`

- At the first start it is imported ([What carries over](Upgrading.md#what-carries-over)) and then **renamed** to `prefs.XML.v1-<yyyyMMdd-HHmmss>.bak` in the same folder (local date and time; `-2`, `-3` … before `.bak` if the name exists), mode 0600 on Linux.
- A WARN goes to the log and stderr: "prefs.XML in … was a CrushBalance 11 configuration. It was imported as far as CrushBalance 27 has its settings (…) and moved to …". The admin UI shows it as a dismissible banner.
- A `prefs.XML` that is not a CrushBalance 11 file either is moved aside **unread** in the same way, with "prefs.XML in … is not a CrushBalance 27 configuration. It was NOT read or imported and was moved to …", and CrushBalance 27 starts with a new, empty configuration.
- CrushBalance 27 never reads, changes or deletes the moved file again.
- It may contain old passwords and the registration: **delete it, or archive it securely.**
- If it is copied back as `prefs.XML` while CrushBalance 27 runs, the running configuration is kept, a banner reports the invalid file, and saves are refused (409) until you fix it: copy the newest `backup/prefs-….XML` over `prefs.XML`. At the next start CrushBalance enters **safe mode** instead (CORRUPT, `PREFS_VERSION_BAD`, because CrushBalance 27 backups exist): restore a backup in the UI or by copying one over `prefs.XML` ([Operating](Operating.md)). Deleting the file instead starts a new, empty configuration.

## Other CrushBalance 11 leftovers

- The CrushBalance 11 `CrushBalance.log` and `CrushBalance1.log` … `CrushBalanceN.log` are never touched: CrushBalance 27 writes `CrushBalanceServer.log`, and its log-file guard refuses any file that does not start with a CrushBalance 27 log line. Archive or delete them when you no longer need them.
- Everything else from CrushBalance 11 is ignored; delete it when you no longer need it: `prefs.XML.new`, `ui/`, `lib/ui.zip`, `city.mmdb` and GeoLite files, `service\elevate.exe`, `CrushFTPService32.exe`, old keystores.
