| 1 |
.. _cedar-commandline: |
| 2 |
|
| 3 |
Command Line Tools |
| 4 |
================== |
| 5 |
|
| 6 |
.. _cedar-commandline-overview: |
| 7 |
|
| 8 |
Overview |
| 9 |
-------- |
| 10 |
|
| 11 |
Cedar Backup comes with three command-line programs: ``cback3``, |
| 12 |
``cback3-amazons3-sync``, and ``cback3-span``. |
| 13 |
|
| 14 |
The ``cback3`` command is the primary command line interface and the |
| 15 |
only Cedar Backup program that most users will ever need. |
| 16 |
|
| 17 |
The ``cback3-amazons3-sync`` tool is used for synchronizing entire |
| 18 |
directories of files up to an Amazon S3 cloud storage bucket, outside of |
| 19 |
the normal Cedar Backup process. |
| 20 |
|
| 21 |
Users who have a *lot* of data to back up --- more than will fit on a |
| 22 |
single CD or DVD --- can use the interactive ``cback3-span`` tool to |
| 23 |
split their data between multiple discs. |
| 24 |
|
| 25 |
.. _cedar-commandline-cback3: |
| 26 |
|
| 27 |
The ``cback3`` command |
| 28 |
---------------------- |
| 29 |
|
| 30 |
.. _cedar-commandline-cback3-intro: |
| 31 |
|
| 32 |
Introduction |
| 33 |
~~~~~~~~~~~~ |
| 34 |
|
| 35 |
Cedar Backup's primary command-line interface is the ``cback3`` command. |
| 36 |
It controls the entire backup process. |
| 37 |
|
| 38 |
.. _cedar-commandline-cback3-syntax: |
| 39 |
|
| 40 |
Syntax |
| 41 |
~~~~~~ |
| 42 |
|
| 43 |
The ``cback3`` command has the following syntax: |
| 44 |
|
| 45 |
:: |
| 46 |
|
| 47 |
Usage: cback3 [switches] action(s) |
| 48 |
|
| 49 |
The following switches are accepted: |
| 50 |
|
| 51 |
-h, --help Display this usage/help listing |
| 52 |
-V, --version Display version information |
| 53 |
-b, --verbose Print verbose output as well as logging to disk |
| 54 |
-q, --quiet Run quietly (display no output to the screen) |
| 55 |
-c, --config Path to config file (default: /etc/cback3.conf) |
| 56 |
-f, --full Perform a full backup, regardless of configuration |
| 57 |
-M, --managed Include managed clients when executing actions |
| 58 |
-N, --managed-only Include ONLY managed clients when executing actions |
| 59 |
-l, --logfile Path to logfile (default: /var/log/cback3.log) |
| 60 |
-o, --owner Logfile ownership, user:group (default: root:adm) |
| 61 |
-m, --mode Octal logfile permissions mode (default: 640) |
| 62 |
-O, --output Record some sub-command (i.e. cdrecord) output to the log |
| 63 |
-d, --debug Write debugging information to the log (implies --output) |
| 64 |
-s, --stack Dump a Python stack trace instead of swallowing exceptions |
| 65 |
-D, --diagnostics Print runtime diagnostics to the screen and exit |
| 66 |
|
| 67 |
The following actions may be specified: |
| 68 |
|
| 69 |
all Take all normal actions (collect, stage, store, purge) |
| 70 |
collect Take the collect action |
| 71 |
stage Take the stage action |
| 72 |
store Take the store action |
| 73 |
purge Take the purge action |
| 74 |
rebuild Rebuild "this week's" disc if possible |
| 75 |
validate Validate configuration only |
| 76 |
initialize Initialize media for use with Cedar Backup |
| 77 |
|
| 78 |
You may also specify extended actions that have been defined in |
| 79 |
configuration. |
| 80 |
|
| 81 |
You must specify at least one action to take. More than one of |
| 82 |
the "collect", "stage", "store" or "purge" actions and/or |
| 83 |
extended actions may be specified in any arbitrary order; they |
| 84 |
will be executed in a sensible order. The "all", "rebuild", |
| 85 |
"validate", and "initialize" actions may not be combined with |
| 86 |
other actions. |
| 87 |
|
| 88 |
|
| 89 |
Note that the all action *only* executes the standard four actions. It |
| 90 |
never executes any of the configured extensions. [1]_ |
| 91 |
|
| 92 |
.. _cedar-commandline-cback3-options: |
| 93 |
|
| 94 |
Switches |
| 95 |
~~~~~~~~ |
| 96 |
|
| 97 |
``-h``, ``--help`` |
| 98 |
Display usage/help listing. |
| 99 |
|
| 100 |
``-V``, ``--version`` |
| 101 |
Display version information. |
| 102 |
|
| 103 |
``-b``, ``--verbose`` |
| 104 |
Print verbose output to the screen as well writing to the logfile. |
| 105 |
When this option is enabled, most information that would normally be |
| 106 |
written to the logfile will also be written to the screen. |
| 107 |
|
| 108 |
``-q``, ``--quiet`` |
| 109 |
Run quietly (display no output to the screen). |
| 110 |
|
| 111 |
``-c``, ``--config`` |
| 112 |
Specify the path to an alternate configuration file. The default |
| 113 |
configuration file is ``/etc/cback3.conf``. |
| 114 |
|
| 115 |
``-f``, ``--full`` |
| 116 |
Perform a full backup, regardless of configuration. For the collect |
| 117 |
action, this means that any existing information related to |
| 118 |
incremental backups will be ignored and rewritten; for the store |
| 119 |
action, this means that a new disc will be started. |
| 120 |
|
| 121 |
``-M``, ``--managed`` |
| 122 |
Include managed clients when executing actions. If the action being |
| 123 |
executed is listed as a managed action for a managed client, execute |
| 124 |
the action on that client after executing the action locally. |
| 125 |
|
| 126 |
``-N``, ``--managed-only`` |
| 127 |
Include *only* managed clients when executing actions. If the action |
| 128 |
being executed is listed as a managed action for a managed client, |
| 129 |
execute the action on that client --- but *do not* execute the |
| 130 |
action locally. |
| 131 |
|
| 132 |
``-l``, ``--logfile`` |
| 133 |
Specify the path to an alternate logfile. The default logfile file is |
| 134 |
``/var/log/cback3.log``. |
| 135 |
|
| 136 |
``-o``, ``--owner`` |
| 137 |
Specify the ownership of the logfile, in the form ``user:group``. The |
| 138 |
default ownership is ``root:adm``, to match the Debian standard for |
| 139 |
most logfiles. This value will only be used when creating a new |
| 140 |
logfile. If the logfile already exists when the ``cback3`` command is |
| 141 |
executed, it will retain its existing ownership and mode. Only user |
| 142 |
and group names may be used, not numeric uid and gid values. |
| 143 |
|
| 144 |
``-m``, ``--mode`` |
| 145 |
Specify the permissions for the logfile, using the numeric mode as in |
| 146 |
``chmod(1)``. The default mode is ``0640`` (``-rw-r-----``). This value |
| 147 |
will only be used when creating a new logfile. If the logfile already |
| 148 |
exists when the ``cback3`` command is executed, it will retain its |
| 149 |
existing ownership and mode. |
| 150 |
|
| 151 |
``-O``, ``--output`` |
| 152 |
Record some sub-command output to the logfile. When this option is |
| 153 |
enabled, all output from system commands will be logged. This might |
| 154 |
be useful for debugging or just for reference. |
| 155 |
|
| 156 |
``-d``, ``--debug`` |
| 157 |
Write debugging information to the logfile. This option produces a |
| 158 |
high volume of output, and would generally only be needed when |
| 159 |
debugging a problem. This option implies the ``--output`` option, as |
| 160 |
well. |
| 161 |
|
| 162 |
``-s``, ``--stack`` |
| 163 |
Dump a Python stack trace instead of swallowing exceptions. This |
| 164 |
forces Cedar Backup to dump the entire Python stack trace associated |
| 165 |
with an error, rather than just propagating last message it received |
| 166 |
back up to the user interface. Under some circumstances, this is |
| 167 |
useful information to include along with a bug report. |
| 168 |
|
| 169 |
``-D``, ``--diagnostics`` |
| 170 |
Display runtime diagnostic information and then exit. This diagnostic |
| 171 |
information is often useful when filing a bug report. |
| 172 |
|
| 173 |
.. _cedar-commandline-cback3-actions: |
| 174 |
|
| 175 |
Actions |
| 176 |
~~~~~~~ |
| 177 |
|
| 178 |
You can find more information about the various actions in :doc:`basic`. In |
| 179 |
general, you may specify any combination of the *collect*, *stage*, |
| 180 |
*store* or *purge* actions, and the specified actions will be executed in a |
| 181 |
sensible order. Or, you can specify one of the *all*, *rebuild*, |
| 182 |
*validate*, or *initialize* actions (but these actions may not be combined |
| 183 |
with other actions). |
| 184 |
|
| 185 |
If you have configured any Cedar Backup extensions, then the actions |
| 186 |
associated with those extensions may also be specified on the command |
| 187 |
line. If you specify any other actions along with an extended action, |
| 188 |
the actions will be executed in a sensible order per configuration. The |
| 189 |
*all* action never executes extended actions, however. |
| 190 |
|
| 191 |
.. _cedar-commandline-sync: |
| 192 |
|
| 193 |
The ``cback3-amazons3-sync`` command |
| 194 |
------------------------------------ |
| 195 |
|
| 196 |
.. _cedar-commandline-sync-intro: |
| 197 |
|
| 198 |
Introduction |
| 199 |
~~~~~~~~~~~~ |
| 200 |
|
| 201 |
The ``cback3-amazons3-sync`` tool is used for synchronizing entire |
| 202 |
directories of files up to an Amazon S3 cloud storage bucket, outside of |
| 203 |
the normal Cedar Backup process. |
| 204 |
|
| 205 |
This might be a good option for some types of data, as long as you |
| 206 |
understand the limitations around retrieving previous versions of |
| 207 |
objects that get modified or deleted as part of a sync. S3 does support |
| 208 |
versioning, but it won't be quite as easy to get at those previous |
| 209 |
versions as with an explicit incremental backup like ``cback3`` |
| 210 |
provides. Cedar Backup does not provide any tooling that would help you |
| 211 |
retrieve previous versions. |
| 212 |
|
| 213 |
The underlying functionality relies on the `AWS CLI <http://aws.amazon.com/documentation/cli/>`__ |
| 214 |
toolset. Before you use this extension, you need to set up your Amazon S3 |
| 215 |
account and configure AWS CLI as detailed in Amazon's |
| 216 |
`setup guide <http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html>`__. |
| 217 |
The ``aws`` command will be executed as the same user that is executing |
| 218 |
the ``cback3-amazons3-sync`` command, so make sure you configure it as |
| 219 |
the proper user. (This is different than the amazons3 extension, which |
| 220 |
is designed to execute as root and switches over to the configured |
| 221 |
backup user to execute AWS CLI commands.) |
| 222 |
|
| 223 |
.. _cedar-commandline-sync-permissions: |
| 224 |
|
| 225 |
Permissons |
| 226 |
~~~~~~~~~~ |
| 227 |
|
| 228 |
You can use whichever Amazon-supported authentication mechanism you |
| 229 |
would like when setting up connectivity for the AWS CLI. It's best to |
| 230 |
set up a separate user in the `IAM Console <https://console.aws.amazon.com/iam/home>`__ |
| 231 |
rather than using your main administrative user. |
| 232 |
|
| 233 |
You probably want to lock down this user so that it can only take backup |
| 234 |
related actions in the AWS infrastructure. One option is to apply the |
| 235 |
``AmazonS3FullAccess`` policy, which grants full access to the S3 |
| 236 |
infrastructure. If you would like to lock down the user even further, |
| 237 |
this appears to be the minimum set of permissions required for the |
| 238 |
``aws s3 sync`` action, written as a JSON policy statement: |
| 239 |
|
| 240 |
:: |
| 241 |
|
| 242 |
{ |
| 243 |
"Version": "2012-10-17", |
| 244 |
"Statement": [ |
| 245 |
{ |
| 246 |
"Effect": "Allow", |
| 247 |
"Action": [ |
| 248 |
"s3:ListBucket", |
| 249 |
"s3:PutObject", |
| 250 |
"s3:PutObjectAcl", |
| 251 |
"s3:DeleteObject" |
| 252 |
], |
| 253 |
"Resource": [ |
| 254 |
"arn:aws:s3:::your-bucket", |
| 255 |
"arn:aws:s3:::your-bucket/*" |
| 256 |
] |
| 257 |
} |
| 258 |
] |
| 259 |
} |
| 260 |
|
| 261 |
|
| 262 |
In the ``Resource`` section, be sure to list the name of your S3 bucket |
| 263 |
instead of ``my-bucket``. |
| 264 |
|
| 265 |
.. _cedar-commandline-sync-syntax: |
| 266 |
|
| 267 |
Syntax |
| 268 |
~~~~~~ |
| 269 |
|
| 270 |
The ``cback3-amazons3-sync`` command has the following syntax: |
| 271 |
|
| 272 |
:: |
| 273 |
|
| 274 |
Usage: cback3-amazons3-sync [switches] sourceDir s3bucketUrl |
| 275 |
|
| 276 |
Cedar Backup Amazon S3 sync tool. |
| 277 |
|
| 278 |
This Cedar Backup utility synchronizes a local directory to an Amazon S3 |
| 279 |
bucket. After the sync is complete, a validation step is taken. An |
| 280 |
error is reported if the contents of the bucket do not match the |
| 281 |
source directory, or if the indicated size for any file differs. |
| 282 |
This tool is a wrapper over the AWS CLI command-line tool. |
| 283 |
|
| 284 |
The following arguments are required: |
| 285 |
|
| 286 |
sourceDir The local source directory on disk (must exist) |
| 287 |
s3BucketUrl The URL to the target Amazon S3 bucket |
| 288 |
|
| 289 |
The following switches are accepted: |
| 290 |
|
| 291 |
-h, --help Display this usage/help listing |
| 292 |
-V, --version Display version information |
| 293 |
-b, --verbose Print verbose output as well as logging to disk |
| 294 |
-q, --quiet Run quietly (display no output to the screen) |
| 295 |
-l, --logfile Path to logfile (default: /var/log/cback3.log) |
| 296 |
-o, --owner Logfile ownership, user:group (default: root:adm) |
| 297 |
-m, --mode Octal logfile permissions mode (default: 640) |
| 298 |
-O, --output Record some sub-command (i.e. aws) output to the log |
| 299 |
-d, --debug Write debugging information to the log (implies --output) |
| 300 |
-s, --stack Dump Python stack trace instead of swallowing exceptions |
| 301 |
-D, --diagnostics Print runtime diagnostics to the screen and exit |
| 302 |
-v, --verifyOnly Only verify the S3 bucket contents, do not make changes |
| 303 |
-v, --uploadOnly Only upload new data, do not remove files in the S3 bucket |
| 304 |
-w, --ignoreWarnings Ignore warnings about problematic filename encodings |
| 305 |
|
| 306 |
Typical usage would be something like: |
| 307 |
|
| 308 |
cback3-amazons3-sync /home/myuser s3://example.com-backup/myuser |
| 309 |
|
| 310 |
This will sync the contents of /home/myuser into the indicated bucket. |
| 311 |
|
| 312 |
|
| 313 |
.. _cedar-commandline-sync-options: |
| 314 |
|
| 315 |
Switches |
| 316 |
~~~~~~~~ |
| 317 |
|
| 318 |
``-h``, ``--help`` |
| 319 |
Display usage/help listing. |
| 320 |
|
| 321 |
``-V``, ``--version`` |
| 322 |
Display version information. |
| 323 |
|
| 324 |
``-b``, ``--verbose`` |
| 325 |
Print verbose output to the screen as well writing to the logfile. |
| 326 |
When this option is enabled, most information that would normally be |
| 327 |
written to the logfile will also be written to the screen. |
| 328 |
|
| 329 |
``-q``, ``--quiet`` |
| 330 |
Run quietly (display no output to the screen). |
| 331 |
|
| 332 |
``-l``, ``--logfile`` |
| 333 |
Specify the path to an alternate logfile. The default logfile file is |
| 334 |
``/var/log/cback3.log``. |
| 335 |
|
| 336 |
``-o``, ``--owner`` |
| 337 |
Specify the ownership of the logfile, in the form ``user:group``. The |
| 338 |
default ownership is ``root:adm``, to match the Debian standard for |
| 339 |
most logfiles. This value will only be used when creating a new |
| 340 |
logfile. If the logfile already exists when the |
| 341 |
``cback3-amazons3-sync`` command is executed, it will retain its |
| 342 |
existing ownership and mode. Only user and group names may be used, |
| 343 |
not numeric uid and gid values. |
| 344 |
|
| 345 |
``-m``, ``--mode`` |
| 346 |
Specify the permissions for the logfile, using the numeric mode as in |
| 347 |
``chmod(1)``. The default mode is ``0640`` (``-rw-r-----``). This value |
| 348 |
will only be used when creating a new logfile. If the logfile already |
| 349 |
exists when the ``cback3-amazons3-sync`` command is executed, it will |
| 350 |
retain its existing ownership and mode. |
| 351 |
|
| 352 |
``-O``, ``--output`` |
| 353 |
Record some sub-command output to the logfile. When this option is |
| 354 |
enabled, all output from system commands will be logged. This might |
| 355 |
be useful for debugging or just for reference. |
| 356 |
|
| 357 |
``-d``, ``--debug`` |
| 358 |
Write debugging information to the logfile. This option produces a |
| 359 |
high volume of output, and would generally only be needed when |
| 360 |
debugging a problem. This option implies the ``--output`` option, as |
| 361 |
well. |
| 362 |
|
| 363 |
``-s``, ``--stack`` |
| 364 |
Dump a Python stack trace instead of swallowing exceptions. This |
| 365 |
forces Cedar Backup to dump the entire Python stack trace associated |
| 366 |
with an error, rather than just propagating last message it received |
| 367 |
back up to the user interface. Under some circumstances, this is |
| 368 |
useful information to include along with a bug report. |
| 369 |
|
| 370 |
``-D``, ``--diagnostics`` |
| 371 |
Display runtime diagnostic information and then exit. This diagnostic |
| 372 |
information is often useful when filing a bug report. |
| 373 |
|
| 374 |
``-v``, ``--verifyOnly`` |
| 375 |
Only verify the S3 bucket contents against the directory on disk. Do |
| 376 |
not make any changes to the S3 bucket or transfer any files. This is |
| 377 |
intended as a quick check to see whether the sync is up-to-date. |
| 378 |
|
| 379 |
Although no files are transferred, the tool will still execute the |
| 380 |
source filename encoding check, discussed below along with |
| 381 |
``--ignoreWarnings``. |
| 382 |
|
| 383 |
``-u``, ``--uploadOnly`` |
| 384 |
Implement a partial or "upload only" sync, instead of a full synchronization. |
| 385 |
Normally, synchronization would remove files that exist in S3 but do not exist |
| 386 |
in the directory on disk. With this flag, new files are uploaded, but no |
| 387 |
files are removed in S3. |
| 388 |
|
| 389 |
``-w``, ``--ignoreWarnings`` |
| 390 |
The AWS CLI S3 sync process is very picky about filename encoding. |
| 391 |
Files that the Linux filesystem handles with no problems can cause |
| 392 |
problems in S3 if the filename cannot be encoded properly in your |
| 393 |
configured locale. As of this writing, filenames like this will cause |
| 394 |
the sync process to abort without transferring all files as expected. |
| 395 |
|
| 396 |
To avoid confusion, the ``cback3-amazons3-sync`` tries to guess which |
| 397 |
files in the source directory will cause problems, and refuses to |
| 398 |
execute the AWS CLI S3 sync if any problematic files exist. If you'd |
| 399 |
rather proceed anyway, use ``--ignoreWarnings``. |
| 400 |
|
| 401 |
If problematic files are found, then you have basically two options: |
| 402 |
either correct your locale (i.e. if you have set ``LANG=C``) or |
| 403 |
rename the file so it can be encoded properly in your locale. The |
| 404 |
error messages will tell you the expected encoding (from your locale) |
| 405 |
and the actual detected encoding for the filename. |
| 406 |
|
| 407 |
.. _cedar-commandline-cbackspan: |
| 408 |
|
| 409 |
The ``cback3-span`` command |
| 410 |
--------------------------- |
| 411 |
|
| 412 |
.. _cedar-commandline-cbackspan-intro: |
| 413 |
|
| 414 |
Introduction |
| 415 |
~~~~~~~~~~~~ |
| 416 |
|
| 417 |
Cedar Backup was designed --- and is still primarily focused --- around weekly |
| 418 |
backups. Most users who back up more data than fits on a single disc seem to |
| 419 |
either use Amazon S3 or stop their backup process at the stage step, using |
| 420 |
Cedar Backup as an easy way to collect data. |
| 421 |
|
| 422 |
However, some users have expressed a need to write these large kinds of |
| 423 |
backups to disc --- if not every day, then at least occassionally. The |
| 424 |
``cback3-span`` tool was written to meet those needs. If you have staged |
| 425 |
more data than fits on a single CD or DVD, you can use ``cback3-span`` |
| 426 |
to split that data between multiple discs. |
| 427 |
|
| 428 |
``cback3-span`` is not a general-purpose disc-splitting tool. It is a |
| 429 |
specialized program that requires Cedar Backup configuration to run. All |
| 430 |
it can do is read Cedar Backup configuration, find any staging |
| 431 |
directories that have not yet been written to disc, and split the files |
| 432 |
in those directories between discs. |
| 433 |
|
| 434 |
``cback3-span`` accepts many of the same command-line options as |
| 435 |
``cback3``, but *must* be run interactively. It cannot be run from cron. |
| 436 |
This is intentional. It is intended to be a useful tool, not a new part |
| 437 |
of the backup process (that is the purpose of an extension). |
| 438 |
|
| 439 |
In order to use ``cback3-span``, you must configure your backup such |
| 440 |
that the largest individual backup file can fit on a single disc. *The |
| 441 |
command will not split a single file onto more than one disc.* All it |
| 442 |
can do is split large directories onto multiple discs. Files in those |
| 443 |
directories will be arbitrarily split up so that space is utilized most |
| 444 |
efficiently. |
| 445 |
|
| 446 |
.. _cedar-commandline-cbackspan-syntax: |
| 447 |
|
| 448 |
Syntax |
| 449 |
~~~~~~ |
| 450 |
|
| 451 |
The ``cback3-span`` command has the following syntax: |
| 452 |
|
| 453 |
:: |
| 454 |
|
| 455 |
Usage: cback3-span [switches] |
| 456 |
|
| 457 |
Cedar Backup 'span' tool. |
| 458 |
|
| 459 |
This Cedar Backup utility spans staged data between multiple discs. |
| 460 |
It is a utility, not an extension, and requires user interaction. |
| 461 |
|
| 462 |
The following switches are accepted, mostly to set up underlying |
| 463 |
Cedar Backup functionality: |
| 464 |
|
| 465 |
-h, --help Display this usage/help listing |
| 466 |
-V, --version Display version information |
| 467 |
-b, --verbose Print verbose output as well as logging to disk |
| 468 |
-c, --config Path to config file (default: /etc/cback3.conf) |
| 469 |
-l, --logfile Path to logfile (default: /var/log/cback3.log) |
| 470 |
-o, --owner Logfile ownership, user:group (default: root:adm) |
| 471 |
-m, --mode Octal logfile permissions mode (default: 640) |
| 472 |
-O, --output Record some sub-command (i.e. cdrecord) output to the log |
| 473 |
-d, --debug Write debugging information to the log (implies --output) |
| 474 |
-s, --stack Dump a Python stack trace instead of swallowing exceptions |
| 475 |
|
| 476 |
|
| 477 |
.. _cedar-commandline-cbackspan-options: |
| 478 |
|
| 479 |
Switches |
| 480 |
~~~~~~~~ |
| 481 |
|
| 482 |
``-h``, ``--help`` |
| 483 |
Display usage/help listing. |
| 484 |
|
| 485 |
``-V``, ``--version`` |
| 486 |
Display version information. |
| 487 |
|
| 488 |
``-b``, ``--verbose`` |
| 489 |
Print verbose output to the screen as well writing to the logfile. |
| 490 |
When this option is enabled, most information that would normally be |
| 491 |
written to the logfile will also be written to the screen. |
| 492 |
|
| 493 |
``-c``, ``--config`` |
| 494 |
Specify the path to an alternate configuration file. The default |
| 495 |
configuration file is ``/etc/cback3.conf``. |
| 496 |
|
| 497 |
``-l``, ``--logfile`` |
| 498 |
Specify the path to an alternate logfile. The default logfile file is |
| 499 |
``/var/log/cback3.log``. |
| 500 |
|
| 501 |
``-o``, ``--owner`` |
| 502 |
Specify the ownership of the logfile, in the form ``user:group``. The |
| 503 |
default ownership is ``root:adm``, to match the Debian standard for |
| 504 |
most logfiles. This value will only be used when creating a new |
| 505 |
logfile. If the logfile already exists when the ``cback3`` command is |
| 506 |
executed, it will retain its existing ownership and mode. Only user |
| 507 |
and group names may be used, not numeric uid and gid values. |
| 508 |
|
| 509 |
``-m``, ``--mode`` |
| 510 |
Specify the permissions for the logfile, using the numeric mode as in |
| 511 |
``chmod(1)``. The default mode is ``0640`` (``-rw-r-----``). This value |
| 512 |
will only be used when creating a new logfile. If the logfile already |
| 513 |
exists when the ``cback3`` command is executed, it will retain its |
| 514 |
existing ownership and mode. |
| 515 |
|
| 516 |
``-O``, ``--output`` |
| 517 |
Record some sub-command output to the logfile. When this option is |
| 518 |
enabled, all output from system commands will be logged. This might |
| 519 |
be useful for debugging or just for reference. Cedar Backup uses |
| 520 |
system commands mostly for dealing with the CD/DVD recorder and its |
| 521 |
media. |
| 522 |
|
| 523 |
``-d``, ``--debug`` |
| 524 |
Write debugging information to the logfile. This option produces a |
| 525 |
high volume of output, and would generally only be needed when |
| 526 |
debugging a problem. This option implies the ``--output`` option, as |
| 527 |
well. |
| 528 |
|
| 529 |
``-s``, ``--stack`` |
| 530 |
Dump a Python stack trace instead of swallowing exceptions. This |
| 531 |
forces Cedar Backup to dump the entire Python stack trace associated |
| 532 |
with an error, rather than just propagating last message it received |
| 533 |
back up to the user interface. Under some circumstances, this is |
| 534 |
useful information to include along with a bug report. |
| 535 |
|
| 536 |
.. _cedar-commandline-cbackspan-using: |
| 537 |
|
| 538 |
Using ``cback3-span`` |
| 539 |
~~~~~~~~~~~~~~~~~~~~~ |
| 540 |
|
| 541 |
As discussed above, the ``cback3-span`` is an interactive command. It |
| 542 |
cannot be run from cron. |
| 543 |
|
| 544 |
You can typically use the default answer for most questions. The only |
| 545 |
two questions that you may not want the default answer for are the fit |
| 546 |
algorithm and the cushion percentage. |
| 547 |
|
| 548 |
The cushion percentage is used by ``cback3-span`` to determine what |
| 549 |
capacity to shoot for when splitting up your staging directories. A 650 |
| 550 |
MB disc does not fit fully 650 MB of data. It's usually more like 627 MB |
| 551 |
of data. The cushion percentage tells ``cback3-span`` how much overhead |
| 552 |
to reserve for the filesystem. The default of 4% is usually OK, but if |
| 553 |
you have problems you may need to increase it slightly. |
| 554 |
|
| 555 |
The fit algorithm tells ``cback3-span`` how it should determine which |
| 556 |
items should be placed on each disc. If you don't like the result from |
| 557 |
one algorithm, you can reject that solution and choose a different |
| 558 |
algorithm. |
| 559 |
|
| 560 |
The four available fit algorithms are: |
| 561 |
|
| 562 |
``worst`` |
| 563 |
The worst-fit algorithm. |
| 564 |
|
| 565 |
The worst-fit algorithm proceeds through a sorted list of items |
| 566 |
(sorted from smallest to largest) until running out of items or |
| 567 |
meeting capacity exactly. If capacity is exceeded, the item that |
| 568 |
caused capacity to be exceeded is thrown away and the next one is |
| 569 |
tried. The algorithm effectively includes the maximum number of items |
| 570 |
possible in its search for optimal capacity utilization. It tends to |
| 571 |
be somewhat slower than either the best-fit or alternate-fit |
| 572 |
algorithm, probably because on average it has to look at more items |
| 573 |
before completing. |
| 574 |
|
| 575 |
``best`` |
| 576 |
The best-fit algorithm. |
| 577 |
|
| 578 |
The best-fit algorithm proceeds through a sorted list of items |
| 579 |
(sorted from largest to smallest) until running out of items or |
| 580 |
meeting capacity exactly. If capacity is exceeded, the item that |
| 581 |
caused capacity to be exceeded is thrown away and the next one is |
| 582 |
tried. The algorithm effectively includes the minimum number of items |
| 583 |
possible in its search for optimal capacity utilization. For large |
| 584 |
lists of mixed-size items, it's not unusual to see the algorithm |
| 585 |
achieve 100% capacity utilization by including fewer than 1% of the |
| 586 |
items. Probably because it often has to look at fewer of the items |
| 587 |
before completing, it tends to be a little faster than the worst-fit |
| 588 |
or alternate-fit algorithms. |
| 589 |
|
| 590 |
``first`` |
| 591 |
The first-fit algorithm. |
| 592 |
|
| 593 |
The first-fit algorithm proceeds through an unsorted list of items |
| 594 |
until running out of items or meeting capacity exactly. If capacity |
| 595 |
is exceeded, the item that caused capacity to be exceeded is thrown |
| 596 |
away and the next one is tried. This algorithm generally performs |
| 597 |
more poorly than the other algorithms both in terms of capacity |
| 598 |
utilization and item utilization, but can be as much as an order of |
| 599 |
magnitude faster on large lists of items because it doesn't require |
| 600 |
any sorting. |
| 601 |
|
| 602 |
``alternate`` |
| 603 |
A hybrid algorithm that I call alternate-fit. |
| 604 |
|
| 605 |
This algorithm tries to balance small and large items to achieve |
| 606 |
better end-of-disk performance. Instead of just working one direction |
| 607 |
through a list, it alternately works from the start and end of a |
| 608 |
sorted list (sorted from smallest to largest), throwing away any item |
| 609 |
which causes capacity to be exceeded. The algorithm tends to be |
| 610 |
slower than the best-fit and first-fit algorithms, and slightly |
| 611 |
faster than the worst-fit algorithm, probably because of the number |
| 612 |
of items it considers on average before completing. It often achieves |
| 613 |
slightly better capacity utilization than the worst-fit algorithm, |
| 614 |
while including slightly fewer items. |
| 615 |
|
| 616 |
.. _cedar-commandline-cbackspan-sample: |
| 617 |
|
| 618 |
Sample run |
| 619 |
~~~~~~~~~~ |
| 620 |
|
| 621 |
Below is a log showing a sample ``cback3-span`` run. |
| 622 |
|
| 623 |
:: |
| 624 |
|
| 625 |
================================================ |
| 626 |
Cedar Backup 'span' tool |
| 627 |
================================================ |
| 628 |
|
| 629 |
This the Cedar Backup span tool. It is used to split up staging |
| 630 |
data when that staging data does not fit onto a single disc. |
| 631 |
|
| 632 |
This utility operates using Cedar Backup configuration. Configuration |
| 633 |
specifies which staging directory to look at and which writer device |
| 634 |
and media type to use. |
| 635 |
|
| 636 |
Continue? [Y/n]: |
| 637 |
=== |
| 638 |
|
| 639 |
Cedar Backup store configuration looks like this: |
| 640 |
|
| 641 |
Source Directory...: /tmp/staging |
| 642 |
Media Type.........: cdrw-74 |
| 643 |
Device Type........: cdwriter |
| 644 |
Device Path........: /dev/cdrom |
| 645 |
Device SCSI ID.....: None |
| 646 |
Drive Speed........: None |
| 647 |
Check Data Flag....: True |
| 648 |
No Eject Flag......: False |
| 649 |
|
| 650 |
Is this OK? [Y/n]: |
| 651 |
=== |
| 652 |
|
| 653 |
Please wait, indexing the source directory (this may take a while)... |
| 654 |
=== |
| 655 |
|
| 656 |
The following daily staging directories have not yet been written to disc: |
| 657 |
|
| 658 |
/tmp/staging/2007/02/07 |
| 659 |
/tmp/staging/2007/02/08 |
| 660 |
/tmp/staging/2007/02/09 |
| 661 |
/tmp/staging/2007/02/10 |
| 662 |
/tmp/staging/2007/02/11 |
| 663 |
/tmp/staging/2007/02/12 |
| 664 |
/tmp/staging/2007/02/13 |
| 665 |
/tmp/staging/2007/02/14 |
| 666 |
|
| 667 |
The total size of the data in these directories is 1.00 GB. |
| 668 |
|
| 669 |
Continue? [Y/n]: |
| 670 |
=== |
| 671 |
|
| 672 |
Based on configuration, the capacity of your media is 650.00 MB. |
| 673 |
|
| 674 |
Since estimates are not perfect and there is some uncertainly in |
| 675 |
media capacity calculations, it is good to have a "cushion", |
| 676 |
a percentage of capacity to set aside. The cushion reduces the |
| 677 |
capacity of your media, so a 1.5% cushion leaves 98.5% remaining. |
| 678 |
|
| 679 |
What cushion percentage? [4.00]: |
| 680 |
=== |
| 681 |
|
| 682 |
The real capacity, taking into account the 4.00% cushion, is 627.25 MB. |
| 683 |
It will take at least 2 disc(s) to store your 1.00 GB of data. |
| 684 |
|
| 685 |
Continue? [Y/n]: |
| 686 |
=== |
| 687 |
|
| 688 |
Which algorithm do you want to use to span your data across |
| 689 |
multiple discs? |
| 690 |
|
| 691 |
The following algorithms are available: |
| 692 |
|
| 693 |
first....: The "first-fit" algorithm |
| 694 |
best.....: The "best-fit" algorithm |
| 695 |
worst....: The "worst-fit" algorithm |
| 696 |
alternate: The "alternate-fit" algorithm |
| 697 |
|
| 698 |
If you don't like the results you will have a chance to try a |
| 699 |
different one later. |
| 700 |
|
| 701 |
Which algorithm? [worst]: |
| 702 |
=== |
| 703 |
|
| 704 |
Please wait, generating file lists (this may take a while)... |
| 705 |
=== |
| 706 |
|
| 707 |
Using the "worst-fit" algorithm, Cedar Backup can split your data |
| 708 |
into 2 discs. |
| 709 |
|
| 710 |
Disc 1: 246 files, 615.97 MB, 98.20% utilization |
| 711 |
Disc 2: 8 files, 412.96 MB, 65.84% utilization |
| 712 |
|
| 713 |
Accept this solution? [Y/n]: n |
| 714 |
=== |
| 715 |
|
| 716 |
Which algorithm do you want to use to span your data across |
| 717 |
multiple discs? |
| 718 |
|
| 719 |
The following algorithms are available: |
| 720 |
|
| 721 |
first....: The "first-fit" algorithm |
| 722 |
best.....: The "best-fit" algorithm |
| 723 |
worst....: The "worst-fit" algorithm |
| 724 |
alternate: The "alternate-fit" algorithm |
| 725 |
|
| 726 |
If you don't like the results you will have a chance to try a |
| 727 |
different one later. |
| 728 |
|
| 729 |
Which algorithm? [worst]: alternate |
| 730 |
=== |
| 731 |
|
| 732 |
Please wait, generating file lists (this may take a while)... |
| 733 |
=== |
| 734 |
|
| 735 |
Using the "alternate-fit" algorithm, Cedar Backup can split your data |
| 736 |
into 2 discs. |
| 737 |
|
| 738 |
Disc 1: 73 files, 627.25 MB, 100.00% utilization |
| 739 |
Disc 2: 181 files, 401.68 MB, 64.04% utilization |
| 740 |
|
| 741 |
Accept this solution? [Y/n]: y |
| 742 |
=== |
| 743 |
|
| 744 |
Please place the first disc in your backup device. |
| 745 |
Press return when ready. |
| 746 |
=== |
| 747 |
|
| 748 |
Initializing image... |
| 749 |
Writing image to disc... |
| 750 |
|
| 751 |
---------- |
| 752 |
|
| 753 |
*Previous*: :doc:`install` • *Next*: :doc:`config` |
| 754 |
|
| 755 |
---------- |
| 756 |
|
| 757 |
.. [1] |
| 758 |
Some users find this surprising, because extensions are configured |
| 759 |
with sequence numbers. I did it this way because I felt that running |
| 760 |
extensions as part of the all action would sometimes result in |
| 761 |
“surprising” behavior. Better to be definitive than confusing. |
| 762 |
|
| 763 |
.. |note| image:: images/note.png |
| 764 |
.. |tip| image:: images/tip.png |
| 765 |
.. |warning| image:: images/warning.png |