# 03. Setup VM replication tasks

Now that you have setup the datastore on your PBS host you can start connecting it to your PVE system.

1. On the PBS you click on your datastore &gt; Show connection information and keep the tab open s.t you can copy paste it to your PVE you want to backup.
2. Then open your PVE and go to Datacenter &gt; Storage &gt; +Add and select Proxmox Backup server
3. Fill in the credentials of your backup server that you gathered at 1.
4. Then add it and done !!

Sweet the pbs is now connected so now we can set up some backup tasks to the VM's you wan to back up.

1. Go to Datacenter &gt; Backup &gt; + Add

Backup Job

Retention Period

After you have set when you want to take backups you need to set how long you want to keep your backups. If you don't set a <span class="font-semibold">retention period for Proxmox backup jobs</span>, backups will accumulate indefinitely, potentially leading to excessive storage use and making it difficult to manage backup data effectively. Now there are different retention variables that can all be found on the [Proxmox Wiki](https://pve.proxmox.com/wiki/Backup_and_Restore) page. For instance

**`<span class="monospaced">keep-last <N>: </span>`**`<span class="monospaced">Keep the last </span>``<span class="monospaced"><N> backups</span>`

`<span class="monospaced"><strong>keep-hourly <N>:</strong> </span>`Keep backups for the last `<span class="monospaced"><N></span>` hours. If there is more than one backup for a single hour, only the latest is kept.

`<span class="monospaced"><strong>keep-daily <N>:</strong> </span>`Keep backups for the last `<span class="monospaced"><N></span>` days. If there is more than one backup for a single day, only the latest is kept.

`<span class="monospaced"><strong>keep-weekly <N>:</strong> </span>`Keep backups for the last `<span class="monospaced"><N></span>` weeks. If there is more than one backup for a single week, only the latest is kept.

Now, you need to set

## <span>How</span> <span>Many</span> <span>Hourly</span> <span>Backups</span> <span>to</span> <span>Keep?</span>

<span>The</span> <span>right</span> <span>value</span> <span>depends</span> <span>on</span> <span>your</span> <span>needs:</span>

- <span class="font-semibold"><span>keep-hourly:</span> <span>24</span></span> <span>—</span> <span>Keep</span> <span>the</span> <span>last</span> <span>24</span> <span>hours</span> <span>of</span> <span>backups</span> <span>(one</span> <span>per</span> <span>hour).</span> <span>This</span> <span>is</span> <span>a</span> <span class="font-semibold"><span>common</span> <span>choice</span></span> <span>for</span> <span>high-availability</span> <span>or</span> <span>critical</span> <span>systems.</span>
- <span class="font-semibold"><span>keep-hourly:</span> <span>48</span></span> <span>—</span> <span>Keep</span> <span>the</span> <span>last</span> <span>2</span> <span>days</span> <span>of</span> <span>hourly</span> <span>backups</span> <span>for</span> <span>more</span> <span>granular</span> <span>recovery</span> <span>options.</span>
- <span class="font-semibold"><span>keep-hourly:</span> <span>6</span></span> <span>—</span> <span>Keep</span> <span>only</span> <span>the</span> <span>last</span> <span>6</span> <span>hours</span> <span>if</span> <span>you</span> <span>want</span> <span>minimal</span> <span>storage</span> <span>overhead.</span>

## <span>Which</span> <span>Daily</span> <span>Backup</span> <span>Gets</span> <span>Kept?</span>

<span>The</span> <span>backup</span> <span>that's</span> <span>retained</span> <span>as</span> <span>your</span> <span>"daily"</span> <span>backup</span> <span>is</span> <span class="font-semibold"><span>typically</span> <span>the</span> <span>most</span> <span>recent</span> <span>one</span> <span>from</span> <span>that</span> <span>day</span></span><span>—but</span> <span>the</span> <span>exact</span> <span>one</span> <span>depends</span> <span>on</span> <span>when</span> <span>pruning</span> <span>runs.</span>

<span class="font-semibold"><span>Example</span> <span>scenario</span></span> <span>with</span> <span>hourly</span> <span>backups:</span>

- <span>Backups</span> <span>created</span> <span>at:</span> <span>1</span> <span>AM,</span> <span>2</span> <span>AM,</span> <span>3</span> <span>AM,</span> <span>...,</span> <span>11</span> <span>PM</span> <span>every</span> <span>day</span>
- <span>When</span> <span>pruning</span> <span>runs,</span> <span>it</span> <span>usually</span> <span>keeps</span> <span>the</span> <span class="font-semibold"><span>latest</span> <span>backup</span> <span>from</span> <span>each</span> <span>24-hour</span> <span>period</span></span>
- <span>So</span> <span>the</span> <span class="font-semibold"><span>11</span> <span>PM</span> <span>backup</span></span> <span>from</span> <span>7</span> <span>days</span> <span>ago</span> <span>would</span> <span>be</span> <span>kept</span> <span>as</span> <span>your</span> <span>"daily"</span> <span>representative</span>

