Skip to content

Server drain and placement ​

This page explains how the panel chooses a server for new accounts (automated placement) and how to empty one server step by step (server drain). It is written for admins and technicians.

Both build on capacity rules and moving between servers.

Automated placement ​

When a new account is created without choosing a server, the panel picks one itself.

  • In the Create account form, choose Automatic (least loaded) in the Server field.
  • Billing that creates accounts without a serverId also uses automatic placement.

Servers considered ​

A server is only chosen when it:

  • is active and not in maintenance mode;
  • passes every capacity rule after this account is added, using its package limits;
  • does not already have an account with the same username;
  • is not marked Exclude from automatic placement in its capacity rules.

Servers excluded from automatic placement can still be chosen manually or picked explicitly as a drain target.

Score ​

Among the servers that pass, the panel picks the lowest score. The score is the highest relative load after the account is placed: 0 means empty, 1 means exactly at the limit.

ComponentHow it is computedWhen the rule is empty
Accounts(accounts + 1) ÷ account limitNot counted
RAM(allocated + package RAM limit) ÷ physical RAM ÷ RAM oversell limitTreated as 300%
Disk quota(allocated + package quota) ÷ disk size ÷ disk oversell limitTreated as 100%
Disk usedUsage % ÷ (100 − minimum free disk)Treated as 90%
InodesUsage % ÷ inode limitTreated as 90%

Adjustments:

  • Servers without health data get an extra 0.5, because their capacity is not known yet.
  • During a drain, servers with a different isolation driver than the source server get an extra 1. Accounts on a generic server go to another generic server first.
  • On a tie, the server with fewer accounts is chosen.

If no server passes, account creation is refused with the reasons per server.

Placement preview

The API GET /v1/capacity/placement?packageId=PACKAGE_ID&username=jane shows the server that would be chosen and the scores of all candidates, without creating anything.

Server drain ​

A drain empties one server, for example before replacing hardware or shutting the server down:

  1. The server enters maintenance mode, with a reason starting with drain:.
  2. Every active and suspended account is moved, one by one, to the least loaded server that meets the capacity rules.

Each move uses the same process as moving between servers: data is copied, the account is switched over, and DNS in panel zones is pointed to the new server.

Preparing a drain ​

  1. Open Servers › (server) › Settings › Danger zone.

  2. On the Drain server row, click Review drain.

  3. Fill in the options:

    FieldNotes
    Destination serversRestrict the targets. Choosing none means every server open to automatic placement.
    Moves at a time1 to 3.
    Delete old copiesDelete the old copy right after each successful move. If unticked, old copies are suspended to clean up later.
    ReasonRequired, for example hardware replacement.
  4. Click Preview plan.

Reading the plan ​

The plan shows each account with its target and notes. The summary shows how many are ready, blocked, and skipped.

  • Placement is computed cumulatively. Every planned account adds to its target's allocation, so accounts spread out according to the room left.
  • For each account, the panel runs a dry-run of the move and shows its blockers, for example email or FTP not yet set up on the target.
  • If the first target is blocked, the next candidate is tried. If all are blocked, the account gets the Blocked status with the reason.
  • Accounts that are being created or terminated get the Skipped status.

If you change the options, click Refresh plan.

Starting the drain ​

  1. Type the server's hostname to confirm.
  2. Click Start drain (N accounts).

The button is only enabled once there is a plan. If things changed since the plan was made, for example a new account was added, the panel refuses and shows the latest plan. A server can only have one active drain.

Impact on clients

Each move copies files and then switches the account over. Sites with external DNS need to be repointed manually to the new server. Tell clients whose domains do not use the panel's DNS before the drain starts.

While the drain runs ​

The drain status is shown in Settings › Danger zone, below the Drain server row:

  • the drain status: Draining, Paused, or Completed;
  • progress and start time;
  • a per-account table: target, status, job link, and error.

Per-account statuses:

StatusMeaning
WaitingNot its turn yet.
MovingBeing moved.
MovedDone.
FailedThe move failed. The account stays on the source server.
BlockedNo target can accept it.
SkippedSkipped.
CancelledThe drain was cancelled before its turn.

When each account's turn comes, the panel re-evaluates:

  • accounts that already moved, were deleted, or changed status are skipped;
  • the planned target is used if it still meets the capacity rules;
  • if not, or if the move is refused, other candidates are tried, at most 3.

Pause, resume, and cancel ​

ButtonResult
PauseStarts no new moves. Moves in progress are finished.
ResumeContinues the drain.
CancelWaiting accounts become Cancelled and stay on this server. Moves in progress are finished.

A move that is already running cannot be stopped, not even from Jobs, because its rollback runs in the same job. See Moving between servers.

Every drain action is recorded in the audit log. Each move is also recorded as an account move by the system.

After the drain finishes ​

The drain is marked Completed even when some accounts failed. Failed accounts stay on the source server with their reasons recorded.

  1. Check the Failed or Blocked accounts. Fix the cause, then move them manually through moving between servers.
  2. If old copies were suspended, delete them after DNS has moved: open each account, then Delete old copy in the Server moves section.
  3. The server stays in maintenance mode. Turn it off in Settings › Capacity & maintenance if the server may accept accounts again.
  4. If the server will be shut down, remove the server once no accounts are left.

DANGER

Do not shut down the source server before the old copies are no longer needed. Email that arrived at the old server during DNS propagation only exists there.

See also ​

MoorCP Shared, a shared hosting panel for server fleets.