Child pages
  • The backups_create_metadata Script
Skip to end of metadata
Go to start of metadata

This documentation is for cPanel & WHM version 70 CURRENT builds.  The "RELEASE" version of our documentation can be found in the Version 68 Documentation space.

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.

The backup directory's name./scripts/backups_create_metadata --all
--backup

Creates metadata files for the specified backup file.

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

Combine this argument with the --backup argument to create metadata files for the specified user within the desired backup.

The cPanel account's username./scripts/backups_create_metadata --backup=monthly/YYYY-DD-MM --user=abc1
--vacuum

Defragments the metadata SQL database and frees unused space.

Note:

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.

None./scripts/backups_create_metadata --vacuum

Metadata for backups version 2.0

Every time that cPanel & WHM creates a backup, it creates metadata for that backup. The system stores that metadata as entries in the /var/cpanel/backups/metadata.sqlite database. The metadata contains information that maps the contents of that backup's directory. The metadata database stores indexed information of its related backup. 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.

The attributes table

The attributes table stores metadata on a backup's values and includes the following fields:

FieldDescriptionPossible valuesExample
backup_idThe backup's unique identification number.A 16-octet universally unique identifier (UUID).5CF006F6-CB97-11E7-AB60-BD601DD98E64
user_idThe cPanel account's username.A string value.username
uidThe system user's ID for that file or directory.An integer value.1162
gidThe system group's ID for that file or directory.An integer value.1160
archive_sizeThe archive's size, in bytes. For example, the size of the username.tar.gz file.An integer value.909270
uncompressed_sizeAn uncompressed archive's size, in bytes.An integer value.3639557
pkgacct_versionAn integer value.10
archive_versionThe program version that the system uses to prepare the backup file.An integer value.4
file_countThe number of files in that particular user's backup.An integer value.100190

The control table

The control table only stores the metadata's format version and includes the following field:

FieldDescriptionPossible valuesExample
metaversionThe metadata's format version.An integer value.2

The backups table

The backups table stores metadata entries about backup directories in the /backup folder and includes the following fields:

FieldDescriptionPossible valuesExample
backup_idThe backup's unique identification number.A 16-octet UUID.3B9FA736-CB97-11E7-AB60-BD601DD98E64
yearThe year when the system executed the backup.An integer value.2017
monthThe month when the system executed the backup.An integer value.11
dayThe day when the system executed the backup.An integer value.15
hourThe hour when the system executed the backup.An integer value.0
minuteThe minute when the system executed the backup.An integer value.0
secondThe second when the system executed the backup.An integer value.0
pathThe full path to the file in the archive.A string value./backup/2017-11-15
backup_typeThe backup type.
  • 0 — Uncompressed.
  • 1 — Compressed.
  • 2 — Incremental.
1
statusWhether the backup completed successfully or failed.
  • Successful — The backup finished successfully.
  • Failed — The backup failed to finish.
Successful

The meta table

The meta table stores metadata entries about user backups in the /backups/YYYY-MM-DD/backups/weekly, and /backups/monthly directories. The meta table includes the following fields:

FieldDescriptionPossible valuesExample
backup_idThe backup's identification number.A 16-octet UUID.3B9FA736-CB97-11E7-AB60-BD601DD98E64
user_idThe cPanel account's username.A string value.username
typeAn archived file type.
  • FILE — A file.
  • DIR — A directory.
  • SYMLINK — A symlink.
FILE
sizeThe backup's size, in bytes.
  • A file or symlink's size value displays the file or symlink's file size.
  • A directory's size value displays the sum of all the contents within the directory.
660
mdateThe date when the system last modified the file.

The date in YYYY-MM-DD format, where:

  • YYYY represents the year.
  • MM represents the month.
  • DD represents the date.
2017-06-02
nameThe file, symlink, or directory's name.
  • For compressed and uncompressed backups, the name value displays a filename.
  • For incremental backups, the name value displays a relative path.
username/homedir/public_html/index.html
uidThe system user's ID for that file or directory.An integer value.0
gidThe system group's ID for that file or directory.An integer value.1162
file_countThe item's number of files.
  • A file's or symlink's file_count value always displays a value of 1.
  • A directory's file_count displays the sum of all of the files and directories below it.
1

The users table

The users table stores metadata entries on cPanel account users and their backups. The users table includes the following fields:

FieldDescriptionPossible valuesExample
user_idThe cPanel account's username.A string value.username
backup_idThe backup's identification number.A 16-octet UUID.3B9FA736-CB97-11E7-AB60-BD601DD98E64
backup_typeThe backup type.
  • 0 — Uncompressed.
  • 1 — Compressed.
  • 2 — Incremental.
1

Additional documentation