---

## <span>The</span> <span>Real</span> <span>Benefit</span>

<span>With</span> <span>hourly</span> <span>backups</span> <span>and</span> `keep-daily=7`<span>,</span> <span>you</span> <span>actually</span> <span>get</span> <span class="font-semibold"><span>much</span> <span>better</span> <span>recovery</span> <span>granularity</span></span> <span>than</span> <span>traditional</span> <span>daily</span> <span>backups:</span>

- <span>You</span> <span>have</span> <span class="font-semibold"><span>all</span> <span>hourly</span> <span>backups</span> <span>from</span> <span>the</span> <span>last</span> <span>1</span> <span>day</span></span> <span>(keep-hourly:</span> <span>24)</span>
- <span>Plus</span> <span class="font-semibold"><span>one</span> <span>backup</span> <span>per</span> <span>day</span> <span>for</span> <span>the</span> <span>previous</span> <span>6</span> <span>days</span></span> <span>(keep-daily:</span> <span>7)</span>
- <span>Plus</span> <span>your</span> <span class="font-semibold"><span>4</span> <span>weekly</span> <span>and</span> <span>1</span> <span>monthly</span></span> <span>backup</span>

<span>This</span> <span>means</span> <span>you</span> <span>can</span> <span>recover</span> <span>to</span> <span class="font-semibold"><span>any</span> <span>hour</span></span> <span>for</span> <span>the</span> <span>last</span> <span>day,</span> <span>and</span> <span class="font-semibold"><span>any</span> <span>day</span></span> <span>for</span> <span>the</span> <span>last</span> <span>7</span> <span>days—far</span> <span>better</span> <span>than</span> <span>just</span> <span>having</span> <span>one</span> <span>backup</span> <span>per</span> <span>day.</span>

With the `<span class="monospaced">prune-backups</span>` option you can specify which backups you want to keep in a flexible manner.

<div class="paragraph" id="bkmrk--1"></div>The following retention options are available:

<div class="dlist" id="bkmrk-keep-all-%3Cboolean%3E-k"><dl><dt class="hdlist1">`<span class="monospaced">keep-all <boolean></span>`</dt><dd>Keep all backups. If this is `<span class="monospaced">true</span>`, no other options can be set.

</dd><dt class="hdlist1">`<span class="monospaced">keep-last <N></span>`</dt><dd>Keep the last `<span class="monospaced"><N></span>` backups.

</dd><dt class="hdlist1">`<span class="monospaced">keep-hourly <N></span>`</dt><dd>Keep backups for the last `<span class="monospaced"><N></span>` hours. If there is more than one backup for a single hour, only the latest is kept.

</dd><dt class="hdlist1">`<span class="monospaced">keep-daily <N></span>`</dt><dd>Keep backups for the last `<span class="monospaced"><N></span>` days. If there is more than one backup for a single day, only the latest is kept.

</dd><dt class="hdlist1">`<span class="monospaced">keep-weekly <N></span>`</dt><dd>Keep backups for the last `<span class="monospaced"><N></span>` weeks. If there is more than one backup for a single week, only the latest is kept.

</dd></dl></div><div class="admonitionblock" id="bkmrk-weeks-start-on-monda"><table><tbody><tr><td class="icon">![Note](https://docs.rfeyn.org/uploads/images/gallery/2026-07/scaled-1680-/oonmmeAUI495nSmD-embedded-image-fgs4cdqm-png.png)</td><td class="content">Weeks start on Monday and end on Sunday. The software uses the `<span class="monospaced">ISO week date</span>`-system and handles weeks at the end of the year correctly.</td></tr></tbody></table>

</div><div class="dlist" id="bkmrk-keep-monthly-%3Cn%3E-kee"><dl><dt class="hdlist1">`<span class="monospaced">keep-monthly <N></span>`</dt><dd>Keep backups for the last `<span class="monospaced"><N></span>` months. If there is more than one backup for a single month, only the latest is kept.

</dd><dt class="hdlist1">`<span class="monospaced">keep-yearly <N></span>`</dt><dd>Keep backups for the last `<span class="monospaced"><N></span>` years. If there is more than one backup for a single year, only the latest is kept.

</dd></dl></div>The retention options are processed in the order given above. Each option only covers backups within its time period. The next option does not take care of already covered backups. It will only consider older backups.

Specify the retention options you want to use as a comma-separated list, for example: