How to exclude swapfile from rsync backup?

 To exclude a swapfile from an `rsync` backup, you can use the `--exclude` option. Here's the command to exclude the swapfile when running `rsync`:


```bash

rsync -av --exclude='/path/to/swapfile' source_directory/ destination_directory/

```


Replace `/path/to/swapfile` with the actual path to the swapfile you want to exclude. The `--exclude` option allows you to specify a file or directory that you want `rsync` to skip during the backup. In this case, it's used to exclude the swapfile from being copied to the destination directory.


Here's a breakdown of the command:


- `-a` (or `--archive`) is used to enable archive mode, which is ideal for backups as it preserves file permissions, ownership, timestamps, and more.

- `-v` (or `--verbose`) is for verbose output, so you can see the details of the backup.

- `source_directory/` is the source directory you want to back up.

- `destination_directory/` is the destination where you want to copy the files. Make sure to specify the trailing slashes to ensure that the contents of the source_directory are copied into the destination_directory.


After running this command, the swapfile specified in `--exclude` will be skipped during the backup process.

Comments

Popular posts from this blog

bad character U+002D '-' in my helm template

GitLab pipeline stopped working with invalid yaml error

How do I add a printer in OpenSUSE which is being shared by a CUPS print server?