An administrator can move one disk of a server to another storage of the same node: from the default storage to a new NVMe storage, from a file storage to an LVM-thin pool, and so on. The move is offline: the server is shut down while the disk is copied, then started again if it ran. Moving a whole server to another node is a different operation, covered in Moves and live migration.
Move a disk#
- Open the server and its Storage tab.
- Click Configure on the disk's row.
- Click Move…. If the button is greyed out, its reason is shown beside it (see When a move is refused).
- Choose the target Storage. Each one shows how many GB it has left; a storage without room for the disk is greyed out with the reason.
- Click Stop and move.
The dialog says how long the copy takes at SSD speed (about 6 minutes for 40 GB). While it runs the disk reads "Moving to another storage…" and the task shows the copy's progress.
Customers do not see the button or the storages. Through the API: POST /disks/{id}/move with {"storage": "<key>"} (administrators, scope servers:provision); see the API reference. The webhooks server.disk_moved and server.disk_move_failed go to administrators' endpoints.
What happens#
- The node checks everything first and changes nothing if a check fails: both storages can be written, the disk exists, and the target has room for what the copy needs plus a 10% reserve. The need is measured with
qemu-img measure: a compressed qcow2, such as a restored backup, grows when copied. - A running server is shut down (powered off if it does not stop in time).
- The disk is copied into the target storage in its own format, sparse, as a standalone file or volume, then checked.
- The server's definition is switched to the copy and read back.
- The server is started again if it ran.
- Only once the server runs on the copy is the old file removed.
If the server does not start on the copy, the disk is switched back to the old file (which nothing wrote to), the copy is removed, and the move fails with "the disk stays on the storage …". If the agent is stopped in the middle, it settles the move at its next start: a move not yet switched is taken back, one switched is finished. A server is never started on a file the settle would then remove.
Between storage kinds#
| From → to | |
|---|---|
| file ↔ file | yes |
| file ↔ LVM-thin | yes; a disk on a thin pool is raw, and stays raw when moved back to a file |
| file ↔ ZFS, LVM-thin ↔ ZFS | yes |
| LVM-thin → LVM-thin in the same volume group | refused (same volume group) |
| NFS shared storage | yes, as a file storage |
When a move is refused#
| Reason | What to do |
|---|---|
| The disk is in a snapshot | Disk 1 is in every snapshot, an extra disk in those taken while it was there. Delete those snapshots first: a copy would lose the blocks they share. |
| The server is suspended, in rescue, being moved to another node, or busy with another task | Wait or end that state first. |
| The target has no room | Raise the target's sell percent, grow it, or free space. |
| The node's agent is too old | Update it (see Agent updates on a node). |
| A storage of the server is unavailable | Bring it back first. |
Moving disks between nodes: only the data is sent#
When a whole server moves to another node, its disks are copied over the agents' migration port (8444). Between current agents the copy is a sparse stream: only the parts of a disk that hold data are sent, compressed, and the empty parts are recreated as holes on the target. An empty 50 GB disk crosses as a few bytes, and a disk with a few GB of data takes about as long as that data takes to send.
The copy is checked end to end: both nodes compute a checksum of the data only, so the zeros of a large, mostly empty disk are never hashed. A copy cut by a restart resumes where it stopped. Disks on LVM-thin, ZFS or Ceph are copied the same way (into a file on the target); disks on a shared storage both nodes use are not copied at all.
The Empty this node plan on a node's Maintenance tab estimates the copying time from the data last measured on the servers' disks, "only the data on the disks is sent, compressed". See Maintenance.