# Recompressing objects in repository

**URL:** <https://kopia.discourse.group/t/recompressing-objects-in-repository/1847>\
**Category:** Support\
**Created:** [March 5, 2023, 9:19pm UTC](https://kopia.discourse.group/t/recompressing-objects-in-repository/1847 "2023-03-05T21:19:51Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Jakoma02](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/jakoma02/32/631_2.png) [@Jakoma02](https://kopia.discourse.group/u/Jakoma02)\
**Post date:** [March 26, 2023, 5:03pm UTC](https://kopia.discourse.group/t/recompressing-objects-in-repository/1847/6 "2023-03-26T17:03:56Z")

</div>

I got around to trying `kopia snapshot migrate` and I can confirm it can be used for this purpose – the migrated snapshots indeed honor policy settings of the target repository, including compression settings.

To summarize, a repository can be recompressed including existing snapshots in the following way:

1. Create a repository config file for the existing repository, e.g. by making a copy of `<kopia-config-dir>/repository.config`
2. Create a new repository using `kopia repository create`
3. Set the compression method for the new repository using `kopia policy --global --compression <compression-method>` and optionally set other compression settings
4. Migrate snapshots from the original repository using `kopia snapshot migrate --all --source-config <path-to-orig-repo-config>`
5. _(Optional)_ Delete the original repository and move the newly created repository where the original repository was

---

_[View the full topic](https://kopia.discourse.group/t/recompressing-objects-in-repository/1847)._
