{"id":79100,"date":"2026-11-17T02:03:55","date_gmt":"2026-11-17T02:03:55","guid":{"rendered":"http:\/\/bangla.sitestree.com\/?p=79100"},"modified":"2026-11-17T02:03:55","modified_gmt":"2026-11-17T02:03:55","slug":"linux-advanced-2-06-backups","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=79100","title":{"rendered":"Linux Advanced 2 06 \u2014 Encrypted Backups and Restore Drills"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/bangla.sitestree.com\/?name=linux-course-index\">Linux course index<\/a> \u00b7 <a href=\"https:\/\/bangla.sitestree.com\/?cat=1993\">Linux Advanced 2 category<\/a> \u00b7 Lesson 6 of 7<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>AI disclosure<\/strong> \u2014 AI-generated content, posted as is. AI can make mistakes. This extension adds new material and links related posts from this site. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Learning goal<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Create an encrypted Restic snapshot and verify a real restore into a separate directory.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Concepts and setup<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The site shows tar archives and database dumps. This extension introduces encrypted, deduplicated repository snapshots. A repository check can find some consistency problems, but only a restore exercise proves you can retrieve the specific data you need. Recovery point objective (RPO) describes tolerable data loss in time. Recovery time objective (RTO) describes tolerable unavailability. This is a local fixture, not a disaster-resilient storage design.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use a disposable VM with restic and a new temporary directory. Choose a lab-only passphrase when prompted and remember it for the four commands. In real operations, use an approved secret mechanism and keep separate protected copies of both the data and the recovery credentials.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Initialize and check a repository<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>lab=$(mktemp -d)\nmkdir &quot;$lab\/data&quot; &quot;$lab\/restore&quot;\nprintf 'release=training\\n' &gt; &quot;$lab\/data\/settings.txt&quot;\nexport RESTIC_REPOSITORY=&quot;$lab\/repo&quot;\nrestic init\nrestic backup --tag oe-recovery &quot;$lab\/data&quot;\nrestic snapshots\nrestic check<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>created restic repository ...\n...\nsnapshot 92d7e125 saved\n...\nno errors were found<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Never put the real passphrase in shell history. The sample ID changes. A normal check does not necessarily read every data pack. Discuss the time and bandwidth cost of deeper checks in production.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Restore separately and compare actual bytes<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>restic restore latest --tag oe-recovery --target &quot;$lab\/restore&quot;\nrestored=$(find &quot;$lab\/restore&quot; -type f -name settings.txt -print -quit)\ntest -n &quot;$restored&quot; &amp;&amp; cmp &quot;$lab\/data\/settings.txt&quot; &quot;$restored&quot; &amp;&amp;\n  printf 'restored bytes match\\n'\nunset RESTIC_REPOSITORY<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>restoring snapshot 92d7e125 ... to \/tmp\/tmp.ABC\/restore\n...\nrestored bytes match<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This fixture contains one uniquely named file. Production restores should use an identified snapshot, preserve expected metadata, and verify application-level data as well.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Questions only<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Quick-check questions<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>Why is a snapshot ID more precise than latest?<\/li>\n\n\n<li>Why keep recovery credentials apart from the protected data?<\/li>\n\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Assessment questions<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>A new snapshot is needed at most every hour and service must be restored within four hours. Identify RPO and RTO.<\/li>\n\n\n<li>Name two steps to prove a restore worked beyond seeing the command exit 0.<\/li>\n\n\n<li>What problem remains if both the original and the repository live on one laptop?<\/li>\n\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Questions and answers<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Quick-check answers<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li><strong>Why is a snapshot ID more precise than latest?<\/strong><br><strong>Answer<\/strong> \u2014 It selects a known version even if newer snapshots appear.<\/li>\n\n\n<li><strong>Why keep recovery credentials apart from the protected data?<\/strong><br><strong>Answer<\/strong> \u2014 Losing the only recovery credentials can make the encrypted repository unreadable.<\/li>\n\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Assessment answer key<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li><strong>A new snapshot is needed at most every hour and service must be restored within four hours. Identify RPO and RTO.<\/strong><br><strong>Answer<\/strong> \u2014 RPO is one hour and RTO is four hours.<\/li>\n\n\n<li><strong>Name two steps to prove a restore worked beyond seeing the command exit 0.<\/strong><br><strong>Answer<\/strong> \u2014 For example, compare expected contents and metadata, query restored data, or test the recovered service from a client.<\/li>\n\n\n<li><strong>What problem remains if both the original and the repository live on one laptop?<\/strong><br><strong>Answer<\/strong> \u2014 The same device loss, compromise, or storage failure can destroy both copies.<\/li>\n\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Related source articles on this site<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=65718\">On Thursday and Friday tar all contents of \/etc folder into \/export\/home\/shell\/test\/etc.tar .. do misc logs #Linux\/Unix: Shell Programming \u2013 001<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=21831\">Some Ubuntu Linux Commands used in AWS platform #Unix\/Linux #RHCSA<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=67600\">Learn some Centos\/Redhat Linux: RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS #DevOps #RHCE<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=22419\">Introduction to 7zip and Compression in Linux #Root #By Sayed Ahmed #RHCSA<\/a><\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Technical references<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><a href=\"https:\/\/restic.readthedocs.io\/en\/stable\/\">Restic documentation<\/a><\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Continue the course<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Previous lesson 05 \u2014 Kernel Modules and Resource Limits. Next lesson 07 \u2014 Capstone: Build, Diagnose, and Recover a Linux Service.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/bangla.sitestree.com\/?name=linux-course-index\">Linux course index<\/a> \u00b7 <a href=\"https:\/\/bangla.sitestree.com\/?cat=1993\">Linux Advanced 2 category<\/a> \u00b7 Lesson 6 of 7<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Create an encrypted Restic snapshot and verify a real restore into a separate directory.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1993],"tags":[],"class_list":["post-79100","post","type-post","status-publish","format-standard","hentry","category-linux-advanced-2","item-wrap"],"jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":79102,"url":"http:\/\/bangla.sitestree.com\/?p=79102","url_meta":{"origin":79100,"position":0},"title":"Linux Administration Course \u2014 Start Here and Lesson Index","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"A 33-lesson Linux course from shell fundamentals to server administration, performance, and a recovery capstone.","rel":"","context":"In &quot;Linux Basics&quot;","block_context":{"text":"Linux Basics","link":"http:\/\/bangla.sitestree.com\/?cat=1990"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79101,"url":"http:\/\/bangla.sitestree.com\/?p=79101","url_meta":{"origin":79100,"position":1},"title":"Linux Advanced 2 07 \u2014 Capstone: Build, Diagnose, and Recover a Linux Service","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Demonstrate Linux service deployment, evidence-led incident diagnosis, and recovery in one lab.","rel":"","context":"In &quot;Linux Advanced 2&quot;","block_context":{"text":"Linux Advanced 2","link":"http:\/\/bangla.sitestree.com\/?cat=1993"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79094,"url":"http:\/\/bangla.sitestree.com\/?p=79094","url_meta":{"origin":79100,"position":2},"title":"Linux Advanced 09 \u2014 MariaDB Service Accounts and Restore Verification","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Check a Linux-hosted MariaDB service, identify least-privilege database roles, and test a logical restore.","rel":"","context":"In &quot;Linux Advanced&quot;","block_context":{"text":"Linux Advanced","link":"http:\/\/bangla.sitestree.com\/?cat=1992"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79099,"url":"http:\/\/bangla.sitestree.com\/?p=79099","url_meta":{"origin":79100,"position":3},"title":"Linux Advanced 2 05 \u2014 Kernel Modules and Resource Limits","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Read kernel module information and identify the current process\u2019s resource-control group without changing the kernel.","rel":"","context":"In &quot;Linux Advanced 2&quot;","block_context":{"text":"Linux Advanced 2","link":"http:\/\/bangla.sitestree.com\/?cat=1993"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79095,"url":"http:\/\/bangla.sitestree.com\/?p=79095","url_meta":{"origin":79100,"position":4},"title":"Linux Advanced 2 01 \u2014 Hardening a systemd Service","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Run a small systemd service with a dedicated dynamic identity and a narrow writable directory.","rel":"","context":"In &quot;Linux Advanced 2&quot;","block_context":{"text":"Linux Advanced 2","link":"http:\/\/bangla.sitestree.com\/?cat=1993"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79091,"url":"http:\/\/bangla.sitestree.com\/?p=79091","url_meta":{"origin":79100,"position":5},"title":"Linux Advanced 06 \u2014 DHCP Leases and a Kea Lab","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Validate a Kea DHCPv4 pool and verify a lease issued to a VM on an isolated segment.","rel":"","context":"In &quot;Linux Advanced&quot;","block_context":{"text":"Linux Advanced","link":"http:\/\/bangla.sitestree.com\/?cat=1992"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/79100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=79100"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/79100\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=79100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=79100"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=79100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}