Repository navigation
Conversation
Settings > Storage gets a Location section. Move storage… copies the runtime store to a folder the user picks, checks the copy's size, and replaces the default path with a symlink to the copy. The original is kept as a backup until the user deletes it. - StorageLocation moves and restores the store with a verified copy (ditto). Failures put the original back and remove the partial copy. - The move stops the daemon and restarts it on the new path with CONTAINER_APP_ROOT set. If the restart fails, the original is restored. - LaunchdManager.start accepts the environment for the daemon. - The symlink is followed by the CLI and the daemon, so no shell variable is needed. Logs are not moved yet.
- The Location section shows what the move is doing (stopping, copying, starting) and the result or the error. Before, a failed or skipped move showed nothing. - Folder sizes use allocated blocks. Logical sizes counted sparse disk images at their full length (4.41 TB for a store that uses about 500 MB). The copy check still compares logical sizes on both sides.
Sparse disk images report their full length as their size. The space check used that length, so a store of about 520 MB was reported as needing 4.8 TB. ditto keeps sparse files sparse, so the copy needs only the allocated bytes. The copy is still verified by logical size on both sides.
… the main thread - The copy uses rsync --sparse, which keeps holes in sparse disk images. ditto wrote a 550 GB sparse image out in full and filled the destination. - The copy is watched: if the space it occupies passes 1.5x the source's allocated bytes plus 64 MB, rsync is stopped and the move rolls back. - The copy result is checked against the same limit after it finishes. - The move runs on a background task, so the window stays responsive during a long copy.
rsync reads every byte of a sparse file to find its holes. The store has nine snapshot images of 513 GB each, holding about 40 MB of data apiece, so the copy ran for half an hour and copied 211 MB of 649 MB. bsdtar finds holes with SEEK_HOLE and does not read them. A real 513 GB snapshot copies in seconds with the same allocated size as the source. The copy is still watched against the allocation limit, and stopping it also stops the tar writing to that destination.
When the daemon failed to start on the new location, the original was put back but the copy stayed on the target disk. The next move then refused with "something already exists". The unused copy is now removed in the rollback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ditto, checks the size, and replaces the default path with a symlink. The daemon restarts withCONTAINER_APP_ROOTset to the new path.Test plan
swift test: copy and verify, rollback on copy failure, rollback on size mismatch, refusal of a missing destination and of an already-moved store, restore of the backup, and folder sizes (temporary folders only)Not included
paths.logRoot) are not moved.