Opsmate

Restoring Files from the Command Line

Files can be restored from the command line using simple Unix-like tools. Opsmate must be installed on your system to use these commands. You can run these commands from any system, not just the server you backed up, as long as your key ring contains a copy of the server's Browse and Decryption Keys.

Interactive Restores with opsmate ftp

Run opsmate ftp ACCOUNTNAME:SERVERNAME to browse backups and restore files using an interactive ftp-style interface. Use ls to list the current directory, cd to change directory, and get filename to retrieve an individual file or entire directory.

The following commands are available:

CommandDescription
bye Quit the program
cd path Change directory within the backup to path
exit Quit the program
get filename [dest]Download file or directory from backup
help Display this help text
lcd path Change local directory to path
lls [ls-options [path]]Display local directory listing
lmkdir path Create local directory
lpwd Display local working directory
ls [path] Display directory listing in backup
prompt [on|off] Prompt before overwriting local files?
pwd Display current working directory in backup
quit Quit the program
snapshot numberChange the current snapshot to number
snapshots Display a listing of snapshots
!command Execute command in a local shell
! Escape to local shell
? Synonym for help

By default, opsmate ftp starts with the server's most recent snapshot. To switch to an older snapshot, type snapshot number, where number is the snapshot sequence number as output by snapshots.

One-off Restores with opsmate list and opsmate restore

If you know the path of the file or directory you want to restore, you can restore it in a single command with opsmate restore.

Usage: opsmate restore [OPTIONS] [[ACCOUNT:]SERVER:]SNAPSHOT PATH [OUT_PATH]

  • ACCOUNT, SERVER, and SNAPSHOT are the account name, server name, and snapshot number from which to restore.

  • PATH is the path to the file or directory to restore.

  • OUT_PATH is the directory where files should be extracted (defaults to the current directory).

  • Notable OPTIONS:

    -mMerge into existing directories, replacing existing files
    -rCompletely remove and replace existing files and directories
    -sStrict restore (fail if a file can't be extracted)

    (For a complete list of options, run opsmate help restore)

To list a server's snapshots, run opsmate list ACCOUNT:SERVER.

To list the files in a directory, run opsmate list ACCOUNT:SERVER:SNAPSHOT PATH.

Configuring a Default Account and Server

The commands presented above take an account and server name as arguments. You can configure a default account name to avoid typing it every time. Edit your Opsmate config file (~/.opsmate/backups/conf/backups.conf for non-root users, /etc/opsmate/backups/backups.conf for root) and add the following line:

username ACCOUNTNAME

(Replacing ACCOUNTNAME with your account name.)

To configure a default server, add the following line (this must be done in addition to configuring a default account):

system SERVERNAME

(Replacing SERVERNAME with the server name.)

See Also