Child pages
  • The backups_create_metadata Script
For cPanel & WHM version 70

Skip to end of metadata
Go to start of metadata

Overview

The /usr/local/cpanel/scripts/backups_create_metadata script allows a user to create metadata files for all account backup types.

The backups_create_metadata script

To use the /usr/local/cpanel/scripts/backups_create_metadata script, run the following command as the root user:

/usr/local/cpanel/scripts/backups_create_metadata [arguments] [inputs]

Arguments and inputs

Use the following arguments for the /usr/local/cpanel/scripts/backups_create_metadata script:

ArgumentsDescriptionInput valuesExample
--all

Creates metadata files for all backups.

Note:

You cannot combine the --all argument with other arguments.

None./scripts/backups_create_metadata --all
--backup=[backup filename]

Creates metadata files for the specified backup file.

Use this argument with the --user argument to create metadata for the specified user.

The backup file's name./scripts/backups_create_metadata --backup=monthly/YYYY-DD-MM
--user=[user]

Creates metadata files for the specified user.

The cPanel account's username./scripts/backups_create_metadata --user=abc1
--vacuum

Defragments the metadata SQL database and frees unused space.

Notes:

  • The –vacuum argument will only free space if the database has unused space. If you have already used the --vacuum argument to free database space, you cannot use it again to clear additional space.
  • You cannot combine the --vacuum argument with other arguments.
None./scripts/backups_create_metadata --vacuum
--schedule_rebuildSame as the --all argument, but runs the script in the background.None./scripts/backups_create_metadata --schedule_rebuild

Metadata for backups version 3.1

Every time that cPanel & WHM creates a backup, it creates metadata for that backup. The system stores that metadata as entries in a username.db database (where username is the cPanel account's username). Then, the system saves the database to the .meta directory under your configured backup directory. The metadata databases store the indexed information of their related backups. These smaller database entries provide a faster information-retrieval method than their source backup.

You can use the backups_create_metadata script to manually generate metadata for a backup.

Note:

The script will generate metadata for all directories under the /home/username directory, except for the /mail and /.cpanel directories.

The backup_paths table

The backup_paths table lists the backup files' paths.

FieldTypeDescriptionPossible valuesExample
backup_pathstringThe backup files's filepath, relative to the configured backup directory.A string value./backup/2018-04-12/accounts
backup_idintegerThe backup file's identification number.

A positive integer.

This value references the backup_id value in the backups table.

1

The backups table

The backups table lists the backup files on the disk.

FieldTypeDescriptionPossible valuesExample
backup_idintegerThe backup file's identification number.An automatically-incrementing positive integer.1
timestamptimestampThe backup files's creation date in Universal Time Coordinated (UTC) format.An integer.1523642274
does_existBooleanWhether the backup file exists.
  • 1 — Exists.
  • 0 — Does not exist.

1

The file_changes table

The file_changes table lists backup file changes when any of the following actions occur:

  • The first time the system backs up the file.
  • The user modifies the file.
  • The user removes the file.
FieldTypeDescriptionPossible valuesExample
seen_files_idintegerThe filepath's identification number.

A positive integer.

This value references the file_id value in the seen_files table.

1
backup_idintegerThe backup file's identification number.

A positive integer.

This value references thebackup_id value in the backups table.

1
sizeintegerThe backup file's size, in bytes.
  • A file size value displays the file's size.
  • A directory or a symlink displays a 0 file size.
660
mtimeintegerThe date when the user last modified the file, in UTC format.

An integer.

1523642274
operationintegerThe change type.
  • 0 — The user created the backup file.
  • 1 — The user changed the file.
  • 2 — The user removed the file.
0
typeintegerThe backup file's type.
  • 0 — A file.
  • 1 — A directory.
  • 2 — A symlink.
0

The metadata table

This table stores metadata keys and values.

FieldTypeDescriptionPossible valuesExample
keystringThe metadata code type.

schema_version — The metadata schema's version.

schema_version
valuestringThe metadata code's version number.

A string value.

3.1

The seen_files table

This table stores filenames.

FieldTypeDescriptionPossible valuesExample
file_idintegerThe file's identification number.An automatically-incrementing positive integer.1
pathstringThe file's filepath, relative to the /home/username directory.A string value./public_html/

Additional documentation