docs(block): preserve existing master state when changing filesystems

This commit is contained in:
pingqiu committed 2026-12-05 13:38:59 -08:00
1 parent 960a914281
commit f994664614
2 files changed
+16 -1

No files matched your search

+15
View File
@@ -126,6 +126,21 @@ isolates the startup syncs; run `sync` after creating and mounting it. This comm
entry on its parent filesystem. A failed device lookup logs a fallback to the full ancestor walk. See
[directory recovery](design/lifecycle-directory-sync.md).
**Do not mount an empty filesystem over existing blockmaster state.** It hides the authority and lifecycle
stores beneath the mount, and starting blockmaster there can create a separate state history. For a new install,
create and mount the state filesystem before the first start. To migrate an existing installation:
1. Stop blockmaster with `sudo systemctl stop sw-blockmaster` and keep it stopped throughout the migration.
2. Mount the new filesystem at a temporary location. Copy the entire existing state directory onto it,
preserving file contents, ownership, permissions and directory structure, including hidden files.
3. Verify the copy against the stopped source, then unmount the temporary location. Retain the original state
until the migration has been verified; do not initialize an empty replacement store.
4. Mount the copied filesystem at the configured state directory, verify that it contains the copied authority
and lifecycle stores and their permissions, and run `sync`. Configure the mount to be present before the unit
starts, including after reboot.
5. Start blockmaster with `sudo systemctl start sw-blockmaster` and verify that it reloads the existing records.
If verification fails, keep it stopped and correct the mount or copy before retrying.
Under heavy writes on the state filesystem, an `fsync` when blockmaster opens its state directory can wait for the
filesystem journal. In v1.1.2, startup also runs a `syncfs` for each store with changed import records on ext4, XFS,
btrfs or tmpfs (Linux 5.8 or later), which waits for every pending write on that filesystem, including any holders'
+1 -1
View File
@@ -6,4 +6,4 @@ v1.1.2 is not yet released.
- **Trigger:** blockmaster's state filesystem also holds heavy writes, such as the holders' local data.
- **Effect:** blockmaster's start syncs its state directories, which can wait for the filesystem journal. When the import has changed records, it also runs a `syncfs` for each store with changed records on ext4, XFS, btrfs or tmpfs (Linux 5.8 or later), which waits for every pending write on that filesystem, including the holders' data. Starts took from about 20 seconds to over 150 seconds in our tests (one start was not ready after 2 minutes); this is not an upper bound. A volume whose lease expires stops serving until blockmaster is back; it is then granted again on the same holder, with its data. A forced move during that time can lose writes after the last published HEAD (see [forced move](../volume-lifecycle.md#after-a-crash)).
- **What to do:** v1.1.2 stops the startup's ancestor sync at the state filesystem's boundary, so a dedicated state filesystem isolates the startup syncs; run `sync` after creating and mounting it. Keep holders' data off that filesystem; a different directory on it is not enough. Restart blockmaster at low write load on the state filesystem, including when the cluster spec has not changed. If device lookup fails, a logged fallback retains the full ancestor walk.
- **What to do:** v1.1.2 stops the startup's ancestor sync at the state filesystem's boundary, so a dedicated state filesystem isolates the startup syncs; run `sync` after creating and mounting it. For a new install, mount it before the first start. For existing state, stop blockmaster, copy all state to the new filesystem while preserving ownership and permissions, verify the copy, mount it at the configured state directory, verify the stores there, run `sync`, then start blockmaster. Never mount an empty filesystem over existing state and start against it: the mount hides the existing authority and lifecycle stores. Follow the [state migration steps](../operations-manual.md#1-install-the-binaries-and-units). Keep holders' data off that filesystem; a different directory on it is not enough. Restart blockmaster at low write load on the state filesystem, including when the cluster spec has not changed. If device lookup fails, a logged fallback retains the full ancestor walk.