Add Backup & Restore

the_minisip committed 2026-10-16 13:23:41 -03:00
1 parent 73070690cb
commit 3663ca2735
1 file changed
+227
+227
@@ -0,0 +1,227 @@
<h1><strong>Backup & Restore</strong></h1>
<p>
This page explains how world backups work in the
<strong>Managed Valheim</strong> server, including both the container’s
automated backup system and Valheim’s own internal rolling backup mechanism.
Together, these provide multiple layers of protection for your world data.
</p>
<hr>
<h2><strong>1. Overview</strong></h2>
<p>
The Managed Valheim server provides two independent backup systems:
</p>
<ul>
<li><strong>Container-managed backups</strong> — configurable interval,
timestamped ZIP archives, automatic pruning.</li>
<li><strong>Valheim internal rolling backups</strong> — built-in game
mechanism that keeps up to 5 rotating world snapshots.</li>
</ul>
<p>
Understanding both systems ensures safe restores and reliable world recovery.
</p>
<hr>
<h2><strong>2. Valheim’s Internal Rolling Backup System</strong></h2>
<p>
Valheim automatically maintains a set of rolling backups for each world. These
backups are stored alongside the main world files and are created by the game
itself during save operations.
</p>
<p>
Internal backups are located here:
</p>
<pre><code>/root/.config/unity3d/IronGate/Valheim/worlds_local/&lt;WORLD_NAME&gt;</code></pre>
<p>
Inside this directory, you will see files such as:
</p>
<ul>
<li><code>&lt;WORLD_NAME&gt;.db</code> — primary world database</li>
<li><code>&lt;WORLD_NAME&gt;.fwl</code> — world metadata</li>
<li><code>&lt;WORLD_NAME&gt;_1.db</code></li>
<li><code>&lt;WORLD_NAME&gt;_2.db</code></li>
<li><code>&lt;WORLD_NAME&gt;_3.db</code></li>
<li><code>&lt;WORLD_NAME&gt;_4.db</code></li>
<li><code>&lt;WORLD_NAME&gt;_5.db</code></li>
</ul>
<p>
Valheim rotates these files automatically, keeping the last 5 save states.
These backups are <strong>not compressed</strong> and <strong>not pruned</strong>
by the container — they are fully managed by the game.
</p>
<p>
You can restore from these internal backups by replacing the main
<code>.db</code> and <code>.fwl</code> files with one of the numbered versions.
</p>
<hr>
<h2><strong>3. Container-Managed Backup System</strong></h2>
<p>
In addition to Valheim’s internal backups, the container provides a
configurable backup system that creates timestamped ZIP archives of the entire
world directory.
</p>
<p>
Backups are stored in:
</p>
<pre><code>/backups</code></pre>
<p>
Each backup follows this naming format:
</p>
<pre><code>&lt;WORLD_NAME&gt;_YYYY-MM-DD_HH-MM-SS.zip</code></pre>
<hr>
<h2><strong>4. Backup Configuration</strong></h2>
<p>
Configure backup behavior using environment variables:
</p>
<table>
<thead>
<tr>
<th>Variable</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>BACKUP_INTERVAL</code></td>
<td>21600</td>
<td>Backup interval (seconds). Default is 6 hours.</td>
</tr>
<tr>
<td><code>BACKUP_RETENTION_DAYS</code></td>
<td>7</td>
<td>Days to retain backups before pruning.</td>
</tr>
</tbody>
</table>
<p>
These values can be changed at any time without rebuilding the container.
</p>
<hr>
<h2><strong>5. Backup Creation Process</strong></h2>
<p>
During each backup cycle, the container:
</p>
<ol>
<li>Locates the world directory</li>
<li>Creates a ZIP archive in <code>/backups</code></li>
<li>Logs the backup creation</li>
<li>Prunes backups older than <code>BACKUP_RETENTION_DAYS</code></li>
</ol>
<p>
This process runs in the background and does not interrupt gameplay.
</p>
<hr>
<h2><strong>6. Restoring a World</strong></h2>
<h3><strong>Option A — Restore from Container Backup (Recommended)</strong></h3>
<ol>
<li>Stop the TrueNAS SCALE app.</li>
<li>Extract the desired ZIP file from <code>/backups</code>.</li>
<li>Copy the extracted world directory into:<br>
<code>/root/.config/unity3d/IronGate/Valheim/worlds_local/&lt;WORLD_NAME&gt;</code>
</li>
<li>Ensure filenames match the world name exactly.</li>
<li>Start the TrueNAS SCALE app.</li>
</ol>
<h3><strong>Option B — Restore from Valheim’s Internal Rolling Backups</strong></h3>
<p>
If you prefer to use Valheim’s built-in backups:
</p>
<ol>
<li>Stop the TrueNAS SCALE app.</li>
<li>Navigate to:<br>
<code>/root/.config/unity3d/IronGate/Valheim/worlds_local/&lt;WORLD_NAME&gt;</code>
</li>
<li>Choose one of the numbered backups (e.g., <code>_3.db</code>).</li>
<li>Replace:<br>
<code>&lt;WORLD_NAME&gt;.db</code><br>
<code>&lt;WORLD_NAME&gt;.fwl</code><br>
with the corresponding numbered versions.</li>
<li>Start the TrueNAS SCALE app.</li>
</ol>
<p>
The server will load the restored world automatically.
</p>
<hr>
<h2><strong>7. Best Practices</strong></h2>
<ul>
<li>Use container backups for long-term retention.</li>
<li>Use Valheim’s internal backups for quick rollbacks.</li>
<li>Always stop the server before restoring files.</li>
<li>Keep multiple container backups before major mod changes.</li>
</ul>
<hr>
<h2><strong>8. Troubleshooting</strong></h2>
<h3><strong>No Backups Are Appearing</strong></h3>
<ul>
<li>Verify the <code>/backups</code> volume is mounted.</li>
<li>Check container logs for backup messages.</li>
<li>Ensure <code>BACKUP_INTERVAL</code> is set correctly.</li>
</ul>
<h3><strong>Backups Are Not Being Pruned</strong></h3>
<ul>
<li>Verify <code>BACKUP_RETENTION_DAYS</code> is set.</li>
<li>Check file permissions on the backup directory.</li>
</ul>
<hr>
<h2><strong>Next Steps</strong></h2>
<ul>
<li><a href="Home">Home</a></li>
<li><a href="Quick Start">Quick Start</a></li>
<li><a href="Installation">Installation</a></li>
<li><a href="Modding Guide">Modding Guide</a></li>
<li><a href="Troubleshooting">Troubleshooting</a></li>
</ul>
<p>
With both backup systems available, your Valheim world is protected against
corruption, mod issues, and accidental loss.
</p>