# Delete files from rdiff-backup

We have a system running that uses rdiff-backup for its backups. However, the backup partition is out of space, so we’ll need to re-examine the situation. We do need a permanent solution, but until that time, we simply need to free up some space on the backup partition.

I have located a number of files that we can remove*, but I wonder how I should do this. The first step would of course be to remove the files from the actual file system. However, next I would need to delete it from the backups (that’s where we need the space), but I have no idea how to go about that. Does anybody have an idea how to do this?

*someone – long out of office – who had games and personal photos in his home directory, multiple copies of virtual hard disks

Server Fault Asked on November 22, 2021

The official github repository for rdiff-backup now has a script to do this:

https://github.com/rdiff-backup/rdiff-backup/blob/master/src/rdiff-backup-delete

The script referenced in the other answers does not seem to be available any more.

Answered by medoc on November 22, 2021

it appears somebody made a script doing the above steps https://www.eugenemakerspace.com/wiki/Sites/Rdiff-backup-delete

I didn't test it, but choose a 'saver' way by deleting all files which are already gone voor 2 weeks, by running

rdiff-backup --remove-older-than 2W host.net::/remote-dir


more example http://www.nongnu.org/rdiff-backup/examples.html

Answered by varta on November 22, 2021

The process for dealing with deletions when you've run out of space is described in the unofficial FAQ under How do I remove files from the backup set. Repeating here just for completeness.

This method is very dangerous and shouldn't be used, unless the files that you want to remove are causing your backup drive to run out of space and your only alternative to removing those files is removing entire increments.

IMPORTANT: Properly speaking, you should do step 4 for every increment of mirror_metadata. Rdiff-backup prior to 1.1.1 does not mind having extra mirror_metadata entries for files that are removed from the backup set this way, except in the most recent version of mirror_metadata. However, at 1.1.1 the mirror_metadata handling changed -- rdiff-backup now diffs the metadata files -- and it's unknown whether having extra entries in these diff'd files will affect restore operations. (Technical note: the mirror_metadata diffs are NOT using the same method as file diffs. They are not rdiff delta files, but plain text files (and no, they are not ordinary text diffs either). Because of this, it is safe to hand-edit them, so if you need to you can do step 4 on these diffs.)

1. Check the time -- make sure it is not close to time for a scheduled run of rdiff-backup. Also make sure rdiff-backup is not running.

2. Go into your mirror target directory and delete the file or directory there.

3. Go into rdiff-backup-data/increments on the target and delete all traces of the file/directory there. Important! If you are removing a directory, make sure you find and remove all of the *.dir files for it as well! If it's a file, make sure you find and remove all of the *.missing files (if there are any). Be careful not to remove anything that isn't related to the thing you're trying to remove, or you might lose the ability to restore other files.

4. Important step! (and WARNING this is untested with rdiff-backup 1.1.1 or later) Go back up into rdiff-backup-data and gunzip the latest mirror-metadata file. Edit the mirror_metadata file in a well-behaved text editor (WARNING! Do not use pico or nano or anything else that might automatically do line wrapping!) and remove all references to the file or directory you deleted. Be very careful not to mess up the format of the file.

Answered by Dan Carley on November 22, 2021

## Related Questions

### IPFIX collector with extension support

3  Asked on August 24, 2020 by oonska

### cannot access hdfs even though hadoop is (apparently) installed on CentOS server

0  Asked on August 23, 2020 by con

### how do I change realm login format in sssd?

1  Asked on August 23, 2020 by andrew

### Access static web-server through managed switch

2  Asked on August 21, 2020 by imperialcode

### Postgres Docker- How to enable postgres docker to allow remote connections?

1  Asked on August 19, 2020 by qwang07

### Remote Desktop Connection Screen is totally black but server is working perfectly

14  Asked on August 17, 2020 by monstermmorpg

### URL rewrite in IIS 8.5 is not working I’m getting 404 instead

1  Asked on August 16, 2020 by jack-the-ripper

### Set Stackdriver severity based on textPayload

1  Asked on August 13, 2020 by goldstein

### nginx + php 5.6 serving empty pages, can’t find error log

1  Asked on August 10, 2020 by john-moore

### Using CNAME with MX record isntead of Nameservers?

0  Asked on August 8, 2020 by austin-jones

### How to limit memory usage by application in linux?

4  Asked on August 7, 2020 by edomaur

### Tool to maintain IBM x3650

0  Asked on August 7, 2020 by frantiseknebojsa

### ansible register on template is not working

1  Asked on August 6, 2020 by boaz

### inactive option not working for pam_lastlog.so

1  Asked on August 5, 2020 by jakov-sosic

### Stopping IPTables is the only way to make Kubernetes cluster work

1  Asked on August 2, 2020 by user2405589

### IPVS transmitting packets to incorrect backends

0  Asked on August 1, 2020 by vignesh-sp

### htaccess rewrite for language subdomains

2  Asked on July 28, 2020 by ffish

### Curl to host and port not working from inside Docker container

0  Asked on July 26, 2020 by bhanu-praveen-g

### rsync unexpected remote arg: [email protected]:/path

2  Asked on July 21, 2020 by pdiracdelta