1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050
|
<?xml version="1.0" encoding="utf-8"?>
<refentry id='snapper8' xmlns:xlink="http://www.w3.org/1999/xlink">
<refentryinfo>
<date>2023-04-19</date>
</refentryinfo>
<refmeta>
<refentrytitle>snapper</refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo class='date'>2023-04-19</refmiscinfo>
<refmiscinfo class='version'>@VERSION@</refmiscinfo>
<refmiscinfo class='manual'>Filesystem Snapshot Management</refmiscinfo>
</refmeta>
<refnamediv>
<refname>snapper</refname>
<refpurpose>Command-line program for filesystem snapshot management</refpurpose>
</refnamediv>
<refsynopsisdiv id='synopsis'>
<cmdsynopsis>
<command>snapper</command>
<arg choice='opt'><replaceable>--global-opts</replaceable></arg>
<arg choice='plain'><replaceable>command</replaceable></arg>
<arg choice='opt'><replaceable>--command-opts</replaceable></arg>
<arg choice='opt'><replaceable>command-arguments</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>snapper</command>
<arg choice='req'>--help</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 id='description'>
<title>DESCRIPTION</title>
<para>Snapper is a command-line program for filesystem snapshot management. It can
create, delete and compare snapshots and undo changes done between snapshots.</para>
<para>Snapper never modifies the content of snapshots. Thus snapper creates
read-only snapshots if supported by the kernel. Supported filesystems are
btrfs and ext4 (discontinued) as well as snapshots of LVM logical volumes with
thin-provisioning. Some filesystems might not be supported depending on your
installation.</para>
</refsect1>
<refsect1 id='concepts'>
<title>CONCEPTS</title>
<refsect2 id='configurations'>
<title>Configurations</title>
<para>For each filesystem or subvolume that should be snapshotted by
snapper, a configuration file is required, see
<citerefentry><refentrytitle>snapper-configs</refentrytitle><manvolnum>5</manvolnum></citerefentry>. The
setup can be done with the create-config command.</para>
</refsect2>
<refsect2 id='snapshots'>
<title>Snapshots</title>
<para>Snapper distinguishes three types of snapshots.</para>
<glosslist>
<glossentry>
<glossterm>pre</glossterm>
<glossdef>
<para>Pre snapshots should always have a corresponding post
snapshot. The intention of pre/post snapshot pairs is to snapshot the
filesystem before and after a modification.</para>
</glossdef>
</glossentry>
<glossentry>
<glossterm>post</glossterm>
<glossdef>
<para>See pre type.</para>
</glossdef>
</glossentry>
<glossentry>
<glossterm>single</glossterm>
<glossdef>
<para>These snapshots have no special relationship to other snapshots.</para>
</glossdef>
</glossentry>
</glosslist>
<para>Note that filesystem-wise all three types are the same.</para>
</refsect2>
<refsect2 id='snapshot_description_and_userdata'>
<title>Snapshot Description and Userdata</title>
<para>With each snapshot a description and some userdata can be associated. The
description is a string. The userdata is a list of key-value pairs where the
keys and values are strings.</para>
<para>Do not use non-ASCII characters for the snapshot description, userdata or
any other strings, unless you always use the UTF-8 character encoding.</para>
</refsect2>
<refsect2 id='automatic_snapshot_creation'>
<title>Automatic Snapshot Creation</title>
<para>Next to manual snapshot creation, snapshots are also created automatically.</para>
<itemizedlist>
<listitem>
<para>A cronjob or systemd timer creates hourly snapshots, if TIMELINE_CREATE is enabled for a config.</para>
</listitem>
<listitem>
<para>Certain programs like YaST and zypper create pre/post
snapshot pairs when modifying the system.</para>
</listitem>
</itemizedlist>
</refsect2>
<refsect2 id='cleanup_algorithms'>
<title>Cleanup Algorithms</title>
<para>Snapper provides several algorithms to clean up old snapshots. The
algorithms are executed in a daily cronjob or systemd timer. This can be configured in the
corresponding configurations files along with parameters for every
algorithm.</para>
<glosslist>
<glossentry>
<glossterm>number</glossterm>
<glossdef>
<para>Deletes old snapshots when a certain number of snapshots is
reached.</para>
</glossdef>
</glossentry>
<glossentry>
<glossterm>timeline</glossterm>
<glossdef>
<para>Deletes old snapshots but keeps a number of hourly, daily,
weekly, monthly and yearly snapshots.</para>
</glossdef>
</glossentry>
<glossentry>
<glossterm>empty-pre-post</glossterm>
<glossdef>
<para>Deletes pre/post snapshot pairs with empty diffs.</para>
</glossdef>
</glossentry>
</glosslist>
<para>The number and timeline cleanup algorithms can also try to
keep the space used by snapshots below a limit and the free space of
the filesystem above a limit. For the first condition quota must be
setup, see command setup-quota. Additional the NUMBER_LIMIT and
TIMELINE_LIMIT variables in the config file must have ranges (min- and
max-value). The algorithms will then make two passes:
<orderedlist>
<listitem>
<para>Delete snapshots above the max-value independent of
the snapshot and filesystem space.</para>
</listitem>
<listitem>
<para>Delete snapshots above the min-value until the limits for
the snapshot and filesystem are reached.</para>
</listitem>
</orderedlist>
The limit for the used space can be configured via the
SPACE_LIMIT variable. Note: Only snapshots that have a cleanup
algorithm set are taken into account when calculating the space
used by snapshots.
The limit for the free space can be configured via the
FREE_LIMIT variable.
</para>
</refsect2>
<refsect2 id='filters'>
<title>Filters</title>
<para>Some files keep state information of the system,
e.g. <filename>/etc/mtab</filename>. Such files should never be
reverted. To help users, snapper allows one to ignore these files.</para>
<para>Filters are read from the files
<filename>/etc/snapper/filters/*.txt</filename> and
<filename>/usr/share/snapper/filters/*.txt</filename>, where
for files with the same name the former location has precedence.
Each line in those files specifies a pattern. When snapper
computes the difference between two snapshots it ignores all
files and directories matching any of those patterns by using
<citerefentry role="nolink"><refentrytitle>fnmatch</refentrytitle><manvolnum>3</manvolnum></citerefentry>
with the flag FNM_LEADING_DIR.</para>
<para>Note that filters do not exclude files or directories from being
snapshotted. For that, use subvolumes or mount points.</para>
</refsect2>
</refsect1>
<refsect1 id='global_options'>
<title>GLOBAL OPTIONS</title>
<variablelist>
<varlistentry>
<term><option>-q, --quiet</option></term>
<listitem>
<para>Suppress normal output. Error messages will still be printed, though.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-v, --verbose</option></term>
<listitem>
<para>Increase verbosity.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--debug</option></term>
<listitem>
<para>Turn on debugging.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--utc</option></term>
<listitem>
<para>Display dates and times in UTC. By default, local time is used.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--iso</option></term>
<listitem>
<para>Display dates and times in ISO format. ISO format is always used for machine-readable
outputs.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-t, --table-style <replaceable>style</replaceable></option></term>
<listitem>
<para>Specifies table style. Table style is identified by an integer number.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--abbreviate</option></term>
<listitem>
<para>Try to abbreviate texts in some columns so that tables fit the width of the screen.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--machine-readable <replaceable>format</replaceable></option></term>
<listitem>
<para>Specifies a machine-readable output format. Possible options are csv and json.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--csvout</option></term>
<listitem>
<para>Sets CSV output format. See
<link xlink:href="https://tools.ietf.org/html/rfc4180">RFC 4180</link>
for the details, except lines end with a LF, not CR+LF.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--jsonout</option></term>
<listitem>
<para>Sets JSON output format.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--separator <replaceable>character</replaceable></option></term>
<listitem>
<para>Specifies the character separator for CSV output format.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--no-headers</option></term>
<listitem>
<para>Suppress headers for CSV output format.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-c, --config <replaceable>name</replaceable></option></term>
<listitem>
<para>Use specified configuration instead of the default configuration. The default
configuration is named "root".</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--no-dbus</option></term>
<listitem>
<para>Operate without a DBus connection.</para>
<para>Use with caution since a running snapperd will not know about
modifications made to the system.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-r, --root <replaceable>path</replaceable></option></term>
<listitem>
<para>Operate on target root. Only works together with no-dbus and only for some commands.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-a, --ambit <replaceable>ambit</replaceable></option></term>
<listitem>
<para>Operate in the specified ambit. Can be used to override the ambit detection.
Allowed ambits are auto, classic and transactional.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--version</option></term>
<listitem>
<para>Print version and exit.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id='commands'>
<title>COMMANDS</title>
<para>Snapper provides a number of <emphasis>commands</emphasis>. Each
command accepts the options listed in the <link
linkend='global_options'>GLOBAL OPTIONS</link> section. These options must
be specified <emphasis>before</emphasis> the command name. In addition,
many commands have specific options, which are listed in this
section. These command-specific options must be specified
<emphasis>after</emphasis> the name of the command and
<emphasis>before</emphasis> any of the command arguments.</para>
<variablelist>
<varlistentry>
<term><option>help</option></term>
<listitem>
<para>Show short help text.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>list-configs [options]</option></term>
<listitem>
<para>List available configurations.</para>
<variablelist>
<varlistentry>
<term><option>--columns</option> <replaceable>columns</replaceable></term>
<listitem>
<para>Select columns to show separated by comma.</para>
<para>Possible columns are: config, subvolume.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term><option>create-config [options] <replaceable>subvolume</replaceable></option></term>
<listitem>
<para>Create a new configuration for a filesystem or subvolume. For this command you
will likely need the global option <option>--config</option>, see
<link linkend='global_options'>GLOBAL OPTIONS</link> and
<link linkend="concepts">CONCEPTS.</link></para>
<variablelist>
<varlistentry>
<term><option>-f, --fstype</option> <replaceable>fstype</replaceable></term>
<listitem>
<para>Manually set filesystem type. Supported values are btrfs, ext4
(discontinued) and lvm. For lvm, snapper uses LVM thin-provisioned snapshots.
The filesystem type on top of LVM must be provided in parentheses,
e.g. lvm(xfs).</para>
<para>Without this option snapper tries to detect the filesystem.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-t, --template</option> <replaceable>name</replaceable></term>
<listitem>
<para>Name of template for the new configuration file.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term><option>delete-config</option></term>
<listitem>
<para>Delete a configuration for a filesystem or subvolume. For this
command you will likely need to global option
<option>--config</option>, see <link linkend='global_options'>GLOBAL
OPTIONS</link> and <link linkend="concepts">CONCEPTS.</link></para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>get-config [options]</option></term>
<listitem>
<para>Displays the settings of the configuration.</para>
<variablelist>
<varlistentry>
<term><option>--columns</option> <replaceable>columns</replaceable></term>
<listitem>
<para>Select columns to show separated by comma.</para>
<para>Possible columns are: key, value.</para>
<para>Columns are not selected when JSON format is used.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term><option>set-config</option> <replaceable>configdata</replaceable></term>
<listitem>
<para>Changes the settings of the configuration. The settings
<replaceable>configdata</replaceable> are a list of key-value-pairs separated
by spaces and the key and value must be separated by an equal sign,
e.g. "NUMBER_CLEANUP=yes NUMBER_LIMIT=10". The value of SUBVOLUME and FSTYPE
cannot be changed.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>list (ls) [options]</option></term>
<listitem>
<para>List snapshots.</para>
<variablelist>
<varlistentry>
<term><option>-t, --type</option> <replaceable>type</replaceable></term>
<listitem>
<para>Selects type of snapshots to list. Possible values are
all, single and pre-post.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--disable-used-space</option></term>
<listitem>
<para>Disable display of used space.</para>
<para>Calculating the used space needs some time. Thus
this option can speedup the listing.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-a, --all-configs</option></term>
<listitem>
<para>List snapshots from all configs accessible by the user.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--columns</option> <replaceable>columns</replaceable></term>
<listitem>
<para>Select columns to show separated by comma.</para>
<para>Possible columns are: config, subvolume, number, default, active,
date, user, used-space, cleanup, description, userdata, pre-number, post-number,
post-date, read-only.</para>
</listitem>
</varlistentry>
</variablelist>
<para>For each snapshot the output consists of several
columns. Some need explanation:</para>
<glosslist>
<glossentry>
<glossterm>#, Pre # and Post #</glossterm>
<glossdef>
<para>The number of the snapshot.</para>
<para>For btrfs the number can be followed by a sign.
A "<computeroutput>-</computeroutput>" indicates that the snapshot is
the currently mounted snapshot and a
"<computeroutput>+</computeroutput>" indicates that the snapshot will
be mounted next time (It is the btrfs default subvolume). If both
conditions apply a
"<computeroutput>*</computeroutput>" is displayed.</para>
</glossdef>
</glossentry>
<glossentry>
<glossterm>Used Space</glossterm>
<glossdef>
<para>For btrfs the exclusive space of the btrfs quota
group corresponding to the snapshot.</para>
<para>Display of used space is automatically disabled
if not available, e.g. quota not enabled on btrfs.</para>
</glossdef>
</glossentry>
</glosslist>
</listitem>
</varlistentry>
<varlistentry>
<term><option>create [options]</option></term>
<listitem>
<para>Create a new snapshot.</para>
<variablelist>
<varlistentry>
<term><option>-t, --type</option> <replaceable>type</replaceable></term>
<listitem>
<para>Specifies the type of the new snapshot. Possible values
are single, pre and post.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--pre-number</option> <replaceable>number</replaceable></term>
<listitem>
<para>For post snapshots the number of the pre snapshot must
be provided.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-p, --print-number</option></term>
<listitem>
<para>Print number of the created snapshot.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-d, --description</option> <replaceable>description</replaceable></term>
<listitem>
<para>Description for the snapshot.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-c, --cleanup-algorithm</option> <replaceable>cleanup-algorithm</replaceable></term>
<listitem>
<para>Set the cleanup algorithm for the snapshot.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-u, --userdata</option> <replaceable>userdata</replaceable></term>
<listitem>
<para>Set userdata for the snapshot. The key-value pairs must
be separated by comma and the key and value must be separated
by an equal sign, e.g. requestid=42,user=arthur.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--command</option> <replaceable>command</replaceable></term>
<listitem>
<para>Create a pre and post snapshot and run command in between.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--read-only</option></term>
<listitem>
<para>Create a read-only snapshot. This is the default.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--read-write</option></term>
<listitem>
<para>Create a read-write snapshot.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--from</option> <replaceable>number</replaceable></term>
<listitem>
<para>Create a snapshot from the snapshot with the
provided number instead of snapshot 0.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term><option>modify [options] <replaceable>number</replaceable></option></term>
<listitem>
<para>Modify a snapshot.</para>
<variablelist>
<varlistentry>
<term><option>-d, --description</option> <replaceable>description</replaceable></term>
<listitem>
<para>New description for snapshot.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-c, --cleanup-algorithm</option> <replaceable>cleanup-algorithm</replaceable></term>
<listitem>
<para>Set the cleanup algorithm for the snapshot.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-u, --userdata</option> <replaceable>userdata</replaceable></term>
<listitem>
<para>Set userdata for the snapshot. The key-value pairs must
be separated by comma and the key and value must be separated
by an equal sign, e.g. requestid=42,user=arthur.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--read-only</option></term>
<listitem>
<para>Set the snapshot read-only.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--read-write</option></term>
<listitem>
<para>Set the snapshot read-write.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--default</option></term>
<listitem>
<para>Set the snapshot as default snapshot. Only for btrfs.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term><option>delete (remove|rm) <replaceable>number</replaceable> |
<replaceable>number1-number2</replaceable></option></term>
<listitem>
<para>Delete a snapshot or a range of snapshots.</para>
<variablelist>
<varlistentry>
<term><option>-s, --sync</option></term>
<listitem>
<para>Sync the filesystem after deleting the snapshots. The
details depend on the filesystem type.</para>
<para>Btrfs normally asynchronously frees space after deleting
snapshots. With this option snapper will wait until the space once used by the
deleted snapshots is actually available again.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Snapshot 0 cannot be deleted. For btrfs the currently
mounted snapshot and the snapshot that will be mounted next time
(the btrfs default subvolume) can also not be deleted.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>mount <replaceable>number</replaceable></option></term>
<listitem>
<para>Mount a snapshot. Not required for all filesystem types.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>umount <replaceable>number</replaceable></option></term>
<listitem>
<para>Unmount a snapshot. Not required for all filesystem types.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>status [options] <replaceable>number1</replaceable>..<replaceable>number2</replaceable></option></term>
<listitem>
<para>Compare the snapshots <replaceable>number1</replaceable> and
<replaceable>number2</replaceable>. This will show a list of files
and directories that have been created, modified or deleted in the
time between the two snapshots have been made.</para>
<variablelist>
<varlistentry>
<term><option>-o, --output</option> <replaceable>file</replaceable></term>
<listitem>
<para>Write output to file <replaceable>file</replaceable>.</para>
</listitem>
</varlistentry>
</variablelist>
<para>The output consists of a string encoding the status followed by
the filename. The characters of the status string are:</para>
<orderedlist>
<listitem>
<para>A "<computeroutput>+</computeroutput>" means the file was
created, a "<computeroutput>-</computeroutput>" means the file was deleted. A
"<computeroutput>c</computeroutput>" means the content of the file has changed
and a "<computeroutput>t</computeroutput>" means the type of the file has
changed (e.g. from regular file to directory).</para>
</listitem>
<listitem>
<para>A "<computeroutput>p</computeroutput>" means the permissions
are have changed.</para>
</listitem>
<listitem>
<para>An "<computeroutput>u</computeroutput>" means the user
ownership has changed.</para>
</listitem>
<listitem>
<para>A "<computeroutput>g</computeroutput>" means the group
ownership has changed.</para>
</listitem>
<listitem>
<para>A "<computeroutput>x</computeroutput>" means the extended
attribute information has changed.</para>
</listitem>
<listitem>
<para>An "<computeroutput>a</computeroutput>" means the ACL
information has changed.</para>
</listitem>
</orderedlist>
<para>If there is no change a "." is outputted.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>diff [options] <replaceable>number1</replaceable>..<replaceable>number2</replaceable> [files]</option></term>
<listitem>
<para>Compare the snapshots <replaceable>number1</replaceable> and
<replaceable>number2</replaceable>. This will show a diff of the
content of files and directories that have been created, modified or
deleted in the time between the two snapshots have been made.</para>
<variablelist>
<varlistentry>
<term><option>-i, --input</option> <replaceable>file</replaceable></term>
<listitem>
<para>Read files to diff from file <replaceable>file</replaceable>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--diff-cmd</option> <replaceable>command</replaceable></term>
<listitem>
<para>Command used for comparing files. The default is
<filename>/usr/bin/diff --new-file --unified</filename>. The two files to
compare are passed as parameters to the command.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-x, --extensions</option> <replaceable>options</replaceable></term>
<listitem>
<para>Extra options passed to the diff command.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term><option>undochange [options] <replaceable>number1</replaceable>..<replaceable>number2</replaceable> [files]</option></term>
<listitem>
<para>Undo changes done between snapshot <replaceable>number1</replaceable> and <replaceable>number2</replaceable>.</para>
<variablelist>
<varlistentry>
<term><option>-i, --input</option> <replaceable>file</replaceable></term>
<listitem>
<para>Read files for which to undo changes from file <replaceable>file</replaceable>.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term><option>rollback [options] [<replaceable>number</replaceable>]</option></term>
<listitem>
<para>Creates two new snapshots and sets the default subvolume. Per
default the system boots from the default subvolume of the root filesystem.
The exact actions depend on whether a number is provided or not:</para>
<itemizedlist>
<listitem>
<para>Without a number, a first read-only snapshot of the
default subvolume is created. A second read-write snapshot of the current
system is created. The system is set to boot from the second snapshot.</para>
</listitem>
<listitem>
<para>With a number, a first read-only snapshot of the current
system is created. A second read-write snapshot is created of
<replaceable>number</replaceable>. The system is set to boot from the second
snapshot.</para>
</listitem>
</itemizedlist>
<para>Rollback is only supported with btrfs and requires a properly
configured system.</para>
<variablelist>
<varlistentry>
<term><option>-p, --print-number</option></term>
<listitem>
<para>Print number of the second created snapshot.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-d, --description</option> <replaceable>description</replaceable></term>
<listitem>
<para>Description for the snapshot.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-c, --cleanup-algorithm</option> <replaceable>cleanup-algorithm</replaceable></term>
<listitem>
<para>Set the cleanup algorithm for the snapshot.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-u, --userdata</option> <replaceable>userdata</replaceable></term>
<listitem>
<para>Set userdata for the snapshot. The key-value pairs must
be separated by comma and the key and value must be separated
by an equal sign, e.g. requestid=42,user=arthur.</para>
</listitem>
</varlistentry>
</variablelist>
<para>The rollback command also sets the description, the cleanup
algorithm and some userdata unless the values are specified on the command
line. This will automate cleanup of snapshots created by rollbacks.</para>
<para>In other ambits than classic the rollback command does what is required
to do a rollback. Anyway it is recommended to use specific programs in that
case.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>setup-quota</option></term>
<listitem>
<para>Sets up quota. Currently only supported with btrfs.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>cleanup [options] <replaceable>cleanup-algorithm</replaceable></option></term>
<listitem>
<para>Run the cleanup algorithm
<replaceable>cleanup-algorithm</replaceable>. Currently implemented cleanup algorithms
are number, timeline and empty-pre-post. To run all cleanup algorithms, all can be
provided as cleanup-algorithm.</para>
<variablelist>
<varlistentry>
<term><option>--path</option> <replaceable>path</replaceable></term>
<listitem>
<para>Cleanup all configs affecting path. Only useful for btrfs.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--free-space</option> <replaceable>free-space</replaceable></term>
<listitem>
<para>Try to make free-space available. Only useful for btrfs.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term><option>xadiff <replaceable>number1</replaceable>..<replaceable>number2</replaceable> [files]</option></term>
<listitem>
<para>Compare the extended attributes between snapshot
<replaceable>number1</replaceable> and
<replaceable>number2</replaceable>. See examples below:</para>
<itemizedlist>
<listitem>
<para><computeroutput> +:user.foo</computeroutput> for created attributes</para>
</listitem>
<listitem>
<para><computeroutput> -:user.bar</computeroutput> for removed attributes</para>
</listitem>
<listitem>
<para><computeroutput>-+:security.selinux</computeroutput> for modified attributes</para>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id='permissions'>
<title>PERMISSIONS</title>
<para>Non-root users can be allowed to use a configuration by setting
ALLOW_USERS or ALLOW_GROUPS in the config file. For all operations to work, the
user must also be able to read and access the <filename>.snapshots</filename>
directory inside the subvolume. The <filename>.snapshots</filename> directory
must be owned by root and must not be writable by anybody else.</para>
<para>Here are some methods how to achieve that:</para>
<itemizedlist>
<listitem>
<para>Make the directory accessible for everyone:</para>
<para><command>chmod a+rx .snapshots</command></para>
</listitem>
<listitem>
<para>Make the directory accessible for a group the user belongs to, e.g.:</para>
<para><command>chown :users .snapshots</command></para>
</listitem>
<listitem>
<para>Make the directory accessible for the user using ACLs, e.g.:</para>
<para><command>setfacl -m u:tux:rx .snapshots</command></para>
</listitem>
</itemizedlist>
<para>The last method can be performed by snapper, see the SYNC_ACL setting in
<citerefentry><refentrytitle>snapper-configs</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
</refsect1>
<refsect1 id='plugins'>
<title>PLUGINS</title>
<para>snapper can execute external scripts after certain actions. Scripts
have to be placed in <filename>/usr/lib/snapper/plugins</filename>.
The name has to start with a digit, execution order is alphabetical.</para>
<para>The first argument of a script is the action snapper executed. The
following actions are defined:</para>
<variablelist>
<varlistentry>
<term><option>create-config-pre <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable></option></term>
<listitem>
<para>Executed before a new config is created</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>create-config-post <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable></option></term>
<listitem>
<para>Executed after a new config was created</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>delete-config-pre <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable></option></term>
<listitem>
<para>Executed before a config is deleted</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>delete-config-post <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable></option></term>
<listitem>
<para>Executed after a config was deleted</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>create-snapshot-pre <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term>
<listitem>
<para>Executed before a new snapshot is created</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>create-snapshot-post <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term>
<listitem>
<para>Executed after a new snapshot was created</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>modify-snapshot-pre <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term>
<listitem>
<para>Executed before a snapshot is modified</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>modify-snapshot-post <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term>
<listitem>
<para>Executed after a snapshot was modified</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>delete-snapshot-pre <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term>
<listitem>
<para>Executed before a snapshot is removed</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>delete-snapshot-post <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term>
<listitem>
<para>Executed after a snapshot was removed</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>set-default-snapshot-pre <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term>
<listitem>
<para>Executed before the default snapshot is changed</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>set-default-snapshot-post <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>snapshot-number</replaceable></option></term>
<listitem>
<para>Executed after the default snapshot was changed</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>rollback-post <replaceable>subvolume</replaceable> <replaceable>fstype</replaceable> <replaceable>old-snapshot-number</replaceable> <replaceable>new-snapshot-number</replaceable></option></term>
<listitem>
<para>Executed after a rollback was done</para>
</listitem>
</varlistentry>
</variablelist>
<para>More actions and arguments can be added any time. Using snapper in
the plugins is not allowed.</para>
<para>It is undefined whether the plugins are called from the
client (snapper) or server (snapperd).</para>
</refsect1>
<refsect1 id='files'>
<title>FILES</title>
<variablelist>
<varlistentry>
<term><filename>@SYSCONFIG@/snapper</filename></term>
<listitem>
<para>Global configuration file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>/etc/snapper/configs</filename></term>
<listitem>
<para>Directory containing configuration files.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>/etc/snapper/config-templates</filename></term>
<listitem>
<para>Directory containing configuration templates.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>/usr/share/snapper/config-templates</filename></term>
<listitem>
<para>Fallback directory containing configuration templates.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>/etc/snapper/filters/*.txt</filename></term>
<listitem>
<para>Filter files.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>/usr/share/snapper/filters/*.txt</filename></term>
<listitem>
<para>Fallback filter files.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>/var/log/snapper.log</filename></term>
<listitem>
<para>Logfile. Please include this file in bug reports.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id='notes'>
<title>NOTES</title>
<para>There is no mechanism to ensure consistency of the files while a
snapshot it made. E.g. the files of a database can be inconsistent while
the database is running.</para>
<para>Consistency after undochange is not guaranteed. E.g. when the
creation of a user is undone, there might still exist files from that
user.</para>
<para>Support for individual filesystems, rollback and extended attributes
are compile-time options and may not be available.</para>
</refsect1>
<refsect1 id='homepage'>
<title>HOMEPAGE</title>
<para><ulink url='http://snapper.io/'>http://snapper.io/</ulink></para>
</refsect1>
<refsect1 id='authors'>
<title>AUTHORS</title>
<para>Arvin Schnell <email>aschnell@suse.com</email></para>
</refsect1>
<refsect1 id='see_also'>
<title>SEE ALSO</title>
<para>
<citerefentry><refentrytitle>snapper-configs</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>snapper-zypp-plugin</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>pam_snapper</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry role="nolink"><refentrytitle>btrfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry role="nolink"><refentrytitle>lvm</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry role="nolink"><refentrytitle>attr</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry role="nolink"><refentrytitle>acl</refentrytitle><manvolnum>5</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>
|