A newer version of this documentation is available.

View Latest

cbbackupmgr remove

    +

    Removes a backup repository from the backup archive

    SYNOPSIS

    cbbackupmgr remove [--archive <archive_dir>] [--repo <repo_name>]
                       [--backups <backup_range>]

    DESCRIPTION

    Removes a backup repository from the backup archive. All contents of the specified repository will be deleted from disk.

    OPTIONS

    Below are a list of parameters for the remove command.

    -a,--archive <archive_dir>

    The location of the archive directory.

    -r,--repo <repo_name>

    The name of the backup repository to remove.

    --backups <backup_range>

    This flag will take either a single backup directory (e.g 2019-08-23T09_36_56.957232625Z) or a comma separated range containing the start/end date of the backups to be deleted (inclusive). The accepted formats are dd-mm-yy, backup directory name or backup index, with the first backup being number 0. To read more about format go to the section BACKUP RANGES.

    BACKUP RANGES

    The remove command accepts a pair of dates or indices using the --backups argument which can be used to refine which backups in the repository to remove.

    When given the backup range '0,5' remove will delete all of the backups in chronological order starting from the first backup, finishing with the fifth backup.

    When given the backup range '20-08-2019,23-08-2019' remove will delete all the backups which fall within these two dates. Note that the format must be 'day-month-year' this means that '01-30-19' is an invalid date and will be rejected by merge.

    Remove also accepts a backup range using the names of backups e.g. '2019-08-23T09_36_56.957232625Z'. Therefore, given the backup range '2019-08-20T11_39_34.232308323Z, 2019-08-23T09_36_56.957232625Z' remove will delete all backups which fall within these two backups (inclusive).

    EXAMPLES

    The remove command is used to remove a backup repository from disk. Below is an example of how to run the remove command. The /data/backup directory is used as the archive directory and the backup repository is named "example".

    $ cbbackupmgr list -a /data/backup
    Size      Items          Name
    91.52MB   -              /
    91.52MB   -              + example
    91.52MB   -                  + 2016-02-12T12:45:33.329408761-08:00
    91.52MB   -                      + travel-sample
    322B      0                          bucket-config.json
    91.51MB   31569                      + data
    91.51MB   31569                          shard_0.fdb
    2B        0                          full-text.json
    10.00KB   8                          gsi.json
    1.72KB    1                          views.json
    $ cbbackupmgr remove -a /data/backup -r example
    Backup repository `example` deleted successfully from archive `/tmp/backup`
    $ cbbackupmgr list -a /data/backup
    Size      Items          Name
    0B        -              /

    The remove command can also be use to remove backups from inside a repository given the following archive:

    $ cbbackupmgr info -a /data/backup -r example
    Name     | Size     | # Backups  |
    example  | 36.01MB  | 3          |
    +  Backup                            | Size     | Type  | Source                 | Range  | Events  | Aliases  | Complete  |
    +  2019-09-18T11_13_58.136188+01_00  | 12.00MB  | FULL  | http://localhost:8091  | N/A    | 0       | 1        | true      |
    +  2019-09-19T11_14_29.026324+01_00  | 12.00MB  | INCR  | http://localhost:8091  | N/A    | 0       | 1        | true      |
    +  2019-09-19T11_14_40.410627+01_00  | 12.00MB  | INCR  | http://localhost:8091  | N/A    | 0       | 1        | true      |
    +  2019-09-20T11_14_43.410627+01_00  | 12.00MB  | INCR  | http://localhost:8091  | N/A    | 0       | 1        | true      |

    We can delete the first two backups using indices range such as 0,1:

    $ cbbackupmgr remove -a ~/backup_repo -r example --backups 0,1
    Backup `2019-09-18T11_13_58.136188+01_00` deleted successfully from archive `/Users/carlosbetancourt/backup_repo` repository `example`
    Backup `2019-09-19T11_14_29.026324+01_00` deleted successfully from archive `/Users/carlosbetancourt/backup_repo` repository `example`
    All backups in range `0,1` were deleted

    To delete only backup 2019-09-19T11_14_29.026324+01_0 we can do as follows:

    $ cbbackupmgr remove -a ~/backup_repo -r example --backups 2019-09-19T11_14_29.026324+01_0
    Backup `2019-09-19T11_14_29.026324+01_00` deleted successfully from archive `/Users/carlosbetancourt/backup_repo` repository `example`

    To delete backups between the 18-09-2019 and 19-09-2019 we can do as follow:

    $ cbbackupmgr remove -a ~/backup_repo -r example --backups 18-09-2019,19-09-2019
    Backup `2019-09-18T11_13_58.136188+01_00` deleted successfully from archive `/Users/carlosbetancourt/backup_repo` repository `example`
    Backup `2019-09-19T11_14_29.026324+01_00` deleted successfully from archive `/Users/carlosbetancourt/backup_repo` repository `example`
    Backup `2019-09-19T11_14_40.410627+01_00` deleted successfully from archive `/Users/carlosbetancourt/backup_repo` repository `example`
    Backup `2019-09-19T11_14_29.026324+01_00` deleted successfully from archive `/Users/carlosbetancourt/backup_repo` repository `example`
    All backups in range `18-09-2019,18-09-2019` were deleted

    Finally, we can also provide exact backup archive name ranges such as 2019-09-18T11_13_58.136188+01_00,2019-09-19T11_14_29.026324+01_00.

    $ cbbackupmgr remove -a ~/backup_repo -r example --backups 2019-09-18T11_13_58.136188+01_00,2019-09-19T11_14_29.026324+01_00
    Backup `2019-09-18T11_13_58.136188+01_00` deleted successfully from archive `/Users/carlosbetancourt/backup_repo` repository `example`
    Backup `2019-09-19T11_14_29.026324+01_00` deleted successfully from archive `/Users/carlosbetancourt/backup_repo` repository `example`
    All backups in range `2019-09-18T11_13_58.136188+01_00,2019-09-19T11_14_29.026324+01_00` were deleted

    DISCUSSION

    The remove command is used to safely remove a backup repository from an archive. This command is provided because only the cbbackupmgr utility should ever be used to access or modify a backup archive. Removing a backup repository will remove data permanently from disk. Data is not recoverable once it has been removed.

    ENVIRONMENT AND CONFIGURATION VARIABLES

    CB_ARCHIVE_PATH

    Specifies the path to the backup archive. If the archive path is supplied as a command line argument then this value is overridden.

    CBBACKUPMGR

    Part of the cbbackupmgr suite