rear-2.3/000077500000000000000000000000001321646673500123245ustar00rootroot00000000000000rear-2.3/.editorconfig000066400000000000000000000001421321646673500147760ustar00rootroot00000000000000root = true [*] end_of_line = lf insert_final_newline = true indent_style = space indent_size = 4 rear-2.3/.github/000077500000000000000000000000001321646673500136645ustar00rootroot00000000000000rear-2.3/.github/CONTRIBUTING.md000066400000000000000000000035471321646673500161260ustar00rootroot00000000000000## How to contribute to Relax-and-Recover (rear) #### **Did you find a bug?** * **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/rear/rear/issues) * If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/rear/rear/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible (use our template), and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring. #### **Did you write a patch that fixes a bug?** * [Open a new GitHub pull request with the patch](http://relax-and-recover.org/development/). * Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable. * Before submitting, please read the [Code Style wiki](https://github.com/rear/rear/wiki/Coding-Style) to ensure the quality of the code. #### **Do you intend to add a new feature or change an existing one?** * Suggest your change in the [rear-devel mailing list](http://lists.relax-and-recover.org/mailman/listinfo/rear-devel) * Do not open an issue on GitHub until you have collected positive feedback about the change. GitHub issues are primarily intended for bug reports and fixes. #### **Do you have questions about the source code?** * Ask any question about how to use rear in the [rear-user mailing list](http://lists.relax-and-recover.org/mailman/listinfo/rear-users) #### **Do you want to contribute to the rear documentation?** * Please read and improve the [documentation](https://github.com/rear/rear/tree/master/doc) * Open a new GitHub pull request with the patch.
Relax-and-Recover is a volunteer effort. We encourage you to pitch in and [join the team](http://relax-and-recover.org/)! Thanks! :heart: :heart: :heart: Relax-and-Recover Team rear-2.3/.github/ISSUE_TEMPLATE.md000066400000000000000000000006601321646673500163730ustar00rootroot00000000000000#### Relax-and-Recover (ReaR) Issue Template Fill in the following items before submitting a new issue (quick response is not guaranteed with free support): * rear version (/usr/sbin/rear -V): * OS version (cat /etc/rear/os.conf or lsb_release -a): * rear configuration files (cat /etc/rear/site.conf or cat /etc/rear/local.conf): * Are you using legacy BIOS or UEFI boot? * Brief description of the issue: * Work-around, if any: rear-2.3/.gitignore000066400000000000000000000000731321646673500143140ustar00rootroot00000000000000/test/ /build/ /dist/ build-stamp /var /etc/rear/site.conf rear-2.3/.travis.yml000066400000000000000000000000461321646673500144350ustar00rootroot00000000000000os: - linux script: - make validaterear-2.3/COPYING000066400000000000000000001045131321646673500133630ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . rear-2.3/MAINTAINERS000066400000000000000000000006121321646673500140200ustar00rootroot00000000000000Schlomo Schapiro https://github.com/schlomo Gratien D'haese https://github.com/gdha Johannes Meixner https://github.com/jsmeix Vladimir Gozora https://github.com/gozora Sébastien Chabrolles https://github.com/schabrolles ALUMNI Dag Wieers https://github.com/dagwieers Jeroen Hoekx https://github.com/jhoekx rear-2.3/Makefile000066400000000000000000000247641321646673500140010ustar00rootroot00000000000000# In some dists (e.g. Ubuntu) bash is not the default shell. Statements like # cp -a etc/rear/{mappings,templates} ... # assumes bash. So its better to set SHELL SHELL=/bin/bash DESTDIR = OFFICIAL = ### Get version from Relax-and-Recover itself rearbin = usr/sbin/rear name = rear version := $(shell awk 'BEGIN { FS="=" } /^readonly VERSION=/ { print $$2}' $(rearbin)) ### Get the branch information from git ifeq ($(OFFICIAL),) ifneq ($(shell which git),) git_date := $(shell git log -n 1 --format="%ai" 2>/dev/null || echo now) git_ref := $(shell git rev-parse --short HEAD 2>/dev/null || echo 0) git_count := $(shell git rev-list HEAD --count --no-merges 2>/dev/null || echo 0) git_branch_suffix = $(shell { git symbolic-ref --short HEAD 2>/dev/null || echo unknown ; } | tr -d /_-) git_status := $(shell git status --porcelain 2>/dev/null) git_stamp := $(git_count).$(git_ref).$(git_branch_suffix) ifneq ($(git_status),) git_stamp := $(git_stamp).changed endif endif else ifneq ($(shell which git),) git_date := $(shell git log -n 1 --format="%ai") endif git_branch = rear-$(version) endif git_branch ?= master date := $(shell date --date="$(git_date)" +%Y%m%d%H%M) release_date := $(shell date --date="$(git_date)" +%Y-%m-%d) prefix = /usr sysconfdir = /etc sbindir = $(prefix)/sbin datadir = $(prefix)/share mandir = $(datadir)/man localstatedir = /var specfile = packaging/rpm/$(name).spec dscfile = packaging/debian/$(name).dsc distversion = $(version) debrelease = 0 rpmrelease = %nil obsproject = Archiving:Backup:Rear obspackage = $(name)-$(version) ifeq ($(OFFICIAL),) distversion = $(version)-git.$(git_stamp) debrelease = 0git.$(git_stamp) rpmrelease = .git.$(git_stamp) obsproject = Archiving:Backup:Rear:Snapshot obspackage = $(name) endif .PHONY: doc all: @echo "Nothing to build. Use \`make help' for more information." help: @echo -e "Relax-and-Recover make targets:\n\ \n\ validate - Check source code\n\ install - Install Relax-and-Recover (may replace files)\n\ uninstall - Uninstall Relax-and-Recover (may remove files)\n\ dist - Create tar file in dist/\n\ deb - Create DEB package in dist/\n\ rpm - Create RPM package in dist/\n\ pacman - Create Pacman package\n\ obs - Initiate OBS builds\n\ \n\ Relax-and-Recover make variables (optional):\n\ \n\ DESTDIR= - Location to install/uninstall\n\ OFFICIAL=1 - Build an official release\n\ " clean: rm -Rf dist build rm -f build-stamp make -C doc clean ### You can call 'make validate' directly from your .git/hooks/pre-commit script validate: @echo -e "\033[1m== Validating scripts and configuration ==\033[0;0m" find etc/ usr/share/rear/conf/ -name '*.conf' | xargs -n 1 bash -n bash -n $(rearbin) find . -name '*.sh' | xargs -n 1 bash -O extglob -O nullglob -n find usr/share/rear -name '*.sh' | grep -v -E '(lib|skel|conf)' | while read FILE ; do \ num=$$(echo $${FILE##*/} | cut -c1-3); \ if [[ "$$num" = "000" || "$$num" = "999" ]] ; then \ echo "ERROR: script $$FILE may not start with $$num"; \ exit 1; \ else \ if $$( grep '[_[:alpha:]]' <<< $$num >/dev/null 2>&1 ) ; then \ echo "ERROR: script $$FILE must start with 3 digits"; \ exit 1; \ fi; \ fi; \ done man: @echo -e "\033[1m== Prepare manual ==\033[0;0m" make -C doc man doc: @echo -e "\033[1m== Prepare documentation ==\033[0;0m" make -C doc docs install-config: @echo -e "\033[1m== Installing configuration ==\033[0;0m" install -d -m0700 $(DESTDIR)$(sysconfdir)/rear/ install -d -m0700 $(DESTDIR)$(sysconfdir)/rear/cert/ -[[ ! -e $(DESTDIR)$(sysconfdir)/rear/local.conf ]] && \ install -Dp -m0600 etc/rear/local.conf $(DESTDIR)$(sysconfdir)/rear/local.conf -[[ ! -e $(DESTDIR)$(sysconfdir)/rear/os.conf && -e etc/rear/os.conf ]] && \ install -Dp -m0600 etc/rear/os.conf $(DESTDIR)$(sysconfdir)/rear/os.conf -find $(DESTDIR)$(sysconfdir)/rear/ -name '.gitignore' -exec rm -rf {} \; &>/dev/null install-bin: @echo -e "\033[1m== Installing binary ==\033[0;0m" install -Dp -m0755 $(rearbin) $(DESTDIR)$(sbindir)/rear sed -i -e 's,^CONFIG_DIR=.*,CONFIG_DIR="$(sysconfdir)/rear",' \ -e 's,^SHARE_DIR=.*,SHARE_DIR="$(datadir)/rear",' \ -e 's,^VAR_DIR=.*,VAR_DIR="$(localstatedir)/lib/rear",' \ $(DESTDIR)$(sbindir)/rear install-data: @echo -e "\033[1m== Installing scripts ==\033[0;0m" install -d -m0755 $(DESTDIR)$(datadir)/rear/ cp -a usr/share/rear/. $(DESTDIR)$(datadir)/rear/ -find $(DESTDIR)$(datadir)/rear/ -name '.gitignore' -exec rm -rf {} \; &>/dev/null install-var: @echo -e "\033[1m== Installing working directory ==\033[0;0m" install -d -m0755 $(DESTDIR)$(localstatedir)/lib/rear/ install -d -m0755 $(DESTDIR)$(localstatedir)/log/rear/ install-doc: @echo -e "\033[1m== Installing documentation ==\033[0;0m" make -C doc install sed -i -e 's,/etc,$(sysconfdir),' \ -e 's,/usr/sbin,$(sbindir),' \ -e 's,/usr/share,$(datadir),' \ -e 's,/usr/share/doc/packages,$(datadir)/doc,' \ $(DESTDIR)$(mandir)/man8/rear.8 install: validate man install-config install-bin install-data install-var install-doc uninstall: @echo -e "\033[1m== Uninstalling Relax-and-Recover ==\033[0;0m" -rm -v $(DESTDIR)$(sbindir)/rear -rm -v $(DESTDIR)$(mandir)/man8/rear.8 -rm -rv $(DESTDIR)$(datadir)/rear/ # rm -rv $(DESTDIR)$(sysconfdir)/rear/ # rm -rv $(DESTDIR)$(localstatedir)/lib/rear/ dist: clean validate man dist/$(name)-$(distversion).tar.gz dist/$(name)-$(distversion).tar.gz: @echo -e "\033[1m== Building archive $(name)-$(distversion) ==\033[0;0m" rm -Rf build/$(name)-$(distversion) mkdir -p dist build/$(name)-$(distversion) tar -c --exclude-from=.gitignore --exclude=.gitignore --exclude=".??*" * | \ tar -C build/$(name)-$(distversion) -x @echo -e "\033[1m== Rewriting $(specfile), $(dscfile) and $(rearbin) ==\033[0;0m" sed -i.orig \ -e 's#^Source:.*#Source: https://sourceforge.net/projects/rear/files/rear/${version}/$(name)-${distversion}.tar.gz#' \ -e 's#^Version:.*#Version: $(version)#' \ -e 's#^%define rpmrelease.*#%define rpmrelease $(rpmrelease)#' \ -e 's#^%setup.*#%setup -q -n $(name)-$(distversion)#' \ build/$(name)-$(distversion)/$(specfile) sed -i.orig \ -e 's#^Version:.*#Version: $(version)-$(debrelease)#' \ build/$(name)-$(distversion)/$(dscfile) sed -i.orig \ -e 's#^readonly VERSION=.*#readonly VERSION=$(distversion)#' \ -e 's#^readonly RELEASE_DATE=.*#readonly RELEASE_DATE="$(release_date)"#' \ build/$(name)-$(distversion)/$(rearbin) tar -czf dist/$(name)-$(distversion).tar.gz -C build $(name)-$(distversion) srpm: dist @echo -e "\033[1m== Building SRPM package $(name)-$(distversion) ==\033[0;0m" rpmbuild -ts --clean --nodeps \ --define="_topdir $(CURDIR)/build/rpmbuild" \ --define="_sourcedir $(CURDIR)/dist" \ --define="_srcrpmdir $(CURDIR)/dist" \ --define "debug_package %{nil}" \ dist/$(name)-$(distversion).tar.gz rpm: srpm @echo -e "\033[1m== Building RPM package $(name)-$(distversion) ==\033[0;0m" rpmbuild --rebuild --clean \ --define="_topdir $(CURDIR)/build/rpmbuild" \ --define="_rpmdir $(CURDIR)/dist" \ --define "_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \ --define "debug_package %{nil}" \ dist/$(name)-$(version)-1*.src.rpm deb: dist @echo -e "\033[1m== Building DEB package $(name)-$(distversion) ==\033[0;0m" cp -r build/$(name)-$(distversion)/packaging/debian/ build/$(name)-$(distversion)/ cd build/$(name)-$(distversion) ; dch -v $(distversion) -b -M build package cd build/$(name)-$(distversion) ; debuild -us -uc -i -b --lintian-opts --profile debian mv build/$(name)_*deb dist/ pacman: BUILD_DIR = /tmp/rear-$(distversion) pacman: dist @echo -e "\033[1m== Building Pacman package $(name)-$(distversion) ==\033[0;0m" rm -rf $(BUILD_DIR) mkdir -p $(BUILD_DIR) cp packaging/arch/PKGBUILD.local $(BUILD_DIR)/PKGBUILD cp $(name)-$(distversion).tar.gz $(BUILD_DIR)/ cd $(BUILD_DIR) ; sed -i -e 's/VERSION/$(date)/' \ -e 's/SOURCE/$(name)-$(distversion).tar.gz/' \ -e 's/MD5SUM/$(shell md5sum $(name)-$(distversion).tar.gz | cut -d' ' -f1)/' \ PKGBUILD ; makepkg -c cp $(BUILD_DIR)/*.pkg.* . rm -rf $(BUILD_DIR) obs: BUILD_DIR = /tmp/rear-$(distversion) obs: obsname = $(shell osc ls $(obsproject) $(obspackage) | awk '/.tar.gz$$/ { gsub(".tar.gz$$","",$$1); print }') obs: dist @echo -e "\033[1m== Updating OBS from $(obsname) to $(name)-$(distversion)== \033[0;0m" ifneq ($(obsname),$(name)-$(distversion)) -rm -rf $(BUILD_DIR) mkdir -p $(BUILD_DIR) ifneq ($(OFFICIAL),) # osc rdelete -m 'Recreating branch $(obspackage)' $(obsproject) $(obspackage) -osc branch Archiving:Backup:Rear:Snapshot rear $(obsproject) $(obspackage) -osc detachbranch $(obsproject) $(obspackage) endif (cd $(BUILD_DIR) ; osc co -c $(obsproject) $(obspackage) ) -(cd $(BUILD_DIR)/$(obspackage) ; osc del *.tar.gz ) cp dist/$(name)-$(distversion).tar.gz $(BUILD_DIR)/$(obspackage) tar -xOzf dist/$(name)-$(distversion).tar.gz -C $(BUILD_DIR)/$(obspackage) $(name)-$(distversion)/$(specfile) >$(BUILD_DIR)/$(obspackage)/$(name).spec tar -xOzf dist/$(name)-$(distversion).tar.gz -C $(BUILD_DIR)/$(obspackage) $(name)-$(distversion)/$(dscfile) >$(BUILD_DIR)/$(obspackage)/$(name).dsc tar -xOzf dist/$(name)-$(distversion).tar.gz -C $(BUILD_DIR)/$(obspackage) $(name)-$(distversion)/packaging/debian/control >$(BUILD_DIR)/$(obspackage)/debian.control tar -xOzf dist/$(name)-$(distversion).tar.gz -C $(BUILD_DIR)/$(obspackage) $(name)-$(distversion)/packaging/debian/rules >$(BUILD_DIR)/$(obspackage)/debian.rules echo -e "rear ($(version)-$(debrelease)) stable; urgency=low\n\n * new snapshot build\n\n -- openSUSE Build Service $$(date -R)" >$(BUILD_DIR)/$(obspackage)/debian.changelog tar -xOzf dist/$(name)-$(distversion).tar.gz -C $(BUILD_DIR)/$(obspackage) $(name)-$(distversion)/packaging/debian/changelog >>$(BUILD_DIR)/$(obspackage)/debian.changelog tar -xOzf dist/$(name)-$(distversion).tar.gz -C $(BUILD_DIR)/$(obspackage) $(name)-$(distversion)/packaging/debian/compat >>$(BUILD_DIR)/$(obspackage)/debian.compat tar -xOzf dist/$(name)-$(distversion).tar.gz -C $(BUILD_DIR)/$(obspackage) $(name)-$(distversion)/packaging/debian/copyright >>$(BUILD_DIR)/$(obspackage)/debian.copyright cd $(BUILD_DIR)/$(obspackage); osc addremove cd $(BUILD_DIR)/$(obspackage); osc ci -m "Update to $(name)-$(distversion)" $(BUILD_DIR)/$(obspackage) rm -rf $(BUILD_DIR) @echo -e "\033[1mNow visit https://build.opensuse.org/package/show?package=rear&project=$(obsproject)" @echo -e "or inspect the queue at: https://build.opensuse.org/monitor\033[0;0m" else @echo -e "OBS already updated to this release." endif rear-2.3/README.adoc000066400000000000000000000252331321646673500141160ustar00rootroot00000000000000Relax-and-Recover ================= image:https://travis-ci.org/rear/rear.svg?branch=master["Build Status", link="https://travis-ci.org/rear/rear"] Relax-and-Recover is the leading Open Source bare metal disaster recovery and system migration solution. It is a modular framework with many ready-to-go workflows for common situations. Relax-and-Recover produces a bootable image. This image can repartition the system. Once that is done it initiates a restore from backup. Restores to different hardware are possible. Relax-and-Recover can therefore be used as a migration tool as well. Currently Relax-and-Recover supports various boot media (incl. ISO, PXE, OBDR tape, USB or eSATA storage), a variety of network protocols (incl. sftp, ftp, http, nfs, cifs) as well as a multitude of backup strategies (incl. IBM TSM, HP DataProtector, Symantec NetBackup, Bacula, rsync, Borg). Relax-and-Recover was designed to be easy to set up, requires no maintenance and is there to assist when disaster strikes. Its setup-and-forget nature removes any excuse for not having a disaster recovery solution implemented. Recovering from disaster is made straightforward by a 2-step recovery process so that it can be executed by operational teams when required. When used interactively (e.g. when used for migrating systems), menus help make decisions to restore to a new (hardware) environment. Extending and integrating Relax-and-Recover into complex environments is made possible by its modular framework. Consistent logging and optionally extended output help understand the concepts behind Relax-and-Recover, troubleshoot during initial configuration and help debug during integration. <> See <> for more detailed information about Relax-and-Recover. REQUIREMENTS ------------ Relax-and-Recover is written entirely in Bash and does not require any external programs. However, the rescue system that is created by Relax-and-Recover requires some programs that are needed to make our rescue system work: - mingetty or agetty - sfdisk or parted - grub2-efi-modules or similar package that provides Grub2 modules (/usr/lib/grub(2)/) if USB recovery on EFI is used All other required programs (like sort, dd, grep, etc.) are so common, that we don't list them as requirements. In case your specific workflow requires additional tools, Relax-and-Recover will tell you. INSTALLATION ------------ On RPM based systems you should use the rear RPM package. Either obtain it from the Relax-and-Recover homepage or build it yourself from the source tree with: make rpm This will create an RPM for your distribution. The RPM is not platform- dependent and should work also on other RPM based distributions. On DEB based systems you can execute the command: make deb QUICK START GUIDE ----------------- This quick start guide will show you how to run Relax-and-Recover from the git checkout and create a bootable USB backup. Start by cloning the Relax-and-Recover sources from Github: git clone https://github.com/rear/rear.git Move into the rear/ directory: cd rear/ Prepare your USB media. Change /dev/sdb to the correct device in your situation. Relax-and-Recover will 'own' the device in this example. ***This will destroy all data on that device.*** sudo usr/sbin/rear format /dev/sdb Relax-and-Recover asks you to confirm that you want to format the device: Yes The device has been labeled REAR-000 by the 'format' workflow. Now edit the 'etc/rear/local.conf' configuration file: ---- cat > etc/rear/local.conf < Using log file: /var/log/rear/rear-.log Creating disk layout Creating root filesystem layout Copying files and directories Copying binaries and libraries Copying kernel modules Creating initramfs Writing MBR to /dev/sdb Copying resulting files to usb location ---- You might want to check the log file for possible errors or see what Relax-and-Recover is doing. Now reboot your system and try to boot from the USB device. If that worked, you can dive into the advanced Relax-and-Recover options and start creating full backups. If your USB device has enough space, initiate a backup using: sudo usr/sbin/rear -v mkbackup That is it. You are now better prepared for failure ! CONFIGURATION ------------- To configure Relax-and-Recover you have to edit the configuration files in '/etc/rear/'. All '*.conf' files there are part of the configuration, but only 'site.conf' and 'local.conf' are intended for the user configuration. All other configuration files hold defaults for various distributions and should not be changed. In '/etc/rear/templates/' there are also some template files which are use by Relax-and-Recover to create configuration files (mostly for the boot environment). You can use these templates to prepend your own configurations to the configuration files created by Relax-and-Recover, for example you can edit 'PXE_pxelinux.cfg' to add some general pxelinux configuration you use (I put there stuff to install Linux over the network). In almost all circumstances you have to configure two main settings and their parameters: The +BACKUP+ method and the +OUTPUT+ method. The backup method defines, how your data was saved and whether Relax-and-Recover should backup your data as part of the mkrescue process or whether you use an external application, e.g. backup software to archive your data. The output method defines how the rescue system is written to disk and how you plan to boot the failed computer from the rescue system. See '/usr/share/rear/conf/default.conf' for an overview of the possible methods and their options. An example to use TSM for backup and PXE for output and would be to add these lines to '/etc/rear/local.conf': ---- BACKUP=TSM OUTPUT=PXE ---- And since all your computers use NTP for time synchronisation, you should also add these lines to '/etc/rear/site.conf': ---- TIMESYNC=NTP ---- Don't forget to distribute the 'site.conf' to all your systems. The resulting PXE files (kernel, initrd and pxelinux configuration) will be written to files in '/var/lib/rear/output/'. You can now modify the behaviour by copying the appropriate configuration variables from 'default.conf' to 'local.conf' and changing them to suit your environment. USAGE ----- To use Relax-and-Recover you always call the main script '/usr/sbin/rear': ---- # rear help Usage: rear [-h|--help] [-V|--version] [-dsSv] [-D|--debugscripts SET] [-c DIR] [-C CONFIG] [-r KERNEL] [--] COMMAND [ARGS...] Relax-and-Recover comes with ABSOLUTELY NO WARRANTY; for details see the GNU General Public License at: http://www.gnu.org/licenses/gpl.html Available options: -h --help usage information -c DIR alternative config directory; instead of /etc/rear -C CONFIG additional config file; absolute path or relative to config directory -d debug mode; log debug messages -D debugscript mode; log every function call (via 'set -x') --debugscripts SET same as -d -v -D but debugscript mode with 'set -SET' -r KERNEL kernel version to use; current: '3.12.49-3-default' -s simulation mode; show what scripts rear would include -S step-by-step mode; acknowledge each script individually -v verbose mode; show more output -V --version version information List of commands: checklayout check if the disk layout has changed dump dump configuration and system information format format and label media for use with rear mkbackup create rescue media and backup system mkbackuponly backup system without creating rescue media mkrescue create rescue media only recover recover the system restoreonly only restore the backup validate submit validation information Use 'rear -v help' for more advanced commands. ---- To view/verify your configuration, run +rear dump+. It will print out the current settings for +BACKUP+ and +OUTPUT+ methods and some system information. To create a new rescue environment, simply call +rear mkrescue+. Do not forget to copy the resulting rescue system away so that you can use it in the case of a system failure. Use +rear mkbackup+ instead if you are using the builtin backup functions (like +BACKUP=NETFS+) To recover your system, start the computer from the rescue system and run +rear recover+. Your system will be recovered and you can restart it and continue to use it normally. AUTHORS AND MAINTAINERS ----------------------- The ReaR project was initiated in 2006 by https://github.com/schlomo[Schlomo Schapiro] and https://github.com/gdha[Gratien D'haese] and has since then seen a lot of contributions by many authors. As ReaR deals with bare metal disaster recovery, there is a large amount of code that was contributed by owners and users of specialized hardware and software. Without their combined efforts and contributions ReaR would not be the universal Linux bare metal disaster recovery solution that it is today. As time passed the project was lucky to get the support of additional developers to also help as maintainers: https://github.com/dagwieers[Dag Wieers], https://github.com/jhoekx[Jeroen Hoekx], https://github.com/jsmeix[Johannes Meixner], https://github.com/gozora[Vladimir Gozora] and https://github.com/schabrolles[Sébastien Chabrolles]. We hope that ReaR continues to prove useful and to attract more developers who agree to be maintainers. Please refer to the link:MAINTAINERS[MAINTAINERS] file for the list of active and past maintainers. To see the full list of authors and their contributions please look at the https://github.com/rear/rear/graphs/contributors[git history]. We are very thankful to all authors and encourage anybody interested to take a look at our source code and to contribute what you find important. REFERENCES ---------- * http://relax-and-recover.org/documentation/[Relax-and-Recover Documentation] * http://relax-and-recover.org/support/[Relax-and-Recover Support] * http://relax-and-recover.org/events/[Relax-and-Recover Events] * https://github.com/rear/rear/issues[Relax-and-Recover Issues] * http://relax-and-recover.org/support/sponsors[Relax-and-Recover Sponsoring] rear-2.3/doc/000077500000000000000000000000001321646673500130715ustar00rootroot00000000000000rear-2.3/doc/Makefile000066400000000000000000000011071321646673500145300ustar00rootroot00000000000000prefix = /usr datadir = $(prefix)/share mandir = $(datadir)/man adoctargets = $(shell echo *.adoc) htmltargets = $(patsubst %.adoc, %.html, $(adoctargets)) all: docs dist: docs man: rear.8 docs: rear.8 $(htmltargets) make -C user-guide docs install: rear.8 install -Dp -m0644 rear.8 $(DESTDIR)$(mandir)/man8/rear.8 clean: rm -f unconv.8 *.html *.xml make -C user-guide clean %.8.html: %.8.adoc asciidoc -a footer-style=none -d manpage $< %.8: %.8.xml xmlto man $< %.html: %.adoc asciidoc -a footer-style=none $< %.8.xml: %.8.adoc asciidoc -b docbook -d manpage $< rear-2.3/doc/mappings/000077500000000000000000000000001321646673500147075ustar00rootroot00000000000000rear-2.3/doc/mappings/disk_devices.example000066400000000000000000000000611321646673500207150ustar00rootroot00000000000000# old device new device /dev/cciss/c0d0 /dev/sda rear-2.3/doc/mappings/ip_addresses.example000066400000000000000000000001151321646673500207260ustar00rootroot00000000000000# device name ip-address/cidr or dhcp # #eth0 213.203.238.113/25 #eth0 dhcp rear-2.3/doc/mappings/mac.example000066400000000000000000000001551321646673500170250ustar00rootroot00000000000000# old mac new mac device 00:11:85:c2:b8:d5 00:50:56:b3:75:ad eth0 00:11:85:c2:b8:d7 00:50:56:b3:08:8c eth1 rear-2.3/doc/mappings/routes.example000066400000000000000000000001341321646673500176030ustar00rootroot00000000000000# destination router device default 213.203.238.1 eth0 192.168.33.0/24 213.203.238.45 eth0 rear-2.3/doc/rear-presentation.adoc000066400000000000000000000231121321646673500173620ustar00rootroot00000000000000= Relax-and-Recover: Disaster Recovery and System Migration solution (2015) Dag Wieers _This presentation is written in AsciiDoc and can be converted to a LibreOffice/OpenOffice presentation using http://github.com/dagwieers/asciidoc-odf[asciidoc-odf]._ //// == Who is Dag Wieers ? * Linux and Open Source consultant - Worked at IBM Belgium, now self-employed to provide advice, design, automation, maintenance * Involved in various Open Source communities - incl. RPMforge, ELRepo, CentOS, syslinux, AsciiDoc, LibreOffice, docbook2odf, Relax-and-Recover * Author of various tools - incl. dstat, unoconv, mrepo, proxytunnel, wiipresent, dconf, asciidoc-odf //// == What is Relax-and-Recover ? _Tool that implements a DR workflow for Linux_ Which basically means ? - Easy to deploy (set up and forget) - Makes recovery as easy as possible - Complete bare-metal disaster recovery - Integration for various Linux technologies - Integration with various back-up solutions - Modular framework written in Bash - Easy to extend to own needs == How does Relax-and-Recover work ? Relax-and-Recover builds a rescue image from the existing installation - Restored system is an accurate copy - Restored system supports the hardware - Exotic setups (kernel, hardware) guaranteed to work - What worked before keeps on working - Recovery is fully automated Backup software is integrated into rescue image - With a working configuration == Why is a backup not sufficient ? Backup only covers storing data safely/securely - Often only the data is available - DR is a manual and time-consuming process So manual disaster recovery risks: - unknown system storage and network configuration - incompatibilities between firmware/software/hardware * using newer tools with older data (or vice versa) * hardware is not supported - making manual mistakes (again and again) - working against the clock amidst chaos - frustration == What does Relax-and-Recover bring to the table ? But the Relax-and-Recover rescue image takes care of the complete recovery process until the system runs: - enabling the network and remote access - using tools to recreate an accurate/working copy - recreating hardware and software RAID - partitioning and creating file systems - starting the backup restore process - restoring the bootloader == Relax-and-Recover functionality * Supported storage technologies - HP SmartArray, SW RAID, DRBD, LVM, multipath - ext2/ext3/ext4, xfs, jfs, vfat, btrfs, LUKS * Boot media or remote storage - OBDR tape, ISO, USB, eSATA, network booting - NFS, CIFS, rsync, HTTP, FTP, SFTP, ... * Back-up backends - IBM TSM, HP DataProtector, Symantec NetBackup, FDR/Upstream, Bacula, tar, rsync, Borg == How is Relax-and-Recover used ? * Creating boot media: +rear mkrescue+ - Copies kernel, modules, minimal system - Saves storage layout, network configuration - Write boot media * Restore system - Boot Relax-and-Recover media - Optionally, modify storage/network config - Run: +rear recover+ - Relax-and-Recover parses layout then creates diskrestore script - Relax-and-Recover initiates restore or prompts for restore == Relax-and-Recover on a running system [ditaa] ---- /-------------+ /-----------+ /-----------+ | Storage | | Collect | | Integrate | | layout | ----> | new | ----> | required | | change | | storage | | backup | | detected | | layout | | strategy | +-------------/ +-----------/ +-----------/ | V /-------------+ /-----------+ /-----------+ | Off-site | | Push | | Create | | storage | <---- | recovery | <---- | new | | together | | image | | recovery | | with backup | | centrally | | image | +-------------/ +-----------/ +-----------/ ---- == Nifty features to help relax * Local GRUB integration (password protected) * Serial console support (think: disaster) * History-stuffing during recovery * Network and SSH key integration * Layout code guides you through recovery - Menu's and command-line in one session - Provides original storage info * Beep, UID led and USB suspend integration * Syslinux management * Log-file on recovery media == Use case: Belgian Federal Police /1 * Requirements: - About 200 sites with each a set of Linux servers - Each server comes with a tape-drive - Single bootable tape to: ** Restore complete system ** Restore from back-up - Support for various technologies ** HP SmartArray, SW RAID, DRBD, LVM ** OBDR, Bacula tape support ** RHEL 4, RHEL5 and RHEL6 support - End-user documentation in 3 languages == Use case: Belgian Federal Police /2 * Solution: - All requirements implement but... - New systems didn't support bootable tape (OBDR) - USB is much more flexible than tape ** Can store multiple rescue images ** Can store rescue images of multiple servers ** Easier workflow (udev): insert, wait, pull (2 min max) ** Cheaper ** Implementation is more reliable - Bonus implementation of flexible layout - Support migration scenarios == Use case: Belgian Federal Police /3 * Relax-and-Recover config for USB rescue media: [source,bash] ---- BACKUP=BACULA OUTPUT=USB USB_DEVICE=/dev/disk/by-label/REAR-000 ---- * Relax-and-Recover config for USB backup media: [source,bash] ---- BACKUP=NETFS OUTPUT=USB USB_DEVICE=/dev/disk/by-label/REAR-000 ONLY_INCLUDE_VG=( vg00 ) EXCLUDE_MOUNTPOINTS=( /data ) ---- == Use case: Belgian Federal Police /4 * Relax-and-Recover config for OBDR rescue tapes: [source,bash] ---- BACKUP=BACULA OUTPUT=OBDR BEXTRACT_DEVICE=Ultrium-1 BEXTRACT_VOLUME=VOL-* ---- * Relax-and-Recover config for OBDR backup tapes: [source,bash] ---- BACKUP=NETFS OUTPUT=OBDR TAPE_DEVICE=/dev/nst0 ---- == Use case: Centralized images /1 * Requirements: - Remote rescue images - Removable media for off-site storage - Easy restore of physical hosts and guests * Solution: - Cron creates image when Relax-and-Recover detects change - Images pushed through HTTP to PXE server/host - Stored on USB disks, rotated every week == Use case: Centralized images /2 * Label USB disk(s) and mount * Configure Apache to allow HTTP PUT to USB disk * Relax-and-Recover config in _/etc/rear/local.conf_: [source,bash] ---- BACKUP=BACULA OUTPUT=ISO ISO_URL=http://server:port/path/ ---- * Relax-and-Recover cron-job at /etc/cron.d/rear: ---- 30 0 1 * * root /usr/sbin/rear mkrescue 30 1 * * * root /usr/sbin/rear checklayout || /usr/sbin/rear mkrescue ---- == Relax-and-Recover command line /1 ---- [root@moria rear]# rear help Usage: $PROGRAM [-h|--help] [-V|--version] [-dsSv] [-D|--debugscripts SET] [-c DIR] [-r KERNEL] [--] COMMAND [ARGS...] -snip- List of commands: checklayout check if the disk layout has changed dump dump configuration and system information format format and label media for use with rear mkbackup create rescue media and backup system mkbackuponly backup system without creating rescue media mkrescue create rescue media only recover recover the system; valid during rescue validate submit validation information Use 'rear -v help' for more advanced commands. ---- == Relax-and-Recover command line /2 ---- [root@moria rear]# rear help Usage: $PROGRAM [-h|--help] [-V|--version] [-dsSv] [-D|--debugscripts SET] [-c DIR] [-r KERNEL] [--] COMMAND [ARGS...] Available options: -h --help usage information -c DIR alternative config directory; instead of /etc/rear -d debug mode; log debug messages -D debugscript mode; log every function call (via 'set -x') --debugscripts SET same as -d -v -D but debugscript mode with 'set -SET' -r KERNEL kernel version to use; current: '$KERNEL_VERSION' -s simulation mode; show what scripts rear would include -S step-by-step mode; acknowledge each script individually -v verbose mode; show more output -V --version version information -snip- ---- == Hacking on Relax-and-Recover * It is Bash ! *Join the mailinglist * Understand modular framework and workflows - Use: +rear -s + * Logging - Logfile in: _/var/log/rear/rear-.log_ * Debugging - Verbose: +rear -v+ - Debug: +rear -d+ - Tracing: +rear -D+ == Project future * Functionality - Improved rsync support (like rsnapshot or rbme) - More back-up backend integration - PXE integration * Development - Re-organize code base - Release management needs a process - Website and documentation not up-to-date - Change of development tools ? == Development team Consists of: - Schlomo Schapiro (original author) - Gratien D'haese (original author) - Jeroen Hoekx (new contributor) - Dag Wieers (new contributor) and various other contributors Development at Github - http://relax-and-recover.org/ - rear-users@lists.relax-and-recover.org == Thank you for listening Any questions, ideas, pull-requests ? == Live USB demo * Demo USB/udev integration (check udev config !) - Prepare USB stick: +rear format /dev/sdb+ - Re-insert USB stick and wait until light goes out * Demo restore procedure (disable udev rule !) - Boot from KVM virtual machine - Re-insert USB stick and start virt-manager - Create VM with 4GB disk and boot VM - Show bash history and perform: +rear recover+ - Show menu system and modify sizes rear-2.3/doc/rear.8000066400000000000000000000540521321646673500141210ustar00rootroot00000000000000'\" t .\" Title: rear .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: 14 December 2017 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" .TH "REAR" "8" "14 December 2017" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" rear \- bare metal disaster recovery and system migration tool .SH "SYNOPSIS" .sp \fBrear\fR [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] [\fB\-dsSv\fR] [\fB\-D\fR|\fB\-\-debugscripts\fR \fISET\fR] [\fB\-c\fR \fIDIR\fR] [\fB\-C\fR \fICONFIG\fR] [\fB\-r\fR \fIKERNEL\fR] [\-\-] \fICOMMAND\fR [\fIARGS\fR\&...] .SH "DESCRIPTION" .sp Relax\-and\-Recover is the leading Open Source disaster recovery solution\&. It is a modular framework with many ready\-to\-go workflows for common situations\&. .sp Relax\-and\-Recover produces a bootable image\&. This image can repartition the system\&. Once that is done it initiates a restore from backup\&. Restores to different hardware are possible\&. Relax\-and\-Recover can therefore be used as a migration tool as well\&. .sp Currently Relax\-and\-Recover supports various boot media (incl\&. ISO, PXE, OBDR tape, USB or eSATA storage), a variety of network protocols (incl\&. sftp, ftp, http, nfs, cifs) for storage and backup as well as a multitude of backup strategies (incl\&. IBM Tivoli Storage Manager, HP DataProtector, Symantec NetBackup, EMC NetWorker, FDR/Upstream, NovaBACKUP DC, Bareos, Bacula, rsync, rbme, Borg)\&. This results in a bootable image that is capable of booting via PXE, DVD/CD, bootable tape or virtual provisioning\&. .sp Relax\-and\-Recover was designed to be easy to set up, requires no maintenance and is there to assist when disaster strikes\&. Its setup\-and\-forget nature removes any excuses for not having a disaster recovery solution implemented\&. .sp Recovering from disaster is made very straight\-forward by a 2\-step recovery process so that it can be executed by operational teams when required\&. When used interactively (e\&.g\&. when used for migrating systems), menus help make decisions to restore to a new (hardware) environment\&. .sp Extending Relax\-and\-Recover is made possible by its modular framework\&. Consistent logging and optionally extended output help understand the concepts behind Relax\-and\-Recover and help debug during development\&. .sp Relax\-and\-Recover comes with ABSOLUTELY NO WARRANTY; for details see the GNU General Public License at: \m[blue]\fBhttp://www\&.gnu\&.org/licenses/gpl\&.html\fR\m[] .SH "OPTIONS" .SS "GLOBAL OPTIONS" .PP \-h \-\-help .RS 4 usage information .RE .PP \-c DIR .RS 4 alternative config directory; instead of /etc/rear .RE .PP \-C CONFIG .RS 4 additional config file; absolute path or relative to config directory .RE .PP \-d .RS 4 \fBdebug mode\fR (log debug messages to log file \- also sets \-v) .RE .PP \-D .RS 4 \fBdebugscript mode\fR (log executed commands via \fIset \-x\fR \- also sets \-v and \-d) .RE .PP \-\-debugscripts SET .RS 4 same as \-d \-v \-D but \fBdebugscript mode\fR with \fIset \-SET\fR .RE .PP \-r KERNEL .RS 4 kernel version to use (by default use running kernel) .RE .PP \-s .RS 4 \fBsimulation mode\fR (show what scripts are run without executing them) .RE .PP \-S .RS 4 \fBstep\-by\-step mode\fR (acknowledge each script individually) .RE .PP \-v .RS 4 \fBverbose mode\fR (show more output and run many commands in verbose mode) .RE .PP \-V \-\-version .RS 4 version information .RE .SS "COMMANDS" .PP \fBchecklayout\fR .RS 4 check if the disk layout has changed since the last run of mkbackup/mkrescue .RE .PP \fBdump\fR .RS 4 dump configuration and system information; please run this to verify your setup .RE .PP \fBformat\fR .RS 4 format and label USB or tape media to be used with rear; first argument is the USB or tape device to use, eg\&. \fI/dev/sdX\fR or \fI/dev/stX\fR .RE .PP \fBhelp\fR .RS 4 print full list of commands and options .RE .PP \fBmkbackup\fR .RS 4 create rescue media and backup the system (only for internal backup methods) .RE .PP \fBmkbackuponly\fR .RS 4 backup the system (only for internal backup methods) without creating rescue media .RE .PP \fBmkrescue\fR .RS 4 create rescue media only .RE .PP \fBrecover\fR .RS 4 recover the system; can be used only when running from the rescue media .RE .PP \fBrestoreonly\fR .RS 4 only restore the backup; can be used only when running from the rescue media .RE .PP \fBvalidate\fR .RS 4 submit validation information .RE .sp Use \fIrear \-v help\fR for more advanced commands\&. .SH "BACKGROUND INFORMATION" .sp The process of bare metal disaster recovery consists of two parts: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Recreate the system layout .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Restore the data to the system .RE .sp Most backup software solutions are very good at restoring data but do not support recreating the system layout\&. Relax\-and\-Recover is very good at recreating the system layout but works best when used together with supported backup software\&. .sp In this combination Relax\-and\-Recover recreates the system layout and calls the backup software to restore the actual data\&. Thus there is no unnecessary duplicate data storage and the Relax\-and\-Recover rescue media can be very small\&. .sp For demonstration and special use purposes Relax\-and\-Recover also includes an internal backup method, NETFS, which can be used to create a simple tar\&.gz archive of the system\&. For all permanent setups we recommend using something more professional for backup, either a traditional backup software (open source or commercial) or rsync with hardlink based solutions, e\&.g\&. RSYNC BACKUP MADE EASY\&. .SH "RESCUE IMAGE CONFIGURATION" .sp The OUTPUT variable defines from where our bootable rescue image will be booted and the OUTPUT_URL variable defines where the rescue image should be send to\&. Possible OUTPUT setting are: .PP OUTPUT=\fBRAMDISK\fR .RS 4 Create only the Relax\-and\-Recover initramfs\&. .RE .PP OUTPUT=\fBISO\fR .RS 4 \fB(Default)\fR Create a bootable ISO9660 image on disk as \fIrear\-$(hostname)\&.iso\fR .RE .PP OUTPUT=\fBPXE\fR .RS 4 Create on a remote PXE/NFS server the required files (such as configuration file, kernel and initrd image .RE .PP OUTPUT=\fBOBDR\fR .RS 4 Create a bootable OBDR tape (optionally including the backup archive)\&. Specify the OBDR tape device by using TAPE_DEVICE\&. .RE .PP OUTPUT=\fBUSB\fR .RS 4 Create a bootable USB disk (using extlinux)\&. Specify the USB storage device by using USB_DEVICE\&. .RE .sp When using OUTPUT=ISO, RAMDISK, OBDR or USB you should provide the backup target location through the OUTPUT_URL variable\&. Possible OUTPUT_URL settings are: .PP OUTPUT_URL=\fBfile://\fR .RS 4 Write the image to disk\&. The default is in \fI/var/lib/rear/output/\fR\&. .RE .PP OUTPUT_URL=\fBnfs://\fR .RS 4 Write the image by mounting the target filesystem via NFS\&. .RE .PP OUTPUT_URL=\fBcifs://\fR .RS 4 Write the image by mounting the target filesystem via CIFS\&. .RE .PP OUTPUT_URL=\fBfish://\fR .RS 4 Write the image using lftp and the FISH protocol\&. .RE .PP OUTPUT_URL=\fBftp://\fR .RS 4 Write the image using lftp and the FTP protocol\&. .RE .PP OUTPUT_URL=\fBftps://\fR .RS 4 Write the image using lftp and the FTPS protocol\&. .RE .PP OUTPUT_URL=\fBhftp://\fR .RS 4 Write the image using lftp and the HFTP protocol\&. .RE .PP OUTPUT_URL=\fBhttp://\fR .RS 4 Write the image using lftp and the HTTP (PUT) procotol\&. .RE .PP OUTPUT_URL=\fBhttps://\fR .RS 4 Write the image using lftp and the HTTPS (PUT) protocol\&. .RE .PP OUTPUT_URL=\fBsftp://\fR .RS 4 Write the image using lftp and the secure FTP (SFTP) protocol\&. .RE .PP OUTPUT_URL=\fBrsync://\fR .RS 4 Write the image using rsync and the RSYNC protocol\&. .RE .PP OUTPUT_URL=\fBsshfs://\fR .RS 4 Write the image using sshfs and the SSH protocol\&. .RE .PP OUTPUT_URL=\fBnull\fR .RS 4 Do not copy the ISO image from \fI/var/lib/rear/output/\fR to a remote output location\&. OUTPUT_URL=null is useful when another program (e\&.g\&. an \fIexternal\fR backup program) is used to save the ISO image from the local system to a remote place, or with BACKUP_URL=iso:///backup when the backup is included in the ISO image to avoid a (big) copy of the ISO image at a remote output location\&. In the latter case the ISO image must be manually saved from the local system to a remote place\&. OUTPUT_URL=null is only supported together with BACKUP=NETFS\&. .RE .sp If you do not specify OUTPUT_URL variable then by default it will be aligned to what was defined by variable BACKUP_URL\&. And, the ISO image will then be copied to the same location as your backup of the system disk(s)\&. .sp The ISO_DEFAULT variable defines what default boot option is used on the rescue image\&. Possible values are manual, boothd or automatic\&. Manual will make you boot into the shell directly by default, boothd will boot to the first disk (default) or automatic will automatically start in recovery mode\&. .SH "BACKUP SOFTWARE INTEGRATION" .sp Currently Relax\-and\-Recover supports the following backup methods\&. Please distinguish carefully between Relax\-and\-Recover support for 3rd party backup software and Relax\-and\-Recover internal backup methods\&. The latter also creates a backup of your data while the former will only integrate Relax\-and\-Recover with the backup software to restore the data with the help of the backup software without actually creating backups\&. This means that for all non\-internal backup software you \fBmust\fR take care of creating backups yourself\&. .sp Especially the rear mkbackup command can be confusing as it is only useful for the internal backup methods and has no function at all with the other (external) backup methods\&. .sp The following backup methods need to be set in Relax\-and\-Recover with the BACKUP option\&. As mentioned we have two types of BACKUP methods \- \fIinternal\fR and \fIexternal\fR\&. .sp The following BACKUP methods are \fIexternal\fR of Relax\-and\-Recover meaning that you are responsible of backups being made: .PP BACKUP=\fBREQUESTRESTORE\fR .RS 4 \fB(default)\fR Not really a backup method at all, Relax\-and\-Recover simply halts the recovery and requests that somebody will restore the data to the appropriate location (e\&.g\&. via SSH)\&. This method works especially well with an rsync based backup that is pushed back to the backup client\&. .RE .PP BACKUP=\fBEXTERNAL\fR .RS 4 Internal backup method that uses an arbitrary external command to create a backup and restore the data\&. .RE .PP BACKUP=\fBDP\fR .RS 4 Use HP Data Protector to restore the data\&. .RE .PP BACKUP=\fBFDRUPSTREAM\fR .RS 4 Use FDR/Upstream to restore the data\&. .RE .PP BACKUP=\fBGALAXY\fR .RS 4 Use CommVault Galaxy 5 to restore the data\&. .RE .PP BACKUP=\fBGALAXY7\fR .RS 4 Use CommVault Galaxy 7 to restore the data\&. .RE .PP BACKUP=\fBGALAXY10\fR .RS 4 Use CommVault Galaxy 10 (or Simpana 10) to restore the data\&. .RE .PP BACKUP=\fBNBU\fR .RS 4 Use Symantec NetBackup to restore the data\&. .RE .PP BACKUP=\fBTSM\fR .RS 4 Use IBM Tivoli Storage Manager to restore the data\&. The Relax\-and\-Recover result files (e\&.g\&. ISO image) are also saved into TSM\&. .RE .PP BACKUP=\fBNSR\fR .RS 4 Using EMC NetWorker (Legato) to restore the data\&. .RE .PP BACKUP=\fBSESAM\fR .RS 4 Using SEP Sesam to restore the data\&. .RE .PP BACKUP=\fBNBKDC\fR .RS 4 Using Novastor NovaBACKUP DC to restore the data\&. .RE .PP BACKUP=\fBRBME\fR .RS 4 Use Rsync Backup Made Easy (rbme) to restore the data\&. .RE .PP BACKUP=\fBBAREOS\fR .RS 4 Use Open Source backup solution BAREOS (a fork a BACULA) to restore the data\&. .RE .PP BACKUP=\fBBACULA\fR .RS 4 Use Open Source backup solution BACULA to restore the data\&. .RE .PP BACKUP=\fBDUPLICITY\fR .RS 4 Use encrypted bandwidth\-efficient backup solution using the rsync algorithm to restore the data\&. .RE .PP BACKUP=\fBBORG\fR .RS 4 Use BorgBackup (short Borg) a deduplicating backup program to restore the data\&. .RE .sp The following BACKUP methods are \fIinternal\fR of Relax\-and\-Recover: .PP BACKUP=\fBNETFS\fR .RS 4 Internal backup method which can be used to create a simple backup (tar archive)\&. .RE .PP BACKUP=\fBRSYNC\fR .RS 4 Use rsync to restore data\&. .RE .sp If your favourite backup software is missing from this list, please submit a patch or ask us to implement it for you\&. .sp When using BACKUP=NETFS you must provide the backup target location through the BACKUP_URL variable\&. Possible BACKUP_URL settings are: .PP BACKUP_URL=\fBfile://\fR .RS 4 To backup to local disk, use BACKUP_URL=file:///directory/path/ .RE .PP BACKUP_URL=\fBnfs://\fR .RS 4 To backup to NFS disk, use BACKUP_URL=nfs://nfs\-server\-name/share/path .RE .PP BACKUP_URL=\fBtape://\fR .RS 4 To backup to tape device, use BACKUP_URL=tape:///dev/nst0 or alternatively, simply define TAPE_DEVICE=/dev/nst0 .RE .PP BACKUP_URL=\fBrsync://\fR .RS 4 When backup method BACKUP=RSYNC is chosen then we need to define a corresponding BACKUP_URL rule: .sp .if n \{\ .RS 4 .\} .nf BACKUP_URL=rsync://[user@]host[:port]/path BACKUP_URL=rsync://[user@]host[:port]::/path .fi .if n \{\ .RE .\} .RE .PP BACKUP_URL=\fBcifs://\fR .RS 4 To backup to a Samba share (CIFS), use BACKUP_URL=cifs://cifs\-server\-name/share/path\&. To provide credentials for CIFS mounting use a \fI/etc/rear/cifs\fR credentials file and define BACKUP_OPTIONS="cred=/etc/rear/cifs" and pass along: .sp .if n \{\ .RS 4 .\} .nf username=_username_ password=_secret password_ domain=_domain_ .fi .if n \{\ .RE .\} .RE .PP BACKUP_URL=\fBusb://\fR .RS 4 To backup to USB storage device, use BACKUP_URL=usb:///dev/disk/by\-path/REAR\-000 or use a real device node or a specific filesystem label\&. Alternatively, you can specify the device using USB_DEVICE=/dev/disk/by\-path/REAR\-000\&. .sp If you combine this with OUTPUT=USB you will end up with a bootable USB device\&. .RE .PP BACKUP_URL=\fBsshfs://\fR .RS 4 To backup to a remote server via sshfs (SSH protocol), use BACKUP_URL=sshfs://user@remote\-system\&.name\&.org/home/user/backup\-dir/ .sp It is advisable to add \fBServerAliveInterval 15\fR in the /root/\&.ssh/config file for the remote system (remote\-system\&.name\&.org)\&. .RE .PP BACKUP_URL=\fBiso://\fR .RS 4 To include the backup within the ISO image\&. It is important that the BACKUP_URL and OUTPUT_URL variables are different\&. E\&.g\&. .sp .if n \{\ .RS 4 .\} .nf BACKUP_URL=iso:///backup/ OUTPUT_URL=nfs://server/path/ .fi .if n \{\ .RE .\} .RE .sp When using BACKUP=NETFS and BACKUP_PROG=tar there is an option to select BACKUP_TYPE=incremental or BACKUP_TYPE=differential to let rear make incremental or differential backups until the next full backup day e\&.g\&. via FULLBACKUPDAY="Mon" is reached or when the last full backup is too old after FULLBACKUP_OUTDATED_DAYS has passed\&. Incremental or differential backup is currently only known to work with BACKUP_URL=nfs\&. Other BACKUP_URL schemes may work but at least BACKUP_URL=usb requires USB_SUFFIX to be set to work with incremental or differential backup\&. .SH "CONFIGURATION" .sp To configure Relax\-and\-Recover you have to edit the configuration files in \fI/etc/rear/\fR\&. All \fI*\&.conf\fR files there are part of the configuration, but only \fIsite\&.conf\fR and \fIlocal\&.conf\fR are intended for the user configuration\&. All other configuration files hold defaults for various distributions and should not be changed\&. .sp In \fI/etc/rear/templates/\fR there are also some template files which are used by Relax\-and\-Recover to create configuration files (mostly for the boot environment)\&. Modify the templates to adjust the information contained in the emails produced by Relax\-and\-Recover\&. You can use these templates to prepend your own configurations to the configuration files created by Relax\-and\-Recover, for example you can edit \fIPXE_pxelinux\&.cfg\fR to add some general pxelinux configuration you use\&. .sp In almost all circumstances you have to configure two main settings and their parameters: The backup method and the output method\&. .sp The backup method defines, how your data was saved and whether Relax\-and\-Recover should backup your data as part of the mkrescue process or whether you use an external application, e\&.g\&. backup software to archive your data\&. .sp The output method defines how the rescue system is written to disk and how you plan to boot the failed computer from the rescue system\&. .sp See the default configuration file \fI/usr/share/rear/conf/default\&.conf\fR for an overview of the possible methods and their options\&. .sp An example to use TSM for backup and ISO for output would be to add these lines to \fI/etc/rear/local\&.conf\fR (no need to define a BACKUP_URL when using an external backup solution): .sp .if n \{\ .RS 4 .\} .nf BACKUP=TSM OUTPUT=ISO .fi .if n \{\ .RE .\} .sp And if all your systems use NTP for time synchronisation, you can also add these lines to \fI/etc/rear/site\&.conf\fR .sp .if n \{\ .RS 4 .\} .nf TIMESYNC=NTP .fi .if n \{\ .RE .\} .sp Do not forget to distribute the \fIsite\&.conf\fR to all your systems\&. .sp The resulting ISO image will be created in \fI/var/lib/rear/output/\fR\&. You can now modify the behaviour by copying the appropriate configuration variables from \fIdefault\&.conf\fR to \fIlocal\&.conf\fR and changing them to suit your environment\&. .SH "EXIT STATUS" .PP 0 .RS 4 Successful program execution\&. .RE .PP >0 .RS 4 Usage, syntax or execution errors\&. Check the log file in \fI/var/log/rear/\fR for more information\&. .RE .SH "EXAMPLES" .sp To print out the current settings for BACKUP and OUTPUT methods and some system information\&. This command can be used to see the supported features for the given release and platform\&. .sp .if n \{\ .RS 4 .\} .nf # rear dump .fi .if n \{\ .RE .\} .sp To create a new rescue environment\&. Do not forget to copy the resulting rescue system away so that you can use it in the case of a system failure\&. .sp .if n \{\ .RS 4 .\} .nf # rear \-v mkrescue .fi .if n \{\ .RE .\} .sp To create a new rescue image together with a complete archive of your local system run the command: .sp .if n \{\ .RS 4 .\} .nf # rear \-v mkbackup .fi .if n \{\ .RE .\} .SH "FILES" .PP /usr/sbin/rear .RS 4 The program itself\&. .RE .PP /etc/rear/local\&.conf .RS 4 System specific configuration can be set here\&. .RE .PP /etc/rear/site\&.conf .RS 4 Site specific configuration can be set here (not created by default)\&. .RE .PP /var/log/rear/ .RS 4 Directory holding the log files\&. .RE .PP /tmp/rear\&.#### .RS 4 Relax\-and\-Recover working directory\&. If Relax\-and\-Recover exits with an error, you must remove this directory manually\&. .RE .PP /usr/share/rear .RS 4 Relax\-and\-Recover script components\&. .RE .PP /usr/share/rear/conf/default\&.conf .RS 4 Relax\-and\-Recover default values\&. Contains a complete set of parameters and its explanation\&. Please do not edit or modify\&. Copy values to \fIlocal\&.conf\fR or \fIsite\&.conf\fR instead\&. .RE .SH "BUGS" .sp Feedback is welcome, please report any issues or improvements to our issue\-tracker at: \m[blue]\fBhttp://github\&.com/rear/issues/\fR\m[] .sp Furthermore, we welcome pull requests via GitHub\&. .SH "SEE ALSO" .sp Relax\-and\-Recover comes with extensive documentation located in \fI/usr/share/doc\fR\&. .SH "AUTHORS" .sp The ReaR project was initiated in 2006 by Schlomo Schapiro (\m[blue]\fBhttps://github\&.com/schlomo\fR\m[]) and Gratien D\(cqhaese (\m[blue]\fBhttps://github\&.com/gdha\fR\m[]) and has since then seen a lot of contributions by many authors\&. As ReaR deals with bare metal disaster recovery, there is a large amount of code that was contributed by owners and users of specialized hardware and software\&. Without their combined efforts and contributions ReaR would not be the universal Linux bare metal disaster recovery solution that it is today\&. .sp As time passed the project was lucky to get the support of additional developers to also help as maintainers: Dag Wieers (\m[blue]\fBhttps://github\&.com/dagwieers\fR\m[]), Jeroen Hoekx (\m[blue]\fBhttps://github\&.com/jhoekx\fR\m[]), Johannes Meixner (\m[blue]\fBhttps://github\&.com/jsmeix\fR\m[]), Vladimir Gozora (\m[blue]\fBhttps://github\&.com/gozora\fR\m[]) and S\('ebastien Chabrolles (\m[blue]\fBhttps://github\&.com/schabrolles\fR\m[])\&. We hope that ReaR continues to prove useful and to attract more developers who agree to be maintainers\&. Please refer to the MAINTAINERS (\m[blue]\fBhttps://github\&.com/rear/rear/blob/master/MAINTAINERS\fR\m[]) file for the list of active and past maintainers\&. .sp To see the full list of authors and their contributions please look at the git history (\m[blue]\fBhttps://github\&.com/rear/rear/graphs/contributors\fR\m[])\&. We are very thankful to all authors and encourage anybody interested to take a look at our source code and to contribute what you find important\&. .sp Relax\-and\-Recover is a collaborative process using Github at \m[blue]\fBhttp://github\&.com/rear/\fR\m[] .sp The Relax\-and\-Recover website is located at: \m[blue]\fBhttp://relax\-and\-recover\&.org/\fR\m[] .SH "COPYRIGHT" .sp (c) 2006\-2018 .sp The copyright is held by the original authors of the respective code pieces as can be seen in the git history at \m[blue]\fBhttps://github\&.com/rear/rear/graphs/contributors\fR\m[] .sp Relax\-and\-Recover comes with ABSOLUTELY NO WARRANTY; for details see the GNU General Public License at \m[blue]\fBhttp://www\&.gnu\&.org/licenses/gpl\&.html\fR\m[] rear-2.3/doc/rear.8.adoc000066400000000000000000000450601321646673500150250ustar00rootroot00000000000000= rear(8) :version: v2.3 :date: 14 December 2017 :data-uri: :doctype: manpage :lang: en :quirks: == NAME rear - bare metal disaster recovery and system migration tool == SYNOPSIS *rear* [*-h*|*--help*] [*-V*|*--version*] [*-dsSv*] [*-D*|*--debugscripts* _SET_] [*-c* _DIR_] [*-C* _CONFIG_] [*-r* _KERNEL_] [--] _COMMAND_ [_ARGS_...] == DESCRIPTION Relax-and-Recover is the leading Open Source disaster recovery solution. It is a modular framework with many ready-to-go workflows for common situations. Relax-and-Recover produces a bootable image. This image can repartition the system. Once that is done it initiates a restore from backup. Restores to different hardware are possible. Relax-and-Recover can therefore be used as a migration tool as well. Currently Relax-and-Recover supports various boot media (incl. ISO, PXE, OBDR tape, USB or eSATA storage), a variety of network protocols (incl. sftp, ftp, http, nfs, cifs) for storage and backup as well as a multitude of backup strategies (incl. IBM Tivoli Storage Manager, HP DataProtector, Symantec NetBackup, EMC NetWorker, FDR/Upstream, NovaBACKUP DC, Bareos, Bacula, rsync, rbme, Borg). This results in a bootable image that is capable of booting via PXE, DVD/CD, bootable tape or virtual provisioning. Relax-and-Recover was designed to be easy to set up, requires no maintenance and is there to assist when disaster strikes. Its setup-and-forget nature removes any excuses for not having a disaster recovery solution implemented. Recovering from disaster is made very straight-forward by a 2-step recovery process so that it can be executed by operational teams when required. When used interactively (e.g. when used for migrating systems), menus help make decisions to restore to a new (hardware) environment. Extending Relax-and-Recover is made possible by its modular framework. Consistent logging and optionally extended output help understand the concepts behind Relax-and-Recover and help debug during development. Relax-and-Recover comes with ABSOLUTELY NO WARRANTY; for details see the GNU General Public License at: http://www.gnu.org/licenses/gpl.html == OPTIONS === GLOBAL OPTIONS -h --help:: usage information -c DIR:: alternative config directory; instead of /etc/rear -C CONFIG:: additional config file; absolute path or relative to config directory -d:: *debug mode* (log debug messages to log file - also sets -v) -D:: *debugscript mode* (log executed commands via 'set -x' - also sets -v and -d) --debugscripts SET:: same as -d -v -D but *debugscript mode* with 'set -SET' -r KERNEL:: kernel version to use (by default use running kernel) -s:: *simulation mode* (show what scripts are run without executing them) -S:: *step-by-step mode* (acknowledge each script individually) -v:: *verbose mode* (show more output and run many commands in verbose mode) -V --version:: version information === COMMANDS *checklayout*:: check if the disk layout has changed since the last run of mkbackup/mkrescue *dump*:: dump configuration and system information; please run this to verify your setup *format*:: format and label USB or tape media to be used with rear; + first argument is the USB or tape device to use, eg. _/dev/sdX_ or _/dev/stX_ *help*:: print full list of commands and options *mkbackup*:: create rescue media and backup the system (only for internal backup methods) *mkbackuponly*:: backup the system (only for internal backup methods) without creating rescue media *mkrescue*:: create rescue media only *recover*:: recover the system; can be used only when running from the rescue media *restoreonly*:: only restore the backup; can be used only when running from the rescue media *validate*:: submit validation information Use 'rear -v help' for more advanced commands. == BACKGROUND INFORMATION The process of bare metal disaster recovery consists of two parts: - Recreate the system layout - Restore the data to the system Most backup software solutions are very good at restoring data but do not support recreating the system layout. Relax-and-Recover is very good at recreating the system layout but works best when used together with supported backup software. In this combination Relax-and-Recover recreates the system layout and calls the backup software to restore the actual data. Thus there is no unnecessary duplicate data storage and the Relax-and-Recover rescue media can be very small. For demonstration and special use purposes Relax-and-Recover also includes an internal backup method, NETFS, which can be used to create a simple tar.gz archive of the system. For all permanent setups we recommend using something more professional for backup, either a traditional backup software (open source or commercial) or rsync with hardlink based solutions, e.g. RSYNC BACKUP MADE EASY. == RESCUE IMAGE CONFIGURATION The +OUTPUT+ variable defines from where our bootable rescue image will be booted and the +OUTPUT_URL+ variable defines where the rescue image should be send to. Possible +OUTPUT+ setting are: OUTPUT=*RAMDISK*:: Create only the Relax-and-Recover initramfs. OUTPUT=*ISO*:: *(Default)* Create a bootable ISO9660 image on disk as _rear-$(hostname).iso_ OUTPUT=*PXE*:: Create on a remote PXE/NFS server the required files (such as configuration file, kernel and initrd image OUTPUT=*OBDR*:: Create a bootable OBDR tape (optionally including the backup archive). Specify the OBDR tape device by using +TAPE_DEVICE+. OUTPUT=*USB*:: Create a bootable USB disk (using extlinux). Specify the USB storage device by using +USB_DEVICE+. When using +OUTPUT=ISO+, +RAMDISK+, +OBDR+ or +USB+ you should provide the backup target location through the +OUTPUT_URL+ variable. Possible +OUTPUT_URL+ settings are: OUTPUT_URL=*file://*:: Write the image to disk. The default is in _/var/lib/rear/output/_. OUTPUT_URL=*nfs://*:: Write the image by mounting the target filesystem via NFS. OUTPUT_URL=*cifs://*:: Write the image by mounting the target filesystem via CIFS. OUTPUT_URL=*fish://*:: Write the image using +lftp+ and the FISH protocol. OUTPUT_URL=*ftp://*:: Write the image using +lftp+ and the FTP protocol. OUTPUT_URL=*ftps://*:: Write the image using +lftp+ and the FTPS protocol. OUTPUT_URL=*hftp://*:: Write the image using +lftp+ and the HFTP protocol. OUTPUT_URL=*http://*:: Write the image using +lftp+ and the HTTP (PUT) procotol. OUTPUT_URL=*https://*:: Write the image using +lftp+ and the HTTPS (PUT) protocol. OUTPUT_URL=*sftp://*:: Write the image using +lftp+ and the secure FTP (SFTP) protocol. OUTPUT_URL=*rsync://*:: Write the image using +rsync+ and the RSYNC protocol. OUTPUT_URL=*sshfs://*:: Write the image using sshfs and the SSH protocol. OUTPUT_URL=*null*:: Do not copy the ISO image from _/var/lib/rear/output/_ to a remote output location. +OUTPUT_URL=null+ is useful when another program (e.g. an _external_ backup program) is used to save the ISO image from the local system to a remote place, or with +BACKUP_URL=iso:///backup+ when the backup is included in the ISO image to avoid a (big) copy of the ISO image at a remote output location. In the latter case the ISO image must be manually saved from the local system to a remote place. +OUTPUT_URL=null+ is only supported together with +BACKUP=NETFS+. If you do not specify +OUTPUT_URL+ variable then by default it will be aligned to what was defined by variable +BACKUP_URL+. And, the ISO image will then be copied to the same location as your backup of the system disk(s). The +ISO_DEFAULT+ variable defines what default boot option is used on the rescue image. Possible values are `manual`, `boothd` or `automatic`. Manual will make you boot into the shell directly by default, boothd will boot to the first disk (default) or automatic will automatically start in recovery mode. == BACKUP SOFTWARE INTEGRATION Currently Relax-and-Recover supports the following backup methods. Please distinguish carefully between Relax-and-Recover support for 3rd party backup software and Relax-and-Recover internal backup methods. The latter also creates a backup of your data while the former will only integrate Relax-and-Recover with the backup software to restore the data with the help of the backup software without actually creating backups. This means that for all non-internal backup software you *must* take care of creating backups yourself. Especially the +rear mkbackup+ command can be confusing as it is only useful for the internal backup methods and has no function at all with the other (external) backup methods. The following backup methods need to be set in Relax-and-Recover with the +BACKUP+ option. As mentioned we have two types of +BACKUP+ methods - _internal_ and _external_. The following +BACKUP+ methods are _external_ of Relax-and-Recover meaning that you are responsible of backups being made: BACKUP=*REQUESTRESTORE*:: *(default)* Not really a backup method at all, Relax-and-Recover simply halts the recovery and requests that somebody will restore the data to the appropriate location (e.g. via SSH). This method works especially well with an rsync based backup that is pushed back to the backup client. BACKUP=*EXTERNAL*:: Internal backup method that uses an arbitrary external command to create a backup and restore the data. BACKUP=*DP*:: Use HP Data Protector to restore the data. BACKUP=*FDRUPSTREAM*:: Use FDR/Upstream to restore the data. BACKUP=*GALAXY*:: Use CommVault Galaxy 5 to restore the data. BACKUP=*GALAXY7*:: Use CommVault Galaxy 7 to restore the data. BACKUP=*GALAXY10*:: Use CommVault Galaxy 10 (or Simpana 10) to restore the data. BACKUP=*NBU*:: Use Symantec NetBackup to restore the data. BACKUP=*TSM*:: Use IBM Tivoli Storage Manager to restore the data. The Relax-and-Recover result files (e.g. ISO image) are also saved into TSM. BACKUP=*NSR*:: Using EMC NetWorker (Legato) to restore the data. BACKUP=*SESAM*:: Using SEP Sesam to restore the data. BACKUP=*NBKDC*:: Using Novastor NovaBACKUP DC to restore the data. BACKUP=*RBME*:: Use Rsync Backup Made Easy (rbme) to restore the data. BACKUP=*BAREOS*:: Use Open Source backup solution BAREOS (a fork a BACULA) to restore the data. BACKUP=*BACULA*:: Use Open Source backup solution BACULA to restore the data. BACKUP=*DUPLICITY*:: Use encrypted bandwidth-efficient backup solution using the rsync algorithm to restore the data. BACKUP=*BORG*:: Use BorgBackup (short Borg) a deduplicating backup program to restore the data. The following +BACKUP+ methods are _internal_ of Relax-and-Recover: BACKUP=*NETFS*:: Internal backup method which can be used to create a simple backup (tar archive). BACKUP=*RSYNC*:: Use rsync to restore data. If your favourite backup software is missing from this list, please submit a patch or ask us to implement it for you. When using +BACKUP=NETFS+ you must provide the backup target location through the +BACKUP_URL+ variable. Possible +BACKUP_URL+ settings are: BACKUP_URL=*file://*:: To backup to local disk, use +BACKUP_URL=file:///directory/path/+ BACKUP_URL=*nfs://*:: To backup to NFS disk, use +BACKUP_URL=nfs://nfs-server-name/share/path+ BACKUP_URL=*tape://*:: To backup to tape device, use +BACKUP_URL=tape:///dev/nst0+ or alternatively, simply define +TAPE_DEVICE=/dev/nst0+ BACKUP_URL=*rsync://*:: When backup method +BACKUP=RSYNC+ is chosen then we need to define a corresponding +BACKUP_URL+ rule: + ---- BACKUP_URL=rsync://[user@]host[:port]/path BACKUP_URL=rsync://[user@]host[:port]::/path ---- BACKUP_URL=*cifs://*:: To backup to a Samba share (CIFS), use +BACKUP_URL=cifs://cifs-server-name/share/path+. To provide credentials for CIFS mounting use a _/etc/rear/cifs_ credentials file and define +BACKUP_OPTIONS="cred=/etc/rear/cifs"+ and pass along: + ---- username=_username_ password=_secret password_ domain=_domain_ ---- BACKUP_URL=*usb://*:: To backup to USB storage device, use +BACKUP_URL=usb:///dev/disk/by-path/REAR-000+ or use a real device node or a specific filesystem label. Alternatively, you can specify the device using +USB_DEVICE=/dev/disk/by-path/REAR-000+. + If you combine this with +OUTPUT=USB+ you will end up with a bootable USB device. BACKUP_URL=*sshfs://*:: To backup to a remote server via sshfs (SSH protocol), use +BACKUP_URL=sshfs://user@remote-system.name.org/home/user/backup-dir/+ + It is advisable to add *ServerAliveInterval 15* in the +/root/.ssh/config+ file for the remote system (remote-system.name.org). BACKUP_URL=*iso://*:: To include the backup within the ISO image. It is important that the +BACKUP_URL+ and +OUTPUT_URL+ variables are different. E.g. + ---- BACKUP_URL=iso:///backup/ OUTPUT_URL=nfs://server/path/ ---- When using +BACKUP=NETFS+ and BACKUP_PROG=tar there is an option to select +BACKUP_TYPE=incremental+ or +BACKUP_TYPE=differential+ to let +rear+ make incremental or differential backups until the next full backup day e.g. via +FULLBACKUPDAY="Mon"+ is reached or when the last full backup is too old after FULLBACKUP_OUTDATED_DAYS has passed. Incremental or differential backup is currently only known to work with +BACKUP_URL=nfs+. Other BACKUP_URL schemes may work but at least +BACKUP_URL=usb+ requires USB_SUFFIX to be set to work with incremental or differential backup. == CONFIGURATION To configure Relax-and-Recover you have to edit the configuration files in _/etc/rear/_. All _*.conf_ files there are part of the configuration, but only _site.conf_ and _local.conf_ are intended for the user configuration. All other configuration files hold defaults for various distributions and should not be changed. In _/etc/rear/templates/_ there are also some template files which are used by Relax-and-Recover to create configuration files (mostly for the boot environment). Modify the templates to adjust the information contained in the emails produced by Relax-and-Recover. You can use these templates to prepend your own configurations to the configuration files created by Relax-and-Recover, for example you can edit _PXE_pxelinux.cfg_ to add some general pxelinux configuration you use. In almost all circumstances you have to configure two main settings and their parameters: The backup method and the output method. The backup method defines, how your data was saved and whether Relax-and-Recover should backup your data as part of the mkrescue process or whether you use an external application, e.g. backup software to archive your data. The output method defines how the rescue system is written to disk and how you plan to boot the failed computer from the rescue system. See the default configuration file _/usr/share/rear/conf/default.conf_ for an overview of the possible methods and their options. An example to use TSM for backup and ISO for output would be to add these lines to _/etc/rear/local.conf_ (no need to define a +BACKUP_URL+ when using an external backup solution): BACKUP=TSM OUTPUT=ISO And if all your systems use NTP for time synchronisation, you can also add these lines to _/etc/rear/site.conf_ TIMESYNC=NTP Do not forget to distribute the _site.conf_ to all your systems. The resulting ISO image will be created in _/var/lib/rear/output/_. You can now modify the behaviour by copying the appropriate configuration variables from _default.conf_ to _local.conf_ and changing them to suit your environment. == EXIT STATUS 0:: Successful program execution. >0:: Usage, syntax or execution errors. Check the log file in _/var/log/rear/_ for more information. == EXAMPLES To print out the current settings for +BACKUP+ and +OUTPUT+ methods and some system information. This command can be used to see the supported features for the given release and platform. # rear dump To create a new rescue environment. Do not forget to copy the resulting rescue system away so that you can use it in the case of a system failure. # rear -v mkrescue To create a new rescue image together with a complete archive of your local system run the command: # rear -v mkbackup == FILES /usr/sbin/rear:: The program itself. /etc/rear/local.conf:: System specific configuration can be set here. /etc/rear/site.conf:: Site specific configuration can be set here (not created by default). /var/log/rear/:: Directory holding the log files. /tmp/rear.##############:: Relax-and-Recover working directory. If Relax-and-Recover exits with an error, you must remove this directory manually. /usr/share/rear:: Relax-and-Recover script components. /usr/share/rear/conf/default.conf:: Relax-and-Recover default values. Contains a complete set of parameters and its explanation. Please do not edit or modify. Copy values to _local.conf_ or _site.conf_ instead. == BUGS Feedback is welcome, please report any issues or improvements to our issue-tracker at: http://github.com/rear/issues/ Furthermore, we welcome pull requests via GitHub. == SEE ALSO Relax-and-Recover comes with extensive documentation located in _/usr/share/doc_. == AUTHORS The ReaR project was initiated in 2006 by Schlomo Schapiro (https://github.com/schlomo) and Gratien D'haese (https://github.com/gdha) and has since then seen a lot of contributions by many authors. As ReaR deals with bare metal disaster recovery, there is a large amount of code that was contributed by owners and users of specialized hardware and software. Without their combined efforts and contributions ReaR would not be the universal Linux bare metal disaster recovery solution that it is today. As time passed the project was lucky to get the support of additional developers to also help as maintainers: Dag Wieers (https://github.com/dagwieers), Jeroen Hoekx (https://github.com/jhoekx), Johannes Meixner (https://github.com/jsmeix), Vladimir Gozora (https://github.com/gozora) and Sébastien Chabrolles (https://github.com/schabrolles). We hope that ReaR continues to prove useful and to attract more developers who agree to be maintainers. Please refer to the MAINTAINERS (https://github.com/rear/rear/blob/master/MAINTAINERS) file for the list of active and past maintainers. To see the full list of authors and their contributions please look at the git history (https://github.com/rear/rear/graphs/contributors). We are very thankful to all authors and encourage anybody interested to take a look at our source code and to contribute what you find important. Relax-and-Recover is a collaborative process using Github at http://github.com/rear/ The Relax-and-Recover website is located at: http://relax-and-recover.org/ == COPYRIGHT (c) 2006-2018 The copyright is held by the original authors of the respective code pieces as can be seen in the git history at https://github.com/rear/rear/graphs/contributors Relax-and-Recover comes with ABSOLUTELY NO WARRANTY; for details see the GNU General Public License at http://www.gnu.org/licenses/gpl.html rear-2.3/doc/user-guide/000077500000000000000000000000001321646673500151425ustar00rootroot00000000000000rear-2.3/doc/user-guide/01-introduction.adoc000066400000000000000000000111111321646673500207240ustar00rootroot00000000000000= Introduction Relax-and-Recover is the leading Open Source bare metal disaster recovery solution. It is a modular framework with many ready-to-go workflows for common situations. Relax-and-Recover produces a bootable image which can recreate the system's original storage layout. Once that is done it initiates a restore from backup. Since the storage layout can be modified prior to recovery, and disimilar hardware and virtualization is supported, Relax-and-Recover offers the flexibility to be used for complex system migrations. Currently Relax-and-Recover supports various boot media (incl. ISO, PXE, OBDR tape, USB or eSATA storage), a variety of network protocols (incl. sftp, ftp, http, nfs, cifs) as well as a multitude of backup strategies (incl. IBM TSM, HP Data Protector, Symantec NetBackup, EMC NetWorker [Legato], SEP Sesam, Galaxy [Simpana], Bacula, Bareos, RBME, rsync, duplicity, Borg). Relax-and-Recover was designed to be easy to set up, requires no maintenance and is there to assist when disaster strikes. Its setup-and-forget nature removes any excuse for not having a disaster recovery solution implemented. Recovering from disaster is made very straight-forward by a 2-step recovery process so that it can be executed by operational teams when required. When used interactively (e.g. when used for migrating systems), menus help make decisions to restore to a new (hardware) environment. Extending and integrating Relax-and-Recover into complex environments is made possible by its modular framework. Consistent logging and optionally extended output help understand the concepts behind Relax-and-Recover, troubleshoot during initial configuration and help debug during integration. Professional services and support are available. == Relax-and-Recover project The support and development of the Relax-and-Recover project takes place on Github: Relax-and-Recover website:: http://relax-and-recover.org/ Github project:: http://github.com/rear/rear/ In case you have questions, ideas or feedback about this document, you can contact the development team on the Relax-and-Recover mailinglist at: rear-users@lists.relax-and-recover.org. NOTE: Note that you have to be subscribed to be able to send mails to the Relax-and-Recover mailinglist. You can subscribe to the list at: http://lists.relax-and-recover.org/mailman/listinfo/rear-users == Design concepts Based on experience from previous projects, a set of design principles were defined, and improved over time: - Focus on easy and automated disaster recovery - Modular design, focused on system administrators - For Linux (and possibly Unix operating systems) - Few external dependencies (Bash and standard Unix tools) - Easy to use and easy to extend - Easy to integrate with *real* backup software The goal is to make Relax-and-Recover as least demanding as possible, it will require only the applications necessary to fulfill the job Relax-and-Recover is configured for. Furthermore, Relax-and-Recover should be platform independent and ideally install just as a set of scripts that utilizes everything that the Linux operating system provides. == Features and functionality Relax-and-Recover has a wide range of features: // FIXME: Insert the various features from the Release Notes + // include the information from the presentations + // and optionally the rescue creation and recovery workflow // FIXME: Get rid of the below list when everything is in the feature set - Improvements to HP SmartArray and CCISS driver integration - Improvements to software RAID integration - Disk layout change detection for monitoring - One-Button-Disaster-Recovery (OBDR) tape support - DRBD filesystem support - Bacula or Bareos tape support - Multiple DR images per system on single USB storage device - USB ext3/ext4 support - GRUB[2] bootloader re-implementation - UEFI support - ebiso support (needed by SLES UEFI ISO booting) - Add Relax-and-Recover entry to local GRUB configuration (optional) - Nagios and webmin integration - Syslinux boot menu - Storing rescue/backup logfile on rescue media - Restoring to different hardware - RHEL5, RHEL6 and RHEL7 support - SLES 11 and SLES 12 support - Debian and Ubuntu support - Various usability improvements - Serial console support auto-detected - Lockless workflows - USB udev integration to trigger mkrescue on inserting USB device - Beep/UID led/USB suspend integration - Migrate UUID from disks and MAC addressed from network interfaces - Integrates with Disaster Recovery Linux Manager (DRLM) - Data deduplication with Borg as backend - Block device level backup/restore rear-2.3/doc/user-guide/02-getting-started.adoc000066400000000000000000000121671321646673500213250ustar00rootroot00000000000000// FIXME: Make this part more generic and add distribution information = Getting started == Software requirements Relax-and-Recover aims to have as little dependencies as possible, however over time certain capabilities were added using utilities and specific features, causing older distributions to fall out of support. We try to avoid this where practically possible and be conservative to add new dependencies. The most basic requirement for Relax-and-Recover is having +bash+, and ubiquitous Linux tools like: - dd (coreutils) - ethtool - file - grep - gzip - ip (iproute[2]) - mount (util-linux-ng) - ps (procps) - sed - ssh (openssh-clients) - strings (binutils) - tar - ... Optionally, some use-cases require other tools: - lsscsi and sg3_utils (for OBDR tape support) - mkisofs or genisoimage (for ISO output support) - syslinux (for ISO or USB output support) - syslinux-extlinux (for USB support) - ebiso (for SLES UEFI booting) In some cases having newer versions of tools may provide better support: - syslinux >= 4.00 (provides menu support) - parted In case we are using +BACKUP=NETFS+ with nfs or cifs we might need also: - nfs-client - cifs-utils == Distribution support As a project our aim is not to exclude any distribution from being supported, however (as already noted) some older distributions fell out of support over time and there is little interest from the project or the community to spend the effort to add this support. On the other hand there is a larger demand for a tool like Relax-and-Recover from the Enterprise Linux distributions, and as a result more people are testing and contributing to support those distributions. Currently we aim to support the following distributions by testing them regularly: - Red Hat Enterprise Linux and derivatives: RHEL5, RHEL6 and RHEL7 - SUSE Linux Enterprise Server 11 and 12 - Ubuntu LTS: 12, 13, 14 and 15 Distributions dropped as supported: - Ubuntu LTS <12 - Fedora <21 - RHEL 3 and 4 - SLES 9 and 10 - openSUSE <11 - Debian <6 Distributions known to be 'unsupported' are: - Ubuntu LTS 8.04 (as it does not implement +grep -P+) == Known limitations Relax-and-Recover offers a lot of flexibility in various use-cases, however it does have some limitations under certain circumstances: - Relax-and-Recover depends on the software of the running system. When recovering this system to newer hardware, it is possible that the hardware support of the original system does not support the newer hardware. + This problem has been seen when restoring an older RHEL4 with an older HP Proliant Support Pack (PSP) to more recent hardware. This PSP did not detect the newer HP SmartArray controller or its firmware. - Relax-and-Recover supports recovering to different hardware, but it cannot always automatically adapt to this new environment. In such cases it requires a manual intervention to e.g. * modify the _disklayout.conf_ to indicate the number of controller, disks or specific custom desires during restore * reduce the partition-sizes/LV-sizes when restoring to smaller storage * pull network-media or configure the network interfaces manually - Depending on your back-up strategy you may have to perform actions, like: * insert the required tape(s) * perform commands to restore the backup == Installation You can find the RPM and DEB packages from our web site at http://relax-and-recover.org/download/ The latest stable versions of Fedora and SLES can be installed via +yum+ and +zypper+ === From RPM packages Simply install (or update) the provided packages using the command: +rpm -Uhv rear-1.17-1.fc20.noarch.rpm+ You can test your installation by running +rear dump+: ---- [root@system ~]# rear dump Relax-and-Recover 1.12.0svn497 / 2011-07-11 Dumping out configuration and system information System definition: ARCH = Linux-x86_64 OS = GNU/Linux OS_VENDOR = RedHatEnterpriseServer OS_VERSION = 5.6 ... ---- === From DEB packages On a Debian system (or Ubuntu) you can download the DEB packages from our download page and install it with the command: ---- dpkg -i rear*.deb ---- On Debian (Ubuntu) use the following command to install missing dependencies: ---- apt-get -f install ---- === From source The latest and greatest sources are available at GitHub location : https://github.com/rear/rear To make local copy with our github repository just type: ---- git clone git@github.com:rear/rear.git ---- == File locations Remember the general configuration file is found at +/usr/share/rear/conf/default.conf+. In that file you find all variables used by +rear+ which can be overruled by redefining these in the +/etc/rear/site.conf+ or +/etc/rear/local.conf+ files. Please do not modify the +default.conf+ file itself, but use the +site.conf+ or +local.conf+ for this purpose. NOTE: Important note about the configuration files inside ReaR. Treat these as Bash scripts! ReaR will source these configuration files, and therefore, if you make any syntax error against Bash scripting rules ReaR will break. rear-2.3/doc/user-guide/03-configuration.adoc000066400000000000000000000202721321646673500210640ustar00rootroot00000000000000= Configuration // FIXME: add a picture with a simple overview to explain the diff // between BACKUP and OUTPUT schemes The configuration is performed by changing _/etc/rear/local.conf_ or _/etc/rear/site.conf_. There are two important variables that influence Relax-and-Recover and the rescue image. Set +OUTPUT+ to your preferred boot method and define +BACKUP+ for your favorite +BACKUP+ strategy. In most cases only these two settings are required. == Rescue media (OUTPUT) The +OUTPUT+ variable defines where the rescue image should be send to. Possible +OUTPUT+ setting are: OUTPUT=RAMDISK:: Copy the kernel and the initramfs containing the rescue system to a selected location. OUTPUT=ISO:: Create a bootable ISO9660 image on disk as _rear-$(hostname).iso_ OUTPUT=PXE:: Create on a remote PXE/NFS server the required files (such as configuration file, kernel and initrd image) OUTPUT=OBDR:: Create a bootable OBDR tape including the backup archive. Specify the OBDR tape device by using +TAPE_DEVICE+. OUTPUT=USB:: Create a bootable USB disk (using extlinux). Specify the USB storage device by using +USB_DEVICE+. === Using ISO as output method When using +OUTPUT=ISO+ or +OUTPUT=RAMDISK+ you should provide the backup target location through the +OUTPUT_URL+ variable. Possible +OUTPUT_URL+ settings are: OUTPUT_URL=file://:: Write the ISO image to disk. The default is in _/var/lib/rear/output/_. OUTPUT_URL=fish//:: Write the ISO image using +lftp+ and the FISH protocol. OUTPUT_URL=ftp://:: Write the ISO image using +lftp+ and the FTP protocol. OUTPUT_URL=ftps://:: Write the ISO image using +lftp+ and the FTPS protocol. OUTPUT_URL=hftp://:: Write the ISO image using +lftp+ and the HFTP protocol. OUTPUT_URL=http://:: Write the ISO image using +lftp+ and the HTTP (PUT) procotol. OUTPUT_URL=https://:: Write the ISO image using +lftp+ and the HTTPS (PUT) protocol. OUTPUT_URL=nfs://:: Write the ISO image using +nfs+ and the NFS protocol. OUTPUT_URL=sftp://:: Write the ISO image using +lftp+ and the secure FTP (SFTP) protocol. OUTPUT_URL=rsync://:: Write the ISO image using +rsync+ and the RSYNC protocol. OUTPUT_URL=sshfs://:: Write the image using sshfs and the SSH protocol. OUTPUT_URL=null:: Do not copy the ISO image from _/var/lib/rear/output/_ to a remote output location. +OUTPUT_URL=null+ is useful when another program (e.g. an _external_ backup program) is used to save the ISO image from the local system to a remote place, or with +BACKUP_URL=iso:///backup+ when the backup is included in the ISO image to avoid a (big) copy of the ISO image at a remote output location. In the latter case the ISO image must be manually saved from the local system to a remote place. +OUTPUT_URL=null+ is only supported together with +BACKUP=NETFS+. The default boot option of the created ISO is boothd / "boot from first harddisk". If you want to change this, e.g. because you integrate REAR into some automation process, you can change the default using _ISO_DEFAULT={manual,automatic,boothd}_ == Backup/Restore strategy (BACKUP) The +BACKUP+ setting defines our backup/restore strategy. The +BACKUP+ can be handled via internal archive executable (+tar+ or +rsync+) or by an external backup program (commercial or open source). Possible +BACKUP+ settings are: BACKUP=TSM:: Use IBM Tivoli Storage Manager programs BACKUP=DP:: Use HP DataProtector programs BACKUP=FDRUPSTREAM:: Use FDR/Upstream BACKUP=NBU:: Use Symantec NetBackup programs BACKUP=NSR:: Use EMC NetWorker (Legato) BACKUP=BACULA:: Use Bacula programs BACKUP=BAREOS:: Use Bareos fork of Bacula BAREOS_FILESET=Full Only if you have more than one fileset defined for your clients backup jobs, you need to specify which to use for restore BACKUP=GALAXY:: Use CommVault Galaxy (5, probably 6) BACKUP=GALAXY7:: Use CommVault Galaxy (7 and probably newer) BACKUP=GALAXY10:: Use CommVault Galaxy 10 (or Simpana 10) BACKUP=BORG:: Use BorgBackup (short Borg) a deduplicating backup program to restore the data. BACKUP=NETFS:: Use Relax-and-Recover internal backup with tar or rsync (or similar). When using +BACKUP=NETFS+ and +BACKUP_PROG=tar+ there is an option to select +BACKUP_TYPE=incremental+ or +BACKUP_TYPE=differential+ to let rear make incremental or differential backups until the next full backup day e.g. via +FULLBACKUPDAY="Mon"+ is reached or when the last full backup is too old after FULLBACKUP_OUTDATED_DAYS has passed. Incremental or differential backup is currently only known to work with +BACKUP_URL=nfs+. Other BACKUP_URL schemes may work but at least +BACKUP_URL=usb+ requires USB_SUFFIX to be set to work with incremental or differential backup. BACKUP=REQUESTRESTORE:: No backup, just ask user to somehow restore the filesystems. BACKUP=EXTERNAL:: Use a custom strategy by providing backup and restore commands. BACKUP=DUPLICITY:: Use duplicity to manage backup (see http://duplicity.nongnu.org). Additionally if duply (see http://duply.net) is also installed while generating the rescue images it is part of the image. BACKUP=RBME:: Use Rsync Backup Made Easy (rbme) to restore the data. BACKUP=RSYNC:: Use rsync to foresee in backup and restore of your system disks. BACKUP=BLOCKCLONE:: Backup block devices using dd or ntfsclone == Using NETFS as backup strategy (internal archive method) When using +BACKUP=NETFS+ you should provide the backup target location through the +BACKUP_URL+ variable. Possible +BACKUP_URL+ settings are: BACKUP_URL=file://:: To backup to local disk, use +BACKUP_URL=file:///directory/path/+ BACKUP_URL=nfs://:: To backup to NFS disk, use +BACKUP_URL=nfs://nfs-server-name/share/path+ BACKUP_URL=tape://:: To backup to tape device, use +BACKUP_URL=tape:///dev/nst0+ or alternatively, simply define +TAPE_DEVICE=/dev/nst0+ BACKUP_URL=cifs://:: To backup to a Samba share (CIFS), use +BACKUP_URL=cifs://cifs-server-name/share/path+. To provide credentials for CIFS mounting use a _/etc/rear/cifs_ credentials file and define +BACKUP_OPTIONS="cred=/etc/rear/cifs"+ and pass along: + ---- username=_username_ password=_secret password_ domain=_domain_ ---- BACKUP_URL=sshfs://:: To backup over the network with the help of sshfs. You need the fuse-sshfs package before you can use FUSE-Filesystem to access remote filesystems via SSH. An example of defining the +BACKUP_URL+ could be: + ---- BACKUP_URL=sshfs://root@server/export/archives ---- BACKUP_URL=usb://:: To backup to USB storage device, use +BACKUP_URL=usb:///dev/disk/by-label/REAR-000+ or use a real device node or a specific filesystem label. Alternatively, you can specify the device using +USB_DEVICE=/dev/disk/by-label/REAR-000+. + If you combine this with +OUTPUT=USB+ you will end up with a bootable USB device. Optional settings: BACKUP_PROG=rsync:: If you want to use rsync instead of tar (only for +BACKUP=NETFS+). Do not confuse this with the +BACKUP=RSYNC+ backup mechanism. NETFS_KEEP_OLD_BACKUP_COPY=y:: If you want to keep the previous backup archive. Incremental or differential backup and NETFS_KEEP_OLD_BACKUP_COPY contradict each other so that +NETFS_KEEP_OLD_BACKUP_COPY+ must not be 'true' in case of incremental or differential backup. TMPDIR=/bigdisk:: Define this variable in +/etc/rear/local.conf+ if directoru +/tmp+ is too small to contain the ISO image, e.g. when using OUTPUT=ISO BACKUP=NETFS BACKUP_URL=iso://backup ISO_MAX_SIZE=4500 OUTPUT_URL=nfs://lnx01/vol/lnx01/linux_images_dr The +TMPDIR+ is picked up by the +mktemp+ command to create the +BUILD_DIR+ under +/bigdisk/tmp/rear.XXXX+ Please be aware, that directory +/bigdisk+ must exist, otherwise, +rear+ will bail out when executing the +mktemp+ command. The default value of +TMPDIR+ is an empty string, therefore, by default +BUILD_DIR+ is +/tmp/rear.XXXX+ Another point of interest is the +ISO_DIR+ variable to choose another location of the ISO image instead of the default location (+/var/lib/rear/output+). NOTE: With +USB+ we refer to all kinds of external storage devices, like USB keys, USB disks, eSATA disks, ZIP drives, etc... == Using RSYNC as backup mechanism When using +BACKUP=RSYNC+ you should provide the backup target location through the +BACKUP_URL+ variable. Possible +BACKUP_URL+ settings are: BACKUP_URL=rsync://root@server/export/archives BACKUP_URL=rsync://root@server::/export/archives rear-2.3/doc/user-guide/04-scenarios.adoc000066400000000000000000001347661321646673500202220ustar00rootroot00000000000000// FIXME: Add the various scenarios, merge with configuration-examples.txt + // and the below content + // e.g. using different backup methods, + // using different output methods = Scenarios == Bootable ISO If you simply want a bootable ISO on a central server, you would do: [source,bash] ---- OUTPUT=ISO OUTPUT_URL=http://server/path-to-push/ ---- == Bootable ISO with an external (commercial) backup software If you rely on your backup software to do the full restore of a system then you could define: [source,bash] ---- OUTPUT=ISO BACKUP=[TSM|NSR|DP|NBU|GALAXY10|SEP|DUPLICITY|BACULA|BAREOS|RBME|FDRUPSTREAM] ---- When using one of the above backup solution (commercial or open source) then there is no need to use +rear mkbackup+ as the backup workflow would be empty. Just use +rear mkrescue+ ReaR will incorporate the needed executables and libraries of your chosen backup solution into the rescue image of ReaR. == Bootable ISO and storing archive on NFS/NAS To create an ISO rescue image and using a central NFS/NAS server to store the archive, you could define: [source,bash] ---- OUTPUT=ISO BACKUP=NETFS BACKUP_URL=nfs://remote-nfs-server/exports #BACKUP_PROG_CRYPT_ENABLED=1 #BACKUP_PROG_CRYPT_KEY="my_Secret_pw" ---- The above example shows that it is even possible to protect the archives with a password. Be aware, that the password entry +BACKUP_PROG_CRYPT_KEY="my_Secret_pw"+ will be deleted in the +/etc/rear/local.conf+ file within the rescue image. So, it is important to remember the password (if you use the rescue image months later could cause problems I guess). == Bootable USB device with backup to USB If you want a bootable USB device with a (tar) backup to USB as well, you would use: [source,bash] ---- BACKUP=NETFS OUTPUT=USB USB_DEVICE=/dev/disk/by-label/REAR-000 ---- == Bootable tape drive (OBDR) with backup to tape If you want an OBDR image and backup on tape, and use GNU tar for backup/restore, you would use: [source,bash] ---- BACKUP=NETFS OUTPUT=OBDR TAPE_DEVICE=/dev/nst0 ---- == Bootable tape drive (OBDR) and Bacula restore If you want an OBDR image on tape, and the Bacula tools to recover your backup, use: [source,bash] ---- BACKUP=BACULA OUTPUT=OBDR TAPE_DEVICE=/dev/nst0 ---- == Bootable ISO with Borg - Install Borg backup (https://borgbackup.readthedocs.io/en/stable/installation.html). - Setup ssh key infrastructure for user that will be running backup. Issuing following command must work without any password prompts or remote host identity confirmation: `ssh @` - Example _local.conf_: [source,bash] ---- OUTPUT=ISO OUTPUT_URL=nfs://foo.bar.xy/mnt/backup/iso BACKUP=BORG BORGBACKUP_HOST="foo.bar.xy" BORGBACKUP_USERNAME="borg_user" BORGBACKUP_REPO="/mnt/backup/client" BORGBACKUP_REMOTE_PATH="/usr/local/bin/borg" # Automatic archive pruning # (https://borgbackup.readthedocs.io/en/stable/usage.html#borg-prune) BORGBACKUP_PRUNE_WEEKLY=2 # Archive compression # (https://borgbackup.readthedocs.io/en/stable/usage.html#borg-create) BORGBACKUP_COMPRESSION="lzma,9" # Slowest backup, best compression # Repository encryption # (https://borgbackup.readthedocs.io/en/stable/usage.html#borg-init) BORGBACKUP_ENC_TYPE="keyfile" export BORG_PASSPHRASE="S3cr37_P455w0rD" COPY_AS_IS_BORG=( "/root/.config/borg/keys/" ) # Borg environment variables # (https://borgbackup.readthedocs.io/en/stable/usage.html#environment-variables) export BORG_RELOCATED_REPO_ACCESS_IS_OK="yes" export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK="yes" ---- IMPORTANT: If using BORGBACKUP_ENC_TYPE="keyfile", don't forget to make your encryption key available for case of restore! (using `COPY_AS_IS_BORG=( "/root/.config/borg/keys/" )` is a option to consider). Be sure to read https://borgbackup.readthedocs.io/en/stable/usage.html#borg-init, and make your self familiar how encryption in Borg works. - Executing `rear mkbackup` will create Relax-and-Recover rescue/recovery system and start Borg backup process. Once backup finishes, it will also prune old archives from repository, if at least one of BORGBACKUP_PRUNE_* variables is set. - To recover your system, boot Relax-and-Recover rescue/recovery system and trigger `rear recover`. You will be prompted which archive to recover from Borg repository, once ReaR finished with layout configuration. ``` ... Disk layout created. Starting Borg restore === Borg archives list === Host: foo.bar.xy Repository: /mnt/backup/client [1] rear_1 Sun, 2016-10-16 14:08:16 [2] rear_2 Sun, 2016-10-16 14:32:11 [3] Exit Choose archive to recover from: ``` == Backup/restore alien file system using BLOCKCLONE and dd === Configuration - First we need to set some global options to _local.conf_ ``` # cat local.conf OUTPUT=ISO BACKUP=NETFS BACKUP_OPTIONS="nfsvers=3,nolock" BACKUP_URL=nfs://beta.virtual.sk/mnt/rear ``` - Now we can define variables that will apply only for targeted block device ``` # cat alien.conf BACKUP=BLOCKCLONE # Define BLOCKCLONE as backup method BACKUP_PROG_ARCHIVE="alien" # Name of image file BACKUP_PROG_SUFFIX=".dd.img" # Suffix of image file BACKUP_PROG_COMPRESS_SUFFIX="" # Clear additional suffixes BLOCKCLONE_PROG=dd # Use dd for image creation BLOCKCLONE_PROG_OPTS="bs=4k" # Additional options that will be passed to dd BLOCKCLONE_SOURCE_DEV="/dev/sdc1" # Device that should be backed up BLOCKCLONE_SAVE_MBR_DEV="/dev/sdc" # Device where partitioning information is stored (optional) BLOCKCLONE_MBR_FILE="alien_boot_strap.img" # Output filename for boot strap code BLOCKCLONE_PARTITIONS_CONF_FILE="alien_partitions.conf" # Output filename for partition configuration BLOCKCLONE_ALLOW_MOUNTED="yes" # Device can be mounted during backup (default NO) ``` === Running backup - Save partitions configuration, bootstrap code and create actual backup of /dev/sdc1 ``` # rear -C alien mkbackuponly ``` - Running restore from ReaR restore/recovery system ``` # rear -C alien restoreonly Restore alien.dd.img to device: [/dev/sdc1] # User is always prompted for restore destination Device /dev/sdc1 was not found. # If destination does not exist ReaR will try to create it (or fail if BLOCKCLONE_SAVE_MBR_DEV was not set during backup) Restore partition layout to (^c to abort): [/dev/sdc] # Prompt user for device where partition configuration should be restored Checking that no-one is using this disk right now ... OK Disk /dev/sdc: 5 GiB, 5368709120 bytes, 10485760 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes >>> Script header accepted. >>> Script header accepted. >>> Script header accepted. >>> Script header accepted. >>> Created a new DOS disklabel with disk identifier 0x10efb7a9. Created a new partition 1 of type 'HPFS/NTFS/exFAT' and of size 120 MiB. /dev/sdc2: New situation: Device Boot Start End Sectors Size Id Type /dev/sdc1 4096 249855 245760 120M 7 HPFS/NTFS/exFAT The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. ``` == Using Relax-and-Recover with USB storage devices Using USB devices with Relax-and-Recover can be appealing for several reasons: - If you only need to have a bootable rescue environment, a USB device is a *cheap device* for storing only 25 to 60MB to boot from - You can leave the USB device inserted in the system and *opt-in booting* from it only when disaster hits (although we do recommend storing rescue environments off-site) - You can *store multiple systems and multiple snapshots* on a single device - In case you have plenty of space, it might be a simple solution to store complete Disaster Recovery images (rescue + backup) on a single device for a set of systems - For migrating a bunch of servers having a single device to boot from might be very appealing - We have implemented a specific workflow: inserting a REAR-000 labeled USB stick will invoke +rear udev+ and adds a rescue environment to the USB stick (updating the bootloader if needed) However USB devices may be slow for backup purposes, especially on older systems or with unreliable/cheap devices. === Configuring Relax-and-Recover for USB storage devices The below configuration (_/etc/rear/local.conf_) gives a list of possible options when you want to run Relax-and-Recover with USB storage. [source,bash] ---- BACKUP=BACULA OUTPUT=USB USB_DEVICE=/dev/disk/by-label/REAR-000 ---- IMPORTANT: On RHEL4 or older there are no _/dev/disk/by-label/_ udev aliases, which means we cannot use device by label. However it is possible to use +by-path+ references, however this makes it very specific to the USB port used. We opted to use the complete device-name, which can be dangerous if you may have other _/dev/sdX_ devices (luckily we have CCISS block devices in _/dev/cciss/_). === Preparing your USB storage device To prepare your USB device for use with Relax-and-Recover, do: +rear format /dev/sdX+ This will create a single partition, make it bootable, format it with ext3, label it +REAR-000+ and disable warnings related filesystem check for the device. === USB storage as rescue media ==== Configuring Relax-and-Recover to have Bacula tools If the rescue environment needs additional tools and workflow, this can be specified by using +BACKUP=BACULA+ in the configuration file _/etc/rear/local.conf_: [source,bash] ---- BACKUP=BACULA OUTPUT=USB USB_DEVICE=/dev/disk/by-label/REAR-000 ---- ==== Making the rescue USB storage device To create a rescue USB device, run +rear -v mkrescue+ as shown below after you have inserted a *REAR-000* labeled USB device. Make sure the device name for the USB device is what is configured for +USB_DEVICE+. ---- [root@system ~]# rear -v mkrescue Relax-and-Recover 1.12.0svn497 / 2011-07-11 Creating disk layout. Creating root filesystem layout Copying files and directories Copying program files and libraries Copying kernel modules Creating initramfs Finished in 72 seconds. ---- WARNING: Doing the above may replace the existing MBR of the USB device. However any other content on the device is retained. [[booting-from-usb]] ==== Booting from USB storage device Before you can recover our DR backup, it is important to configure the BIOS to boot from the USB device. In some cases it is required to go into the BIOS setup (+F9+ during boot) to change the boot-order of devices. (In BIOS setup select +Standard Boot Order (IPL)+) Once booted from the USB device, select the system you like to recover from the list. If you don't press a key within 30 seconds, the system will try to boot from the local disk. ["aafigure",width="12cm",height="6cm",align="center",format="svg",options="textual",aspect="0.7",linewidth="1"] ---- +---------------------------------------------+ | "Relax-and-Recover v1.12.0svn497" | +---------------------------------------------+ | "Recovery images" | | "system.localdomain" > | | "other.localdomain" > | |---------------------------------------------| | "Other actions" | | "Help for Relax-and-Recover" | | "Boot Local disk (hd1)" | | "Boot BIOS disk (0x81)" | | "Boot Next BIOS device" | | "Hardware Detection tool" | | "Memory test" | | "Reboot system" | | "Power off system" | +---------------------------------------------+ "Press [Tab] to edit options or [F1] for help" "Automatic boot in 30 seconds..." ---- //// .-------------------------------------------------------------. | Relax-and-Recover v1.12.0svn497 | |-------------------------------------------------------------| | Recovery images | | system.localdomain > | | other.localdomain > | |-------------------------------------------------------------| | Other actions | | Help for Relax-and-Recover | (> Boot Local disk (hd1) <) | Boot BIOS disk (0x81) | | Boot Next BIOS device | | Hardware Detection tool | | Memory test | | Reboot system | | Power off system | `-------------------------------------------------------------' Press [Tab] to edit options or [F1] for help Automatic boot in 30 seconds... //// WARNING: Booting from a local disk may fail when booting from a USB device. This is caused by the fact that the GRUB bootloader on the local disk is configured as if it is being the first drive +(hd0)+ but it is in fact the second disk +(hd1)+. If you do find menu entries not working from GRUB, please remove the +root (hd0,0)+ line from the entry. Then select the image you would like to recover. ["aafigure",width="14cm",height="7cm",align="center",format="svg",options="textual",aspect="0.7",linewidth="1"] ---- +---------------------------------------------+ | "system.localdomain" | +---------------------------------------------+ | "2011-03-26 02:16 backup" | | "2011-03-25 18:39 backup" | | "2011-03-05 16:12 rescue image" | |---------------------------------------------| | "Back" | | | | | | | | | | | | | | | | | +---------------------------------------------+ "Press [Tab] to edit options or [F1] for help" "Backup using kernel 2.6.32-122.el6.x86_64" "BACKUP=NETFS OUTPUT=USB OUTPUT_URL=usb:///dev/disk/by-label/REAR-000" ---- //// .-------------------------------------------------------------. | system.localdomain | |-------------------------------------------------------------| | 2011-03-26 02:16 backup | (> 2011-03-25 18:39 backup <) | 2011-03-05 16:12 rescue image | |-------------------------------------------------------------| | Back < | | | | | | | | | | | | | | | | | | | `-------------------------------------------------------------' Press [Tab] to edit options or [F1] for help Backup using kernel 2.6.32-122.el6.x86_64 BACKUP=NETFS OUTPUT=USB OUTPUT_URL=usb:///dev/disk/by-label/REAR-000 //// TIP: When browsing through the images you get more information about the image at the bottom of the screen. ==== Restoring from USB rescue media Then wait for the system to boot until you get the prompt. On the shell prompt, type +rear recover+. You may need to answer a few questions depending on your hardware configuration and whether you are restoring to a (slightly) different system. ---- RESCUE SYSTEM:/ # rear recover Relax-and-Recover 1.12.0svn497 / 2011-07-11 NOTICE: Will do driver migration To recreate HP SmartArray controller 3, type exactly YES: YES To recreate HP SmartArray controller 0, type exactly YES: YES Clearing HP SmartArray controller 3 Clearing HP SmartArray controller 0 Recreating HP SmartArray controller 3|A Configuration restored successfully, reloading CCISS driver... OK Recreating HP SmartArray controller 0|A Configuration restored successfully, reloading CCISS driver... OK Comparing disks. Disk configuration is identical, proceeding with restore. Type "Yes" if you want DRBD resource rBCK to become primary: Yes Type "Yes" if you want DRBD resource rOPS to become primary: Yes Start system layout restoration. Creating partitions for disk /dev/cciss/c0d0 (msdos) Creating partitions for disk /dev/cciss/c2d0 (msdos) Creating software RAID /dev/md2 Creating software RAID /dev/md6 Creating software RAID /dev/md3 Creating software RAID /dev/md4 Creating software RAID /dev/md5 Creating software RAID /dev/md1 Creating software RAID /dev/md0 Creating LVM PV /dev/md6 Creating LVM PV /dev/md5 Creating LVM PV /dev/md2 Creating LVM VG vgrem Creating LVM VG vgqry Creating LVM VG vg00 Creating LVM volume vg00/lv00 Creating LVM volume vg00/lvdstpol Creating LVM volume vg00/lvsys Creating LVM volume vg00/lvusr Creating LVM volume vg00/lvtmp Creating LVM volume vg00/lvvar Creating LVM volume vg00/lvopt Creating ext3-filesystem / on /dev/mapper/vg00-lv00 Mounting filesystem / Creating ext3-filesystem /dstpol on /dev/mapper/vg00-lvdstpol Mounting filesystem /dstpol Creating ext3-filesystem /dstpol/sys on /dev/mapper/vg00-lvsys Mounting filesystem /dstpol/sys Creating ext3-filesystem /usr on /dev/mapper/vg00-lvusr Mounting filesystem /usr Creating ext2-filesystem /tmp on /dev/mapper/vg00-lvtmp Mounting filesystem /tmp Creating ext3-filesystem /boot on /dev/md0 Mounting filesystem /boot Creating ext3-filesystem /var on /dev/mapper/vg00-lvvar Mounting filesystem /var Creating ext3-filesystem /opt on /dev/mapper/vg00-lvopt Mounting filesystem /opt Creating swap on /dev/md1 Creating DRBD resource rBCK Writing meta data... initializing activity log New drbd meta data block successfully created. Creating LVM PV /dev/drbd2 Creating LVM VG vgbck Creating LVM volume vgbck/lvetc Creating LVM volume vgbck/lvvar Creating LVM volume vgbck/lvmysql Creating ext3-filesystem /etc/bacula/cluster on /dev/mapper/vgbck-lvetc Mounting filesystem /etc/bacula/cluster Creating ext3-filesystem /var/bacula on /dev/mapper/vgbck-lvvar Mounting filesystem /var/bacula Creating ext3-filesystem /var/lib/mysql/bacula on /dev/mapper/vgbck-lvmysql Mounting filesystem /var/lib/mysql/bacula Creating DRBD resource rOPS Writing meta data... initializing activity log New drbd meta data block successfully created. Creating LVM PV /dev/drbd1 Creating LVM VG vgops Creating LVM volume vgops/lvcachemgr Creating LVM volume vgops/lvbackup Creating LVM volume vgops/lvdata Creating LVM volume vgops/lvdb Creating LVM volume vgops/lvswl Creating LVM volume vgops/lvcluster Creating ext3-filesystem /opt/cache on /dev/mapper/vgops-lvcachemgr Mounting filesystem /opt/cache Creating ext3-filesystem /dstpol/backup on /dev/mapper/vgops-lvbackup Mounting filesystem /dstpol/backup Creating ext3-filesystem /dstpol/data on /dev/mapper/vgops-lvdata Mounting filesystem /dstpol/data Creating ext3-filesystem /dstpol/databases on /dev/mapper/vgops-lvdb Mounting filesystem /dstpol/databases Creating ext3-filesystem /dstpol/swl on /dev/mapper/vgops-lvswl Mounting filesystem /dstpol/swl Creating ext3-filesystem /dstpol/sys/cluster on /dev/mapper/vgops-lvcluster Mounting filesystem /dstpol/sys/cluster Disk layout created. The system is now ready to restore from Bacula. You can use the 'bls' command to get information from your Volume, and 'bextract' to restore jobs from your Volume. It is assumed that you know what is necessary to restore - typically it will be a full backup. You can find useful Bacula commands in the shell history. When finished, type 'exit' in the shell to continue recovery. WARNING: The new root is mounted under '/mnt/local'. rear> ---- [[restoring-from-bacula-tape]] ==== Restoring from Bacula tape Now you need to continue with restoring the actual Bacula backup, for this you have multiple options of which +bextract+ is the most easy and straightforward, but also the slowest and unsafest. ===== Using a bootstrap file If you know the JobId of the latest successful full backup, and differential backups the most efficient way to restore is by creating a bootstrap file with this information and using it to restore from tape. A bootstrap file looks like this: ---- Volume = VOL-1234 JobId = 914 Job = Bkp_Daily ---- or ---- Volume = VOL-1234 VolSessionId = 1 VolSessionTime = 108927638 ---- Using a bootstrap file with bextract is easy, simply do: +bextract -b bootstrap.txt Ultrium-1 /mnt/local+ TIP: It helps to know exactly how many files you need to restore, and using the +FileIndex+ and +Count+ keywords so +bextract+ does not require to read the whole tape. Use the commands in your shell history to access an example Bacula bootstrap file. ===== Using bextract To use +bextract+ to restore *everything* from a single tape, you can do: +bextract -V VOLUME-NAME Ultrium-1 /mnt/local+ ---- rear> bextract -V VOL-1234 Ultrium-1 /mnt/local bextract: match.c:249-0 add_fname_to_include prefix=0 gzip=0 fname=/ bextract: butil.c:282 Using device: "Ultrium-1" for reading. 30-Mar 16:00 bextract JobId 0: Ready to read from volume "VOL-1234" on device "Ultrium-1" (/dev/st0). bextract JobId 0: -rw-r----- 1 252 bacula 3623795 2011-03-30 11:02:18 /mnt/local/var/lib/bacula/bacula.sql bextract JobId 0: drwxr-xr-x 2 root root 4096 2011-02-02 11:48:28 *none* bextract JobId 0: drwxr-xr-x 4 root root 1024 2011-02-23 13:09:53 *none* bextract JobId 0: drwxr-xr-x 12 root root 4096 2011-02-02 11:50:00 *none* bextract JobId 0: -rwx------ 1 root root 0 2011-02-02 11:48:24 /mnt/local/.hpshm_keyfile bextract JobId 0: -rw-r--r-- 1 root root 0 2011-02-22 12:38:03 /mnt/local/.autofsck ... 30-Mar 16:06 bextract JobId 0: End of Volume at file 7 on device "Ultrium-1" (/dev/st0), Volume "VOL-1234" 30-Mar 16:06 bextract JobId 0: End of all volumes. 30-Mar 16:07 bextract JobId 0: Alert: smartctl version 5.38 [x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen 30-Mar 16:07 bextract JobId 0: Alert: Home page is http://smartmontools.sourceforge.net/ 30-Mar 16:07 bextract JobId 0: Alert: 30-Mar 16:07 bextract JobId 0: Alert: TapeAlert: OK 30-Mar 16:07 bextract JobId 0: Alert: 30-Mar 16:07 bextract JobId 0: Alert: Error counter log: 30-Mar 16:07 bextract JobId 0: Alert: Errors Corrected by Total Correction Gigabytes Total 30-Mar 16:07 bextract JobId 0: Alert: ECC rereads/ errors algorithm processed uncorrected 30-Mar 16:07 bextract JobId 0: Alert: fast | delayed rewrites corrected invocations [10^9 bytes] errors 30-Mar 16:07 bextract JobId 0: Alert: read: 1546 0 0 0 1546 0.000 0 30-Mar 16:07 bextract JobId 0: Alert: write: 0 0 0 0 0 0.000 0 165719 files restored. ---- WARNING: In this case +bextract+ will restore all the Bacula jobs on the provided tapes, start from the oldest, down to the latest. As a consequence, deleted files may re-appear and the process may take a very long time. ==== Finish recovery process Once finished, continue Relax-and-Recover by typing +exit+. ---- rear> exit Did you restore the backup to /mnt/local ? Ready to continue ? y Installing GRUB boot loader Finished recovering your system. You can explore it under '/mnt/local'. Finished in 4424 seconds. ---- IMPORTANT: If you neglect to perform this last crucial step, your new system will not boot and you have to install a boot-loader yourself manually, or re-execute this procedure. === USB storage as backup media ==== Configuring Relax-and-Recover for backup to USB storage device The below configuration (_/etc/rear/local.conf_) gives a list of possible options when you want to run Relax-and-Recover with USB storage. [source,bash] ---- BACKUP=NETFS OUTPUT=USB USB_DEVICE=/dev/disk/by-label/REAR-000 ### Exclude certain items ONLY_INCLUDE_VG=( vg00 ) EXCLUDE_MOUNTPOINTS=( /data ) ---- ==== Making the DR backup to USB storage device Creating a combined rescue device that integrates the backup on USB, it is sufficient to run +rear -v mkbackup+ as shown below after you have inserted the USB device. Make sure the device name for the USB device is what is configured. ---- [root@system ~]# rear -v mkbackup Relax-and-Recover 1.12.0svn497 / 2011-07-11 Creating disk layout. Creating root filesystem layout Copying files and directories Copying program files and libraries Copying kernel modules Creating initramfs Creating archive 'usb:///dev/sda1/system.localdomain/20110326.0216/backup.tar.gz' Total bytes written: 3644416000 (3.4GiB, 5.5MiB/s) in 637 seconds. Writing MBR to /dev/sda Modifying local GRUB configuration Copying resulting files to usb location Finished in 747 seconds. ---- IMPORTANT: It is advised to go into single user mode (+init 1+) before creating a backup to ensure all active data is consistent on disk (and no important processes are active in memory) ==== Booting from USB storage device See the section <> for more information about how to enable your BIOS to boot from a USB storage device. ==== Restoring a backup from USB storage device Then wait for the system to boot until you get the prompt. On the shell prompt, type +rear recover+. You may need to answer a few questions depending on your hardware configuration and whether you are restoring to a (slightly) different system. ---- RESCUE SYSTEM:/ # rear recover Relax-and-Recover 1.12.0svn497 / 2011-07-11 Backup archive size is 1.2G (compressed) To recreate HP SmartArray controller 1, type exactly YES: YES To recreate HP SmartArray controller 7, type exactly YES: YES Clearing HP SmartArray controller 1 Clearing HP SmartArray controller 7 Recreating HP SmartArray controller 1|A Configuration restored successfully, reloading CCISS driver... OK Recreating HP SmartArray controller 7|A Configuration restored successfully, reloading CCISS driver... OK Comparing disks. Disk configuration is identical, proceeding with restore. Start system layout restoration. Creating partitions for disk /dev/cciss/c0d0 (msdos) Creating partitions for disk /dev/cciss/c1d0 (msdos) Creating software RAID /dev/md126 Creating software RAID /dev/md127 Creating LVM PV /dev/md127 Restoring LVM VG vg00 Creating ext3-filesystem / on /dev/mapper/vg00-lv00 Mounting filesystem / Creating ext3-filesystem /boot on /dev/md126 Mounting filesystem /boot Creating ext3-filesystem /data on /dev/mapper/vg00-lvdata Mounting filesystem /data Creating ext3-filesystem /opt on /dev/mapper/vg00-lvopt Mounting filesystem /opt Creating ext2-filesystem /tmp on /dev/mapper/vg00-lvtmp Mounting filesystem /tmp Creating ext3-filesystem /usr on /dev/mapper/vg00-lvusr Mounting filesystem /usr Creating ext3-filesystem /var on /dev/mapper/vg00-lvvar Mounting filesystem /var Creating swap on /dev/mapper/vg00-lvswap Disk layout created. Restoring from 'usb:///dev/sda1/system.localdomain/20110326.0216/backup.tar.gz' Restored 3478 MiB in 134 seconds [avg 26584 KiB/sec] Installing GRUB boot loader Finished recovering your system. You can explore it under '/mnt/local'. Finished in 278 seconds. ---- If all is well, you can now remove the USB device, restore the BIOS boot order and reboot the system into the recovered OS. == Using Relax-and-Recover with OBDR tapes Using One-Button-Disaster-Recovery (OBDR) tapes has a few benefits. - Within large organisations tape media is already *part of a workflow* for offsite storage and is a *known and trusted technology* - Tapes can store large amounts of data reliably and restoring large amounts of data is *predictable* in time and effort - OBDR offers *booting from tapes*, which is very convenient - A single tape can hold both the rescue image as well as a *complete snapshot* of the system (up to 1.6TB with LTO4) However, you need one tape per system as an OBDR tape can only store one single rescue environment. === Configuring Relax-and-Recover for OBDR rescue tapes The below configuration (_/etc/rear/local.conf_) gives a list of possible options when you want to run Relax-and-Recover with a tape drive. This example shows how to use the tape *only* for storing the rescue image, the backup is expected to be handled by Bacula and so the Bacula tools are included in the rescue environment to enable a Bacula restore. [source,bash] ---- OUTPUT=OBDR TAPE_DEVICE=/dev/nst0 ---- === Preparing your OBDR rescue tape To protect normal backup tapes (in case tape drives are also used by another backup solution) Relax-and-Recover expects that the tape to use is labeled *REAR-000*. To achieve this is to insert a blank tape to use for Relax-and-Recover and run the +rear format /dev/stX+ command. === OBDR tapes as rescue media ==== Configuring Relax-and-Recover to have Bacula tools If the rescue environment needs additional tools and workflow, this can be spcified by using +BACKUP=BACULA+ in the configuration file _/etc/rear/local.conf_: [source,bash] ---- BACKUP=BACULA OUTPUT=OBDR BEXTRACT_DEVICE=Ultrium-1 BEXTRACT_VOLUME=VOL-* ---- Using the +BEXTRACT_DEVICE+ allows you to use the tape device that is referenced from the Bacula configuration. This helps in those cases where the discovery of the various tape drives has already been done and configured in Bacula. The +BEXTRACT_VOLUME+ variable is optional and is only displayed in the restore instructions on screen as an aid during recovery. ==== Making the OBDR rescue tape To create a rescue environment that can boot from an OBDR tape, simply run +rear -v mkrescue+ with a *REAR-000* -labeled tape inserted. ---- [root@system ~]# rear -v mkrescue Relax-and-Recover 1.12.0svn497 / 2011-07-11 Rewinding tape Writing OBDR header to tape in drive '/dev/nst0' Creating disk layout. Creating root filesystem layout Copying files and directories Copying program files and libraries Copying kernel modules Creating initramfs Making ISO image Wrote ISO image: /var/lib/rear/output/rear-dag-ops.iso (48M) Writing ISO image to tape Modifying local GRUB configuration Finished in 119 seconds. ---- WARNING: The message above about _/dev/cciss/c1d0_ not being used makes sense as this is not a real disk but simply an entry for manipulating the controller. This is specific to CCISS controllers with only a tape device attached. [[booting-from-obdr]] ==== Booting from OBDR rescue tape The One Button Disaster Recovery (OBDR) functionality in HP LTO Ultrium drives enables them to emulate CD-ROM devices in specific circumstances (also known as being in ''Disaster Recovery'' mode). The drive can then act as a boot device for PCs that support booting off CD-ROM. TIP: An OBDR capable drive can be switched into CD-ROM mode by *powering on with the eject button held down*. Make sure you keep it pressed when the tape drive regains power, and then release the button. If the drive is in OBDR mode, the light will blink regularly. This might be easier in some cases than the below procedure, hence the name One Button Disaster Recovery ! ===== Using a HP Smart Array controller To boot from OBDR, boot your system with the Relax-and-Recover tape inserted. During the boot sequence, interrupt the HP Smart Array controller with the tape attached by pressing *F8* (or *Escape-8* on serial console). ---- iLO 2 v1.78 Jun 10 2009 10.5.20.171 Slot 0 HP Smart Array P410i Controller (512MB, v2.00) 1 Logical Drive Slot 3 HP Smart Array P401 Controller (512MB, v2.00) 1 Logical Drive Slot 4 HP Smart Array P212 Controller (0MB, v2.00) 0 Logical Drives Tape or CD-ROM Drive(s) Detected: Port 1I: Box 0: Bay 4 1785-Slot 4 Drive Array Not Configured No Drives Detected Press to run the Option ROM Configuration for Arrays Utility Press to skip configuration and continue ---- Then select *Configure OBDR* in the menu and select the Tape drive by marking it with *X* (default is on) and press *ENTER* and *F8* to activate this change so it displays ''Configuration saved''. Then press *ENTER* and *Escape* to leave the Smart Array controller BIOS. ---- **** System will boot from Tape/CD/OBDR device attached to Smart Array. ---- ===== Using an LSI controller To boot from OBDR when using an LSI controller, boot your system with the Relax-and-Recover tape inserted. During the boot sequence, interrupt the LSI controller BIOS that has the tape attached by pressing *F8* (or *Escape-8* on serial console). ---- LSI Logic Corp. MPT BIOS Copyright 1995-2006 LSI Logic Corp. MPTBIOS-5.05.21.00 HP Build <<>> ---- Then select the option +1. Tape-based One Button Disaster Recovery (OBDR).+: ---- Select a configuration option: 1. Tape-based One Button Disaster Recovery (OBDR). 2. Multi Initiator Configuration. 3. Exit. ---- And then select the correct tape drive to boot from: ---- compatible tape drives found -> NUM HBA SCSI ID Drive information 0 0 A - HP Ultrium 2-SCSI Please choose the NUM of the tape drive to place into OBDR mode. ---- If all goes well, the system will reboot with OBDR-mode enabled: ---- The PC will now reboot to begin Tape Recovery.... ---- During the next boot, OBDR-mode will be indicate by: ---- *** Bootable media located, Using non-Emulation mode *** ---- ===== Booting the OBDR tape Once booted from the OBDR tape, select the 'Relax-and-Recover' menu entry from the menu. If you don't press a key within 30 seconds, the system will try to boot from the local disk. ["aafigure",width="12cm",height="6cm",align="center",format="svg",options="textual",aspect="0.7",linewidth="1"] ---- +---------------------------------------------+ | "Relax-and-Recover v1.12.0svn497" | +---------------------------------------------+ | "Relax-and-Recover" | |---------------------------------------------| | "Other actions" | | "Help for Relax-and-Recover" | | "Boot Local disk (hd1)" | | "Boot BIOS disk (0x81)" | | "Boot Next BIOS device" | | "Hardware Detection tool" | | "Memory test" | | "Reboot system" | | "Power off system" | | | | | +---------------------------------------------+ "Press [Tab] to edit options or [F1] for help" "Automatic boot in 30 seconds..." ---- //// .-------------------------------------------------------------. | Relax-and-Recover v1.12.0svn497 | |-------------------------------------------------------------| | Relax-and-Recover | |-------------------------------------------------------------| | Other actions | | Help for Relax-and-Recover | (> Boot Local disk (hd0) <) | Boot BIOS disk (0x80) | | Boot Next BIOS device | | Hardware Detection tool | | Memory test | | Reboot system | | Power off system | `-------------------------------------------------------------' Press [Tab] to edit options or [F1] for help Automatic boot in 30 seconds... //// ==== Restoring the OBDR rescue tape Then wait for the system to boot until you get the prompt. On the shell prompt, type +rear recover+. You may need to answer a few questions depending on your hardware configuration and whether you are restoring to a (slightly) different system. ---- RESCUE SYSTEM:/ # rear recover Relax-and-Recover 1.12.0svn497 / 2011-07-11 NOTICE: Will do driver migration Rewinding tape To recreate HP SmartArray controller 3, type exactly YES: YES To recreate HP SmartArray controller 0, type exactly YES: YES Clearing HP SmartArray controller 3 Clearing HP SmartArray controller 0 Recreating HP SmartArray controller 3|A Configuration restored successfully, reloading CCISS driver... OK Recreating HP SmartArray controller 0|A Configuration restored successfully, reloading CCISS driver... OK Comparing disks. Disk configuration is identical, proceeding with restore. Type "Yes" if you want DRBD resource rBCK to become primary: Yes Type "Yes" if you want DRBD resource rOPS to become primary: Yes Start system layout restoration. Creating partitions for disk /dev/cciss/c0d0 (msdos) Creating partitions for disk /dev/cciss/c2d0 (msdos) Creating software RAID /dev/md2 Creating software RAID /dev/md6 Creating software RAID /dev/md3 Creating software RAID /dev/md4 Creating software RAID /dev/md5 Creating software RAID /dev/md1 Creating software RAID /dev/md0 Creating LVM PV /dev/md6 Creating LVM PV /dev/md5 Creating LVM PV /dev/md2 Creating LVM VG vgrem Creating LVM VG vgqry Creating LVM VG vg00 Creating LVM volume vg00/lv00 Creating LVM volume vg00/lvdstpol Creating LVM volume vg00/lvsys Creating LVM volume vg00/lvusr Creating LVM volume vg00/lvtmp Creating LVM volume vg00/lvvar Creating LVM volume vg00/lvopt Creating ext3-filesystem / on /dev/mapper/vg00-lv00 Mounting filesystem / Creating ext3-filesystem /dstpol on /dev/mapper/vg00-lvdstpol Mounting filesystem /dstpol Creating ext3-filesystem /dstpol/sys on /dev/mapper/vg00-lvsys Mounting filesystem /dstpol/sys Creating ext3-filesystem /usr on /dev/mapper/vg00-lvusr Mounting filesystem /usr Creating ext2-filesystem /tmp on /dev/mapper/vg00-lvtmp Mounting filesystem /tmp Creating ext3-filesystem /boot on /dev/md0 Mounting filesystem /boot Creating ext3-filesystem /var on /dev/mapper/vg00-lvvar Mounting filesystem /var Creating ext3-filesystem /opt on /dev/mapper/vg00-lvopt Mounting filesystem /opt Creating swap on /dev/md1 Creating DRBD resource rBCK Writing meta data... initializing activity log New drbd meta data block successfully created. Creating LVM PV /dev/drbd2 Creating LVM VG vgbck Creating LVM volume vgbck/lvetc Creating LVM volume vgbck/lvvar Creating LVM volume vgbck/lvmysql Creating ext3-filesystem /etc/bacula/cluster on /dev/mapper/vgbck-lvetc Mounting filesystem /etc/bacula/cluster Creating ext3-filesystem /var/bacula on /dev/mapper/vgbck-lvvar Mounting filesystem /var/bacula Creating ext3-filesystem /var/lib/mysql/bacula on /dev/mapper/vgbck-lvmysql Mounting filesystem /var/lib/mysql/bacula Creating DRBD resource rOPS Writing meta data... initializing activity log New drbd meta data block successfully created. Creating LVM PV /dev/drbd1 Creating LVM VG vgops Creating LVM volume vgops/lvcachemgr Creating LVM volume vgops/lvbackup Creating LVM volume vgops/lvdata Creating LVM volume vgops/lvdb Creating LVM volume vgops/lvswl Creating LVM volume vgops/lvcluster Creating ext3-filesystem /opt/cache on /dev/mapper/vgops-lvcachemgr Mounting filesystem /opt/cache Creating ext3-filesystem /dstpol/backup on /dev/mapper/vgops-lvbackup Mounting filesystem /dstpol/backup Creating ext3-filesystem /dstpol/data on /dev/mapper/vgops-lvdata Mounting filesystem /dstpol/data Creating ext3-filesystem /dstpol/databases on /dev/mapper/vgops-lvdb Mounting filesystem /dstpol/databases Creating ext3-filesystem /dstpol/swl on /dev/mapper/vgops-lvswl Mounting filesystem /dstpol/swl Creating ext3-filesystem /dstpol/sys/cluster on /dev/mapper/vgops-lvcluster Mounting filesystem /dstpol/sys/cluster Disk layout created. The system is now ready to restore from Bacula. You can use the 'bls' command to get information from your Volume, and 'bextract' to restore jobs from your Volume. It is assumed that you know what is necessary to restore - typically it will be a full backup. You can find useful Bacula commands in the shell history. When finished, type 'exit' in the shell to continue recovery. WARNING: The new root is mounted under '/mnt/local'. rear> ---- ==== Restoring from Bacula tape See the section <> for more information about how to restore a Bacula tape. === OBDR tapes as backup media An OBDR backup tape is similar to an OBDR rescue tape, but next to the rescue environment, it also consists of a complete backup of the system. This is very convenient in that a single tape can be use for disaster recovery, and recovery is much more simple and completely automated. CAUTION: Please make sure that the system fits onto a single tape uncompressed. For an LTO4 Ultrium that would mean no more than 1.6TB. ==== Configuring Relax-and-Recover for OBDR backup tapes The below configuration (_/etc/rear/local.conf_) gives a list of possible options when you want to run Relax-and-Recover with a tape drive. This example shows how to use the tape for storing *both* the rescue image and the backup. [source,bash] ---- BACKUP=NETFS OUTPUT=OBDR TAPE_DEVICE=/dev/nst0 ---- ==== Making the OBDR backup tape To create a bootable backup tape that can boot from OBDR, simply run +rear -v mkbackup+ with a *REAR-000* -labeled tape inserted. ---- [root@system ~]# rear -v mkbackup Relax-and-Recover 1.12.0svn497 / 2011-07-11 Rewinding tape Writing OBDR header to tape in drive '/dev/nst0' Creating disk layout Creating root filesystem layout Copying files and directories Copying program files and libraries Copying kernel modules Creating initramfs Making ISO image Wrote ISO image: /var/lib/rear/output/rear-system.iso (45M) Writing ISO image to tape Creating archive '/dev/nst0' Total bytes written: 7834132480 (7.3GiB, 24MiB/s) in 317 seconds. Rewinding tape Modifying local GRUB configuration Finished in 389 seconds. ---- IMPORTANT: It is advised to go into single user mode (+init 1+) before creating a backup to ensure all active data is consistent on disk (and no important processes are active in memory) ==== Booting from OBDR backup tape See the section <> for more information about how to enable OBDR and boot from OBDR tapes. ==== Restoring from OBDR backup tape ---- RESCUE SYSTEM:~ # rear recover Relax-and-Recover 1.12.0svn497 / 2011-07-11 NOTICE: Will do driver migration Rewinding tape To recreate HP SmartArray controller 3, type exactly YES: YES To recreate HP SmartArray controller 0, type exactly YES: YES Clearing HP SmartArray controller 3 Clearing HP SmartArray controller 0 Recreating HP SmartArray controller 3|A Configuration restored successfully, reloading CCISS driver... OK Recreating HP SmartArray controller 0|A Configuration restored successfully, reloading CCISS driver... OK Comparing disks. Disk configuration is identical, proceeding with restore. Type "Yes" if you want DRBD resource rBCK to become primary: Yes Type "Yes" if you want DRBD resource rOPS to become primary: Yes Start system layout restoration. Creating partitions for disk /dev/cciss/c0d0 (msdos) Creating partitions for disk /dev/cciss/c2d0 (msdos) Creating software RAID /dev/md2 Creating software RAID /dev/md6 Creating software RAID /dev/md3 Creating software RAID /dev/md4 Creating software RAID /dev/md5 Creating software RAID /dev/md1 Creating software RAID /dev/md0 Creating LVM PV /dev/md6 Creating LVM PV /dev/md5 Creating LVM PV /dev/md2 Restoring LVM VG vgrem Restoring LVM VG vgqry Restoring LVM VG vg00 Creating ext3-filesystem / on /dev/mapper/vg00-lv00 Mounting filesystem / Creating ext3-filesystem /dstpol on /dev/mapper/vg00-lvdstpol Mounting filesystem /dstpol Creating ext3-filesystem /dstpol/sys on /dev/mapper/vg00-lvsys Mounting filesystem /dstpol/sys Creating ext3-filesystem /usr on /dev/mapper/vg00-lvusr Mounting filesystem /usr Creating ext2-filesystem /tmp on /dev/mapper/vg00-lvtmp Mounting filesystem /tmp Creating ext3-filesystem /boot on /dev/md0 Mounting filesystem /boot Creating ext3-filesystem /var on /dev/mapper/vg00-lvvar Mounting filesystem /var Creating ext3-filesystem /opt on /dev/mapper/vg00-lvopt Mounting filesystem /opt Creating swap on /dev/md1 Creating DRBD resource rBCK Writing meta data... initializing activity log New drbd meta data block successfully created. Creating LVM PV /dev/drbd2 Restoring LVM VG vgbck Creating ext3-filesystem /etc/bacula/cluster on /dev/mapper/vgbck-lvetc Mounting filesystem /etc/bacula/cluster Creating ext3-filesystem /var/bacula on /dev/mapper/vgbck-lvvar Mounting filesystem /var/bacula Creating ext3-filesystem /var/lib/mysql/bacula on /dev/mapper/vgbck-lvmysql Mounting filesystem /var/lib/mysql/bacula Creating DRBD resource rOPS Writing meta data... initializing activity log New drbd meta data block successfully created. Creating LVM PV /dev/drbd1 Restoring LVM VG vgops Creating ext3-filesystem /opt/cache on /dev/mapper/vgops-lvcachemgr Mounting filesystem /opt/cache Creating ext3-filesystem /dstpol/backup on /dev/mapper/vgops-lvbackup Mounting filesystem /dstpol/backup Creating ext3-filesystem /dstpol/data on /dev/mapper/vgops-lvdata Mounting filesystem /dstpol/data Creating ext3-filesystem /dstpol/databases on /dev/mapper/vgops-lvdb Mounting filesystem /dstpol/databases Creating ext3-filesystem /dstpol/swl on /dev/mapper/vgops-lvswl Mounting filesystem /dstpol/swl Creating ext3-filesystem /dstpol/sys/cluster on /dev/mapper/vgops-lvcluster Mounting filesystem /dstpol/sys/cluster Disk layout created. Restoring from 'tape:///dev/nst0/system/backup.tar' Restored 7460 MiB in 180 seconds [avg 42444 KiB/sec] Installing GRUB boot loader Finished recovering your system. You can explore it under '/mnt/local'. Finished in 361 seconds. ---- rear-2.3/doc/user-guide/05-integration.adoc000066400000000000000000000047251321646673500205470ustar00rootroot00000000000000= Integration == Monitoring your system with Relax-and-Recover If Relax-and-Recover is not in charge of the backup, but only for creating a rescue environment, it can be useful to know when a change to the system invalidates your existing/stored rescue environment, requiring one to update the rescue environment. For this, Relax-and-Recover has two different targets, one to create a new baseline (which is automatically done when creating a new rescue environment successfully. And one to verify the (old) baseline to the current situation. With this, one can monitor or automate generating new rescue environments only when it is really needed. === Creating a baseline Relax-and-Recover automatically creates a new baseline as soon as it successfully has created a new rescue environment. However if for some reason you want to recreate the baseline manually, use +rear savelayout+. === Detecting changes to the baseline When you want to know if the latest rescue environment is still valid, you may want to use the +rear checklayout+ command instead. ---- [root@system ~]# rear checklayout [root@system ~]# echo $? 0 ---- If the layout has changed, the return code will indicate this by a non-zero return code. ---- [root@system ~]# rear checklayout [root@system ~]# echo $? 1 ---- === Integration with Nagios and Opsview If having current DR rescue images is important to your organization, but they cannot be automated (eg. a tape or USB device needs inserting), we provide a Nagios plugin that can send out a notification whenever there is a critical change to the system that requires updating your rescue environment. Changes to the system requiring an update are: - Changes to hardware RAID - Changes to software RAID - Changes to partitioning - Changes to DRBD configuration - Changes to LVM - Changes to filesystems The integration is done using our own _check_rear_ plugin for Nagios. [source,bash] ---- #!/bin/bash # # Purpose: Checks if disaster recovery usb stick is up to date # Check if ReaR is installed if [[ ! -x /usr/sbin/rear ]]; then echo "REAR IS NOT INSTALLED" exit 2 fi # ReaR disk layout status can be identical or changed # returncode: 0 = ok if ! /usr/sbin/rear checklayout; then echo "Disk layout has changed. Please insert Disaster Recovery USB stick into system !" exit 2 fi ---- We also monitor the _/var/log/rear/rear-system.log_ file for +ERROR:+ and +BUG BUG BUG+ strings, so that in case of problems the operator is notified immediately. rear-2.3/doc/user-guide/06-layout-configuration.adoc000066400000000000000000001036731321646673500224110ustar00rootroot00000000000000// This document describes all aspects of the system disk layout generation in // Relax-and-Recover. = Layout configuration Jeroen Hoekx 2011-09-10 == General overview The disk layout generation code in Relax-and-Recover is responsible for the faithful recreation of the disk layout of the original system. It gathers information about any component in the system layout. Components supported in Relax-and-Recover include: - Partitions - Logical volume management (LVM) - Software RAID (MD) - Encrypted volumes (LUKS) - Multipath disks - Swap - Filesystems - Btrfs Volumes - DRBD - HP SmartArray controllers Relax-and-Recover detects dependencies between these components. During the rescue media creation phase, Relax-and-Recover centralizes all information in one file. During recovery, that file is used to generate the actual commands to recreate the components. Relax-and-Recover allows customizations and manual editing in all these phases. == Layout information gathered during rescue image creation Layout information is stored in +/var/lib/rear/layout/disklayout.conf+. The term 'layout file' in this document refers to this particular file. Consider the information from the following system as an example: ---------------------------------- disk /dev/sda 160041885696 msdos # disk /dev/sdb 320072933376 msdos # disk /dev/sdc 1999696297984 msdos part /dev/sda 209682432 32768 primary boot /dev/sda1 part /dev/sda 128639303680 209719296 primary lvm /dev/sda2 part /dev/sda 31192862720 128849022976 primary none /dev/sda3 # part /dev/sdb 162144912384 32256 primary none /dev/sdb1 # part /dev/sdb 152556666880 162144944640 primary none /dev/sdb2 # part /dev/sdb 5371321856 314701611520 primary boot /dev/sdb3 # part /dev/sdc 1073741824000 1048576 primary boot /dev/sdc1 # part /dev/sdc 925953425408 1073742872576 primary lvm /dev/sdc2 # lvmdev /dev/backup /dev/sdc2 cJp4Mt-Vkgv-hVlr-wTMb-0qeA-FX7j-3C60p5 1808502784 lvmdev /dev/system /dev/mapper/disk N4Hpdc-DkBP-Hdm6-Z6FH-VixZ-7tTb-LiRt0w 251244544 # lvmgrp /dev/backup 4096 220764 904249344 lvmgrp /dev/system 4096 30669 125620224 # lvmvol /dev/backup backup 12800 104857600 # lvmvol /dev/backup externaltemp 38400 314572800 lvmvol /dev/system root 2560 20971520 lvmvol /dev/system home 5120 41943040 lvmvol /dev/system var 2560 20971520 lvmvol /dev/system swap 512 4194304 lvmvol /dev/system vmxfs 7680 62914560 lvmvol /dev/system kvm 5000 40960000 fs /dev/mapper/system-root / ext4 uuid=dbb0c0d4-7b9a-40e2-be83-daafa14eff6b label= blocksize=4096 reserved_blocks=131072 max_mounts=21 check_interval=180d options=rw,commit=0 fs /dev/mapper/system-home /home ext4 uuid=e9310015-6043-48cd-a37d-78dbfdba1e3b label= blocksize=4096 reserved_blocks=262144 max_mounts=38 check_interval=180d options=rw,commit=0 fs /dev/mapper/system-var /var ext4 uuid=a12bb95f-99f2-42c6-854f-1cb3f144d662 label= blocksize=4096 reserved_blocks=131072 max_mounts=23 check_interval=180d options=rw,commit=0 fs /dev/mapper/system-vmxfs /vmware xfs uuid=7457d2ab-8252-4f41-bab6-607316259975 label= options=rw,noatime fs /dev/mapper/system-kvm /kvm ext4 uuid=173ab1f7-8450-4176-8cf7-c09b47f5e3cc label= blocksize=4096 reserved_blocks=256000 max_mounts=21 check_interval=180d options=rw,noatime,commit=0 fs /dev/sda1 /boot ext3 uuid=f6b08566-ea5e-46f9-8f73-5e8ffdaa7be6 label= blocksize=1024 reserved_blocks=10238 max_mounts=35 check_interval=180d options=rw,commit=0 swap /dev/mapper/system-swap uuid=9f347fc7-1605-4788-98fd-fca828beedf1 label= crypt /dev/mapper/disk /dev/sda2 cipher=aes-xts-plain hash=sha1 uuid=beafe67c-d9a4-4992-80f1-e87791a543bb ---------------------------------- This document will continue to use this example to explore the various options available in Relax-and-Recover. The exact syntax of the layout file is described in a later section. It is already clear that this file is human readable and thus human editable. It is also machine readable and all information necessary to restore a system is listed. It's easy to see that there are 3 disks attached to the system. +/dev/sda+ is the internal disk of the system. Its filesystems are normally mounted. The other devices are external disks. One of them has just normal partitions. The other one has a physical volume on one of the partitions. == Including/Excluding components === Autoexcludes Relax-and-Recover has reasonable defaults when creating the recovery information. It has commented out the two external disks and any component that's part of it. The reason is that no mounted filesystem uses these two disks. After all, you don't want to recreate your backup disk when you're recovering your system. If we mount the filesystem on +/dev/mapper/backup-backup+ on +/media/backup+, Relax-and-Recover will think that it's necessary to recreate the filesystem: ---------------------------------- disk /dev/sda 160041885696 msdos # disk /dev/sdb 320072933376 msdos disk /dev/sdc 1999696297984 msdos part /dev/sda 209682432 32768 primary boot /dev/sda1 part /dev/sda 128639303680 209719296 primary lvm /dev/sda2 part /dev/sda 31192862720 128849022976 primary none /dev/sda3 # part /dev/sdb 162144912384 32256 primary none /dev/sdb1 # part /dev/sdb 152556666880 162144944640 primary none /dev/sdb2 # part /dev/sdb 5371321856 314701611520 primary boot /dev/sdb3 part /dev/sdc 1073741824000 1048576 primary boot /dev/sdc1 part /dev/sdc 925953425408 1073742872576 primary lvm /dev/sdc2 lvmdev /dev/backup /dev/sdc2 cJp4Mt-Vkgv-hVlr-wTMb-0qeA-FX7j-3C60p5 1808502784 lvmdev /dev/system /dev/mapper/disk N4Hpdc-DkBP-Hdm6-Z6FH-VixZ-7tTb-LiRt0w 251244544 lvmgrp /dev/backup 4096 220764 904249344 lvmgrp /dev/system 4096 30669 125620224 lvmvol /dev/backup backup 12800 104857600 lvmvol /dev/backup externaltemp 38400 314572800 lvmvol /dev/system root 2560 20971520 lvmvol /dev/system home 5120 41943040 lvmvol /dev/system var 2560 20971520 lvmvol /dev/system swap 512 4194304 lvmvol /dev/system vmxfs 7680 62914560 lvmvol /dev/system kvm 5000 40960000 fs /dev/mapper/system-root / ext4 uuid=dbb0c0d4-7b9a-40e2-be83-daafa14eff6b label= blocksize=4096 reserved_blocks=131072 max_mounts=21 check_interval=180d options=rw,commit=0 fs /dev/mapper/system-home /home ext4 uuid=e9310015-6043-48cd-a37d-78dbfdba1e3b label= blocksize=4096 reserved_blocks=262144 max_mounts=38 check_interval=180d options=rw,commit=0 fs /dev/mapper/system-var /var ext4 uuid=a12bb95f-99f2-42c6-854f-1cb3f144d662 label= blocksize=4096 reserved_blocks=131072 max_mounts=23 check_interval=180d options=rw,commit=0 fs /dev/mapper/system-vmxfs /vmware xfs uuid=7457d2ab-8252-4f41-bab6-607316259975 label= options=rw,noatime fs /dev/mapper/system-kvm /kvm ext4 uuid=173ab1f7-8450-4176-8cf7-c09b47f5e3cc label= blocksize=4096 reserved_blocks=256000 max_mounts=21 check_interval=180d options=rw,noatime,commit=0 fs /dev/sda1 /boot ext3 uuid=f6b08566-ea5e-46f9-8f73-5e8ffdaa7be6 label= blocksize=1024 reserved_blocks=10238 max_mounts=35 check_interval=180d options=rw,commit=0 fs /dev/mapper/backup-backup /media/backup ext4 uuid=da20354a-dc4c-4bef-817c-1c92894bb002 label= blocksize=4096 reserved_blocks=655360 max_mounts=24 check_interval=180d options=rw swap /dev/mapper/system-swap uuid=9f347fc7-1605-4788-98fd-fca828beedf1 label= crypt /dev/mapper/disk /dev/sda2 cipher=aes-xts-plain hash=sha1 uuid=beafe67c-d9a4-4992-80f1-e87791a543bb ---------------------------------- This behavior is controlled by the +AUTOEXCLUDE_DISKS=y+ parameter in +default.conf+. If we unset it in the local configuration, Relax-and-Recover will no longer exclude it automatically. A similar mechanism exists for multipath disks. The +AUTOEXCLUDE_MULTIPATH=y+ variable in +default.conf+ prevents Relax-and-Recover from overwriting multipath disks. Typically, they are part of the SAN disaster recovery strategy. However, there can be cases where you want to recover them. The information is retained in +disklayout.conf+. === Manual excludes It seems prudent to prevent the external drives from ever being backed-up or overwritten. The default configuration contains these lines: ---------------------------------- # Exclude components from being backed up, recreation information is active EXCLUDE_BACKUP=() # Exclude components during component recreation # will be added to EXCLUDE_BACKUP (it is not backed up) # recreation information gathered, but commented out EXCLUDE_RECREATE=() # Exclude components during the backup restore phase # only used to exclude files from the restore. EXCLUDE_RESTORE=() ---------------------------------- To prevent an inadvertently mounted backup filesystem being added to the restore list, the easiest way is to add the filesystem to the +EXCLUDE_RECREATE+ array. ---------------------------------- EXCLUDE_RECREATE=( "${EXCLUDE_RECREATE[@]}" "fs:/media/backup" ) ---------------------------------- The layout file is as expected: ---------------------------------- disk /dev/sda 160041885696 msdos # disk /dev/sdb 320072933376 msdos # disk /dev/sdc 1999696297984 msdos part /dev/sda 209682432 32768 primary boot /dev/sda1 part /dev/sda 128639303680 209719296 primary lvm /dev/sda2 part /dev/sda 31192862720 128849022976 primary none /dev/sda3 # part /dev/sdb 162144912384 32256 primary none /dev/sdb1 # part /dev/sdb 152556666880 162144944640 primary none /dev/sdb2 # part /dev/sdb 5371321856 314701611520 primary boot /dev/sdb3 # part /dev/sdc 1073741824000 1048576 primary boot /dev/sdc1 # part /dev/sdc 925953425408 1073742872576 primary lvm /dev/sdc2 # lvmdev /dev/backup /dev/sdc2 cJp4Mt-Vkgv-hVlr-wTMb-0qeA-FX7j-3C60p5 1808502784 lvmdev /dev/system /dev/mapper/disk N4Hpdc-DkBP-Hdm6-Z6FH-VixZ-7tTb-LiRt0w 251244544 # lvmgrp /dev/backup 4096 220764 904249344 lvmgrp /dev/system 4096 30669 125620224 # lvmvol /dev/backup backup 12800 104857600 # lvmvol /dev/backup externaltemp 38400 314572800 lvmvol /dev/system root 2560 20971520 lvmvol /dev/system home 5120 41943040 lvmvol /dev/system var 2560 20971520 lvmvol /dev/system swap 512 4194304 lvmvol /dev/system vmxfs 7680 62914560 lvmvol /dev/system kvm 5000 40960000 fs /dev/mapper/system-root / ext4 uuid=dbb0c0d4-7b9a-40e2-be83-daafa14eff6b label= blocksize=4096 reserved_blocks=131072 max_mounts=21 check_interval=180d options=rw,commit=0 fs /dev/mapper/system-home /home ext4 uuid=e9310015-6043-48cd-a37d-78dbfdba1e3b label= blocksize=4096 reserved_blocks=262144 max_mounts=38 check_interval=180d options=rw,commit=0 fs /dev/mapper/system-var /var ext4 uuid=a12bb95f-99f2-42c6-854f-1cb3f144d662 label= blocksize=4096 reserved_blocks=131072 max_mounts=23 check_interval=180d options=rw,commit=0 fs /dev/mapper/system-vmxfs /vmware xfs uuid=7457d2ab-8252-4f41-bab6-607316259975 label= options=rw,noatime fs /dev/mapper/system-kvm /kvm ext4 uuid=173ab1f7-8450-4176-8cf7-c09b47f5e3cc label= blocksize=4096 reserved_blocks=256000 max_mounts=21 check_interval=180d options=rw,noatime,commit=0 fs /dev/sda1 /boot ext3 uuid=f6b08566-ea5e-46f9-8f73-5e8ffdaa7be6 label= blocksize=1024 reserved_blocks=10238 max_mounts=35 check_interval=180d options=rw,commit=0 # fs /dev/mapper/backup-backup /media/backup ext4 uuid=da20354a-dc4c-4bef-817c-1c92894bb002 label= blocksize=4096 reserved_blocks=655360 max_mounts=24 check_interval=180d options=rw swap /dev/mapper/system-swap uuid=9f347fc7-1605-4788-98fd-fca828beedf1 label= crypt /dev/mapper/disk /dev/sda2 cipher=aes-xts-plain hash=sha1 uuid=beafe67c-d9a4-4992-80f1-e87791a543bb ---------------------------------- Another approach would be to exclude the backup volume group. This is achieved by adding this line to the local configuration: ---------------------------------- EXCLUDE_RECREATE=( "${EXCLUDE_RECREATE[@]}" "/dev/backup" ) ---------------------------------- == Restore to the same hardware Restoring the system to the same hardware is simple. Type +rear recover+ in the rescue system prompt. Relax-and-Recover will detect that it's restoring to the same system and will make sure things like UUIDs match. It also asks for your LUKS encryption password. Once the restore of the backup has completed, Relax-and-Recover will install the bootloader and the system is back in working order. ---------------------------------- RESCUE firefly:~ # rear recover Relax-and-Recover 0.0.0 / $Date$ NOTICE: Will do driver migration Comparing disks. Disk configuration is identical, proceeding with restore. Start system layout restoration. Creating partitions for disk /dev/sda (msdos) Please enter the password for disk(/dev/sda2): Enter LUKS passphrase: Please re-enter the password for disk(/dev/sda2): Enter passphrase for /dev/sda2: Creating LVM PV /dev/mapper/disk Restoring LVM VG system Creating ext4-filesystem / on /dev/mapper/system-root Mounting filesystem / Creating ext4-filesystem /home on /dev/mapper/system-home Mounting filesystem /home Creating ext4-filesystem /var on /dev/mapper/system-var Mounting filesystem /var Creating xfs-filesystem /vmware on /dev/mapper/system-vmxfs meta-data=/dev/mapper/system-vmxfs isize=256 agcount=4, agsize=1966080 blks = sectsz=512 attr=2, projid32bit=0 data = bsize=4096 blocks=7864320, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 log =internal log bsize=4096 blocks=3840, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 Mounting filesystem /vmware Creating ext4-filesystem /kvm on /dev/mapper/system-kvm Mounting filesystem /kvm Creating ext3-filesystem /boot on /dev/sda1 Mounting filesystem /boot Creating swap on /dev/mapper/system-swap Disk layout created. Please start the restore process on your backup host. Make sure that you restore the data into '/mnt/local' instead of '/' because the hard disks of the recovered system are mounted there. Please restore your backup in the provided shell and, when finished, type exit in the shell to continue recovery. Welcome to Relax-and-Recover. Run "rear recover" to restore your system ! rear> ---------------------------------- == Restore to different hardware There are two ways to deal with different hardware. One is being lazy and dealing with problems when you encounter them. The second option is to plan in advance. Both are valid approaches. The lazy approach works fine when you are in control of the restore and you have good knowledge of the components in your system. The second approach is preferable in disaster recovery situations or migrations where you know the target hardware in advance and the actual restore can be carried out by less knowledgeable people. === The Ad-Hoc Way Relax-and-Recover will assist you somewhat in case it notices different disk sizes. It will ask you to map each differently sized disk to a disk in the target system. Partitions will be resized. Relax-and-Recover is careful not to resize your boot partition, since this is often the one with the most stringent sizing constraints. In fact, it only resizes LVM and RAID partitions. Let's try to restore our system to a different system. Instead of one 160G disk, there is now one 5G and one 10G disk. That's not enough space to restore the complete system, but for purposes of this demonstration, we do not care about that. We're also not going to use the first disk, but we just want to show that Relax-and-Recover handles the renaming automatically. ---------------------------------- RESCUE firefly:~ # rear recover Relax-and-Recover 0.0.0 / $Date$ NOTICE: Will do driver migration Comparing disks. Device sda has size 5242880000, 160041885696 expected Switching to manual disk layout configuration. Disk sda does not exist in the target system. Please choose the appropriate replacement. 1) sda 2) sdb 3) Do not map disk. #? 2 2011-09-10 16:17:10 Disk sdb chosen as replacement for sda. Disk sdb chosen as replacement for sda. This is the disk mapping table: /dev/sda /dev/sdb Please confirm that '/var/lib/rear/layout/disklayout.conf' is as you expect. 1) View disk layout (disklayout.conf) 4) Go to Relax-and-Recover shell 2) Edit disk layout (disklayout.conf) 5) Continue recovery 3) View original disk space usage 6) Abort Relax-and-Recover ---------------------------------- Ok, mapping the disks was not that hard. If Relax-and-Recover insists on us checking the disklayout file, we'd better do that. ---------------------------------- #? 1 disk /dev/sdb 160041885696 msdos # disk _REAR1_ 320072933376 msdos # disk /dev/sdc 1999696297984 msdos part /dev/sdb 209682432 32768 primary boot /dev/sdb1 part /dev/sdb -20916822016 209719296 primary lvm /dev/sdb2 part /dev/sdb 31192862720 128849022976 primary none /dev/sdb3 # part _REAR1_ 162144912384 32256 primary none _REAR1_1 # part _REAR1_ 152556666880 162144944640 primary none _REAR1_2 # part _REAR1_ 5371321856 314701611520 primary boot _REAR1_3 # part /dev/sdc 1073741824000 1048576 primary boot /dev/sdc1 # part /dev/sdc 925953425408 1073742872576 primary lvm /dev/sdc2 # lvmdev /dev/backup /dev/sdc2 cJp4Mt-Vkgv-hVlr-wTMb-0qeA-FX7j-3C60p5 1808502784 lvmdev /dev/system /dev/mapper/disk N4Hpdc-DkBP-Hdm6-Z6FH-VixZ-7tTb-LiRt0w 251244544 # lvmgrp /dev/backup 4096 220764 904249344 lvmgrp /dev/system 4096 30669 125620224 # lvmvol /dev/backup backup 12800 104857600 # lvmvol /dev/backup externaltemp 38400 314572800 lvmvol /dev/system root 2560 20971520 lvmvol /dev/system home 5120 41943040 lvmvol /dev/system var 2560 20971520 lvmvol /dev/system swap 512 4194304 lvmvol /dev/system vmxfs 7680 62914560 lvmvol /dev/system kvm 5000 40960000 fs /dev/mapper/system-root / ext4 uuid=dbb0c0d4-7b9a-40e2-be83-daafa14eff6b label= blocksize=4096 reserved_blocks=131072 max_mounts=21 check_interval=180d options=rw,commit=0 fs /dev/mapper/system-home /home ext4 uuid=e9310015-6043-48cd-a37d-78dbfdba1e3b label= blocksize=4096 reserved_blocks=262144 max_mounts=38 check_interval=180d options=rw,commit=0 fs /dev/mapper/system-var /var ext4 uuid=a12bb95f-99f2-42c6-854f-1cb3f144d662 label= blocksize=4096 reserved_blocks=131072 max_mounts=23 check_interval=180d options=rw,commit=0 fs /dev/mapper/system-vmxfs /vmware xfs uuid=7457d2ab-8252-4f41-bab6-607316259975 label= options=rw,noatime fs /dev/mapper/system-kvm /kvm ext4 uuid=173ab1f7-8450-4176-8cf7-c09b47f5e3cc label= blocksize=4096 reserved_blocks=256000 max_mounts=21 check_interval=180d options=rw,noatime,commit=0 fs /dev/sdb1 /boot ext3 uuid=f6b08566-ea5e-46f9-8f73-5e8ffdaa7be6 label= blocksize=1024 reserved_blocks=10238 max_mounts=35 check_interval=180d options=rw,commit=0 # fs /dev/mapper/backup-backup /media/backup ext4 uuid=da20354a-dc4c-4bef-817c-1c92894bb002 label= blocksize=4096 reserved_blocks=655360 max_mounts=24 check_interval=180d options=rw swap /dev/mapper/system-swap uuid=9f347fc7-1605-4788-98fd-fca828beedf1 label= crypt /dev/mapper/disk /dev/sdb2 cipher=aes-xts-plain hash=sha1 uuid=beafe67c-d9a4-4992-80f1-e87791a543bb 1) View disk layout (disklayout.conf) 2) Edit disk layout (disklayout.conf) 3) View original disk space usage 4) Go to Relax-and-Recover shell 5) Continue recovery 6) Abort Relax-and-Recover #? ---------------------------------- The renaming operation was successful. On the other hand, we can already see quite a few problems. A partition with negative sizes. I do not think any tool would like to create that. Still, we don't care at this moment. Do you like entering partition sizes in bytes? Neither do I. There has to be a better way to handle it. We will show it during the next step. The /kvm and /vmware filesystems are quite big. We don't care about them, so just put some nice comments on them and their logical volumes. The resulting layout file looks like this: ---------------------------------- disk /dev/sdb 160041885696 msdos # disk _REAR1_ 320072933376 msdos # disk /dev/sdc 1999696297984 msdos part /dev/sdb 209682432 32768 primary boot /dev/sdb1 part /dev/sdb -20916822016 209719296 primary lvm /dev/sdb2 part /dev/sdb 31192862720 128849022976 primary none /dev/sdb3 # part _REAR1_ 162144912384 32256 primary none _REAR1_1 # part _REAR1_ 152556666880 162144944640 primary none _REAR1_2 # part _REAR1_ 5371321856 314701611520 primary boot _REAR1_3 # part /dev/sdc 1073741824000 1048576 primary boot /dev/sdc1 # part /dev/sdc 925953425408 1073742872576 primary lvm /dev/sdc2 # lvmdev /dev/backup /dev/sdc2 cJp4Mt-Vkgv-hVlr-wTMb-0qeA-FX7j-3C60p5 1808502784 lvmdev /dev/system /dev/mapper/disk N4Hpdc-DkBP-Hdm6-Z6FH-VixZ-7tTb-LiRt0w 251244544 # lvmgrp /dev/backup 4096 220764 904249344 lvmgrp /dev/system 4096 30669 125620224 # lvmvol /dev/backup backup 12800 104857600 # lvmvol /dev/backup externaltemp 38400 314572800 lvmvol /dev/system root 2560 20971520 lvmvol /dev/system home 5120 41943040 lvmvol /dev/system var 2560 20971520 lvmvol /dev/system swap 512 4194304 #lvmvol /dev/system vmxfs 7680 62914560 #lvmvol /dev/system kvm 5000 40960000 fs /dev/mapper/system-root / ext4 uuid=dbb0c0d4-7b9a-40e2-be83-daafa14eff6b label= blocksize=4096 reserved_blocks=131072 max_mounts=21 check_interval=180d options=rw,commit=0 fs /dev/mapper/system-home /home ext4 uuid=e9310015-6043-48cd-a37d-78dbfdba1e3b label= blocksize=4096 reserved_blocks=262144 max_mounts=38 check_interval=180d options=rw,commit=0 fs /dev/mapper/system-var /var ext4 uuid=a12bb95f-99f2-42c6-854f-1cb3f144d662 label= blocksize=4096 reserved_blocks=131072 max_mounts=23 check_interval=180d options=rw,commit=0 #fs /dev/mapper/system-vmxfs /vmware xfs uuid=7457d2ab-8252-4f41-bab6-607316259975 label= options=rw,noatime #fs /dev/mapper/system-kvm /kvm ext4 uuid=173ab1f7-8450-4176-8cf7-c09b47f5e3cc label= blocksize=4096 reserved_blocks=256000 max_mounts=21 check_interval=180d options=rw,noatime,commit=0 fs /dev/sdb1 /boot ext3 uuid=f6b08566-ea5e-46f9-8f73-5e8ffdaa7be6 label= blocksize=1024 reserved_blocks=10238 max_mounts=35 check_interval=180d options=rw,commit=0 # fs /dev/mapper/backup-backup /media/backup ext4 uuid=da20354a-dc4c-4bef-817c-1c92894bb002 label= blocksize=4096 reserved_blocks=655360 max_mounts=24 check_interval=180d options=rw swap /dev/mapper/system-swap uuid=9f347fc7-1605-4788-98fd-fca828beedf1 label= crypt /dev/mapper/disk /dev/sdb2 cipher=aes-xts-plain hash=sha1 uuid=beafe67c-d9a4-4992-80f1-e87791a543bb ---------------------------------- Let's continue recovery. ---------------------------------- 1) View disk layout (disklayout.conf) 2) Edit disk layout (disklayout.conf) 3) View original disk space usage 4) Go to Relax-and-Recover shell 5) Continue recovery 6) Abort Relax-and-Recover #? 5 Partition /dev/sdb3 size reduced to fit on disk. Please confirm that '/var/lib/rear/layout/diskrestore.sh' is as you expect. 1) View restore script (diskrestore.sh) 2) Edit restore script (diskrestore.sh) 3) View original disk space usage 4) Go to Relax-and-Recover shell 5) Continue recovery 6) Abort Relax-and-Recover #? ---------------------------------- Now, this is where human friendly resizes are possible. Edit the file. Find the partition creation code. ---------------------------------- if create_component "/dev/sdb" "disk" ; then # Create /dev/sdb (disk) LogPrint "Creating partitions for disk /dev/sdb (msdos)" parted -s /dev/sdb mklabel msdos >&2 parted -s /dev/sdb mkpart primary 32768B 209715199B >&2 parted -s /dev/sdb set 1 boot on >&2 parted -s /dev/sdb mkpart primary 209719296B -20707102721B >&2 parted -s /dev/sdb set 2 lvm on >&2 parted -s /dev/sdb mkpart primary 18446744053002452992B 10485759999B >&2 # Wait some time before advancing sleep 10 ---------------------------------- It's simple bash code. Change it to use better values. Parted is happy to accept partitions in Megabytes. ---------------------------------- if create_component "/dev/sdb" "disk" ; then # Create /dev/sdb (disk) LogPrint "Creating partitions for disk /dev/sdb (msdos)" parted -s /dev/sdb mklabel msdos >&2 parted -s /dev/sdb mkpart primary 1M 200M >&2 parted -s /dev/sdb set 1 boot on >&2 parted -s /dev/sdb mkpart primary 200M 10485759999B >&2 parted -s /dev/sdb set 2 lvm on >&2 # Wait some time before advancing sleep 10 ---------------------------------- The same action should be done for the remaining logical volumes. We would like them to fit on the disk. ---------------------------------- if create_component "/dev/mapper/system-root" "lvmvol" ; then # Create /dev/mapper/system-root (lvmvol) LogPrint "Creating LVM volume system/root" lvm lvcreate -l 2560 -n root system >&2 component_created "/dev/mapper/system-root" "lvmvol" else LogPrint "Skipping /dev/mapper/system-root (lvmvol) as it has already been created." fi ---------------------------------- No-one but a computer likes to think in extents, so we size it a comfortable 5G. ---------------------------------- if create_component "/dev/mapper/system-root" "lvmvol" ; then # Create /dev/mapper/system-root (lvmvol) LogPrint "Creating LVM volume system/root" lvm lvcreate -L 5G -n root system >&2 component_created "/dev/mapper/system-root" "lvmvol" else LogPrint "Skipping /dev/mapper/system-root (lvmvol) as it has already been created." fi ---------------------------------- Do the same thing for the other logical volumes and choose number 5, continue. ---------------------------------- 1) View restore script (diskrestore.sh) 2) Edit restore script (diskrestore.sh) 3) View original disk space usage 4) Go to Relax-and-Recover shell 5) Continue recovery 6) Abort Relax-and-Recover #? 5 Start system layout restoration. Creating partitions for disk /dev/sdb (msdos) Please enter the password for disk(/dev/sdb2): Enter LUKS passphrase: Please re-enter the password for disk(/dev/sdb2): Enter passphrase for /dev/sdb2: Creating LVM PV /dev/mapper/disk Creating LVM VG system Creating LVM volume system/root Creating LVM volume system/home Creating LVM volume system/var Creating LVM volume system/swap Creating ext4-filesystem / on /dev/mapper/system-root Mounting filesystem / Creating ext4-filesystem /home on /dev/mapper/system-home An error occurred during layout recreation. 1) View Relax-and-Recover log 2) View original disk space usage 3) Go to Relax-and-Recover shell 4) Edit restore script (diskrestore.sh) 5) Continue restore script 6) Abort Relax-and-Recover #? ---------------------------------- An error... Did you expect it? I didn't. Relax-and-Recover produces exceptionally good logs. Let's check them. ---------------------------------- +++ tune2fs -r 262144 -c 38 -i 180d /dev/mapper/system-home tune2fs: reserved blocks count is too big (262144) tune2fs 1.41.14 (22-Dec-2010) Setting maximal mount count to 38 Setting interval between checks to 15552000 seconds 2011-09-10 16:27:35 An error occurred during layout recreation. ---------------------------------- Yes, we resized the home partition from 20GB to 2G in the previous step. The root user wants more reserved blocks than the total number of available blocks. Fixing it is simple. Edit the restore script, option 4. Find the code responsible for filesystem creation. ---------------------------------- if create_component "fs:/home" "fs" ; then # Create fs:/home (fs) LogPrint "Creating ext4-filesystem /home on /dev/mapper/system-home" mkfs -t ext4 -b 4096 /dev/mapper/system-home >&2 tune2fs -U e9310015-6043-48cd-a37d-78dbfdba1e3b /dev/mapper/system-home >&2 tune2fs -r 262144 -c 38 -i 180d /dev/mapper/system-home >&2 LogPrint "Mounting filesystem /home" mkdir -p /mnt/local/home mount /dev/mapper/system-home /mnt/local/home component_created "fs:/home" "fs" else LogPrint "Skipping fs:/home (fs) as it has already been created." fi ---------------------------------- The +-r+ parameter is causing the error. We just remove it and do the same for the other filesystems. ---------------------------------- if create_component "fs:/home" "fs" ; then # Create fs:/home (fs) LogPrint "Creating ext4-filesystem /home on /dev/mapper/system-home" mkfs -t ext4 -b 4096 /dev/mapper/system-home >&2 tune2fs -U e9310015-6043-48cd-a37d-78dbfdba1e3b /dev/mapper/system-home >&2 tune2fs -c 38 -i 180d /dev/mapper/system-home >&2 LogPrint "Mounting filesystem /home" mkdir -p /mnt/local/home mount /dev/mapper/system-home /mnt/local/home component_created "fs:/home" "fs" else LogPrint "Skipping fs:/home (fs) as it has already been created." fi ---------------------------------- Continue the restore script. ---------------------------------- 1) View Relax-and-Recover log 2) View original disk space usage 3) Go to Relax-and-Recover shell 4) Edit restore script (diskrestore.sh) 5) Continue restore script 6) Abort Relax-and-Recover #? 5 Start system layout restoration. Skipping /dev/sdb (disk) as it has already been created. Skipping /dev/sdb1 (part) as it has already been created. Skipping /dev/sdb2 (part) as it has already been created. Skipping /dev/sdb3 (part) as it has already been created. Skipping /dev/mapper/disk (crypt) as it has already been created. Skipping pv:/dev/mapper/disk (lvmdev) as it has already been created. Skipping /dev/system (lvmgrp) as it has already been created. Skipping /dev/mapper/system-root (lvmvol) as it has already been created. Skipping /dev/mapper/system-home (lvmvol) as it has already been created. Skipping /dev/mapper/system-var (lvmvol) as it has already been created. Skipping /dev/mapper/system-swap (lvmvol) as it has already been created. Skipping fs:/ (fs) as it has already been created. Creating ext4-filesystem /home on /dev/mapper/system-home Mounting filesystem /home Creating ext4-filesystem /var on /dev/mapper/system-var Mounting filesystem /var Creating ext3-filesystem /boot on /dev/sdb1 Mounting filesystem /boot Creating swap on /dev/mapper/system-swap Disk layout created. ---------------------------------- That looks the way we want it. Notice how Relax-and-Recover detected that it had already created quite a few components and did not try to recreate them anymore. === Planning In Advance === Relax-and-Recover makes it possible to define the layout on the target system even before the backup is taken. All one has to do is to move the +/var/lib/rear/layout/disklayout.conf+ file to +/etc/rear/disklayout.conf+ and edit it. This won't be overwritten on future backup runs. During recovery, Relax-and-Recover will use that file instead of the snapshot of the original system. == Disk layout file syntax == This section describes the syntax of all components in the Relax-and-Recover layout file at +/var/lib/rear/layout/disklayout.conf+. The syntax used to describe it is straightforward. Normal text has to be present verbatim in the file. Angle brackets "<" and ">" delimit a value that can be edited. Quotes " inside the angle brackets indicate a verbatim option, often used together with a / to indicate multiple options. Parenthesis "(" ")" inside explain the expected unit. No unit suffix should be present, unless specifically indicated. Square brackets "[" and "]" indicate an optional parameter. They can be excluded when hand-crafting a layout file line. === Disks === ---------------------------------- disk ---------------------------------- === Partitions === ---------------------------------- part ---------------------------------- === Software RAID === ---------------------------------- raid /dev/ level= raid-devices= [uuid=] [spare-devices=] [layout=] [chunk=] devices= ---------------------------------- === Physical Volumes === ---------------------------------- lvmdev /dev/ [] ---------------------------------- === Volume Groups === ---------------------------------- lvmgrp /dev/ [] [] ---------------------------------- === Logical Volumes === ---------------------------------- lvmvol /dev/ [] ---------------------------------- === LUKS Devices === ---------------------------------- crypt /dev/mapper/ [cipher=] [key_size=] [hash=] [uuid=] [keyfile=] [password=] ---------------------------------- === DRBD === ---------------------------------- drbd /dev/drbd ---------------------------------- === Filesystems === ---------------------------------- fs [uuid=] [label=