summaryrefslogtreecommitdiffstats
path: root/content/posts/removing-large-files-borg.md
diff options
context:
space:
mode:
authorbreadcat2022-11-20 13:30:37 +0000
committerbreadcat2022-11-20 13:30:37 +0000
commit8cce374e1d60c87db2fce4bb89ecb9e931b6983d (patch)
tree1680341fd6eb007535b0fc005936e35e21bcbac3 /content/posts/removing-large-files-borg.md
parent8685a45df902dd97df993c6f1ecbccdad9a7fc00 (diff)
downloadblog.minskio.co.uk-8cce374e1d60c87db2fce4bb89ecb9e931b6983d.tar.gz
blog.minskio.co.uk-8cce374e1d60c87db2fce4bb89ecb9e931b6983d.tar.bz2
blog.minskio.co.uk-8cce374e1d60c87db2fce4bb89ecb9e931b6983d.zip
Additional blog post
Diffstat (limited to 'content/posts/removing-large-files-borg.md')
-rw-r--r--content/posts/removing-large-files-borg.md36
1 files changed, 36 insertions, 0 deletions
diff --git a/content/posts/removing-large-files-borg.md b/content/posts/removing-large-files-borg.md
new file mode 100644
index 0000000..33dac4a
--- /dev/null
+++ b/content/posts/removing-large-files-borg.md
@@ -0,0 +1,36 @@
+---
+title: "Removing large files from a Borg backup"
+date: 2022-10-28T15:30:00
+tags: ["Linux", "Infrastructure", "Recovery", "Snippets", "Software", "Servers"]
+---
+
+I have a couple of 'backup systems'. For important documents that change frequently I use [Borg](https://www.borgbackup.org/), along with the helper script [borgmatic](https://torsion.org/borgmatic/) with my hosting being provided by [BorgBase](https://www.borgbase.com/). The three all tie together incredibly well and if the free tier of BorgBase didn't cover my every need I'd happily pay for it.
+
+Occasionally however, I'll end up temporarily storing a large file in a directory that will be backed up on schedule which then increases my overall storage usage unnecessarily. The simple fix for this is just to delete the backups which contain the file.
+
+The guide assumes you already have a working Borgmatic setup.
+
+Firstly, you can find the details of your repository using:
+```
+borgmatic info
+borgmatic rlist
+```
+
+If you don't remember the ID or date, you can narrow down the point when the large file got added by mounting the backup repository and searching by size using something like `ncdu`:
+```
+mkdir borg_mount
+borgmatic mount --mount-point borg_mount/
+ncdu borg_mount
+```
+
+You'll want to unmount the repository before you try to delete anything, otherwise you'll get a lock error. This can be done via `umount borg_mount`.
+
+Once you know the ID (or ID's) affected, you can issue the [arbitary delete command](https://torsion.org/borgmatic/docs/how-to/run-arbitrary-borg-commands/), for example:
+```
+borgmatic borg delete host-dateTtime
+```
+
+Once this has been done, you can compact your repository, then you should be done.
+```
+borgmatic compact
+``` \ No newline at end of file