posts-go/docs/2022-06-08-backup.html

360 lines
12 KiB
HTML
Raw Normal View History

2023-07-18 18:38:30 +00:00
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="stylesheet"
2023-12-20 18:45:20 +00:00
href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.5.0/github-markdown.min.css"
/>
<title>haunt98 posts</title>
</head>
<style>
.markdown-body {
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 45px;
}
@media (max-width: 767px) {
.markdown-body {
padding: 15px;
}
}
</style>
<body class="markdown-body">
2023-08-09 07:22:58 +00:00
<h2>
<a href="index.html"><code>~</code></a>
</h2>
2023-11-19 15:59:21 +00:00
<h1>
<a
id="user-content-backup-my-way"
class="anchor"
aria-hidden="true"
tabindex="-1"
href="#backup-my-way"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Backup my way
2022-12-30 09:26:06 +00:00
</h1>
<p>
First thing first, I want to list my own devices, which I have through the
years:
</p>
<ul>
<li>
<del
2023-08-06 10:52:12 +00:00
>Laptop Samsung NP300E4Z-S06VN (old laptop which I give to my
2022-12-30 09:26:06 +00:00
mom)</del
>
</li>
<li>
<del
><a
href="https://www.dell.com/support/home/en-vn/product-support/product/inspiron-15-3567-laptop/drivers"
rel="nofollow"
>Laptop Dell Inspiron 15 3567</a
>
2023-05-13 17:50:48 +00:00
<a
href="https://fwupd.org/lvfs/devices/com.dell.uefi1d4362ca.firmware"
rel="nofollow"
>LVFS</a
>
2023-08-06 10:52:12 +00:00
(my mom bought it for me when I go to college, I give it to my mom
2022-12-30 09:26:06 +00:00
afterward)</del
>
</li>
<li>
<del
><a
href="https://www.acer.com/ac/en/US/content/support-product/8841"
rel="nofollow"
>Laptop Acer Nitro AN515-45</a
>
2023-08-06 10:52:12 +00:00
(gaming laptop which I buy for gaming, I give it to my sister)</del
2022-12-30 09:26:06 +00:00
>
</li>
2023-08-06 10:52:12 +00:00
<li>MacBook Pro M1 2020 (my company laptop)</li>
2022-12-30 09:26:06 +00:00
<li>
<del
>Phone
<a
href="https://forum.xda-developers.com/c/lg-g3.3147/"
rel="nofollow"
2023-05-13 17:50:48 +00:00
>LG G3 D851 T-Mobile</a
2022-12-30 09:26:06 +00:00
>
2023-08-06 10:52:12 +00:00
(bought long time ago, now is a brick)</del
2022-12-30 09:26:06 +00:00
>
</li>
<li>
<del
>Phone
<a
2023-08-06 10:52:12 +00:00
href="https://www.gsmarena.com/xiaomi_redmi_6a-9217.php"
2022-12-30 09:26:06 +00:00
rel="nofollow"
>Xiaomi Redmi 6A</a
>
(I give it to my sister too)</del
>
</li>
<li>
Phone
<a
2023-08-06 10:52:12 +00:00
href="https://www.gsmarena.com/xiaomi_poco_x3_nfc-10415.php"
2022-12-30 09:26:06 +00:00
rel="nofollow"
>Xiaomi Poco X3 NFC</a
>
2023-08-06 10:52:12 +00:00
(primary phone which I use daily)
2022-12-30 09:26:06 +00:00
</li>
</ul>
<p>App/Service I use daily:</p>
<ul>
<li>
2023-06-10 04:53:34 +00:00
<a href="https://bitwarden.com/" rel="nofollow">Bitwarden</a>: password
manager
</li>
<li>
<a href="https://getaegis.app/" rel="nofollow">Aegis Authenticator</a>:
2FA manager
</li>
<li>
<a href="https://rclone.org/" rel="nofollow">Rclone</a>: sync data to
cloud
</li>
<li>
<a href="https://restic.net/" rel="nofollow">restic</a>: backup data
2022-12-30 09:26:06 +00:00
</li>
<li><a href="https://tailscale.com/" rel="nofollow">Tailscale</a></li>
2023-08-06 10:52:12 +00:00
<li>
GitHub / GitLab /
<a href="https://git.sr.ht/" rel="nofollow">SourceHut</a> /
2023-10-05 19:00:00 +00:00
<a href="https://codeberg.org/" rel="nofollow">Codeberg</a>: stores git
repo
2023-08-06 10:52:12 +00:00
</li>
<li>Google Keep / Notion</li>
2023-06-10 04:53:34 +00:00
<li>Google Drive (currently use 200GB plan)</li>
<li>
2023-08-06 10:52:12 +00:00
GMail /
<a href="https://simplelogin.io/" rel="nofollow">SimpleLogin</a> /
Proton Mail: my mail
2023-06-10 04:53:34 +00:00
</li>
2022-12-30 09:26:06 +00:00
</ul>
<p>
The purpose is that I want my data to be safe, secure, and can be easily
recovered if I lost some devices; or in the worst situation, I lost all.
Because you know, it is hard to guess what is waiting for us in the
future.
</p>
<p>
2023-08-06 10:52:12 +00:00
There are 2 main sections which I want to share, the first is
2022-12-30 09:26:06 +00:00
<strong>How to backup</strong>, the second is
2023-08-06 10:52:12 +00:00
<strong>Recovery strategy</strong>.
2022-12-30 09:26:06 +00:00
</p>
2023-11-19 15:59:21 +00:00
<h2>
<a
id="user-content-how-to-backup"
class="anchor"
aria-hidden="true"
tabindex="-1"
href="#how-to-backup"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>How to backup
2022-12-30 09:26:06 +00:00
</h2>
<p>
Before I talk about backup, I want to talk about data. In specifically,
which data should I backup?
</p>
<p>
I use Arch Linux and macOS, primarily work in the terminal so I have too
many dotfiles, for example, <code>~/.config/nvim/init.lua</code>. Each
time I reinstall Arch Linux (I like it a lot), I need to reconfigure all
the settings, and it is time-consuming.
</p>
<p>
So for the DE and UI settings, I keep it as default as possible, unless
it's getting in my way, I leave the default setting there and forget about
it. The others are dotfiles, which I write my own
<a href="https://github.com/haunt98/dotfiles">dotfiles tool</a> to backup
and reconfigure easily and quickly. Also, I know that installing Arch
2023-08-06 10:52:12 +00:00
Linux is not easy, despite I install it too many times (like thousand
2022-12-30 09:26:06 +00:00
times since I was in high school). Not because it is hard, but as life
goes on, the
<a
href="https://wiki.archlinux.org/title/installation_guide"
rel="nofollow"
>official install guide</a
>
keeps getting new update and covering too many cases for my own personal
use, so I write my own
2023-08-06 10:52:12 +00:00
<a
href="https://github.com/haunt98/posts-go/blob/main/posts/2022-12-25-archlinux.md"
2022-12-30 09:26:06 +00:00
>guide</a
>
2023-08-06 10:52:12 +00:00
to quickly capture what I need to do.
2022-12-30 09:26:06 +00:00
</p>
<p>
So that is my dotfiles, for my regular data, like Wallpaper or Books,
2023-08-06 10:52:12 +00:00
Images, I use Google Drive (actually I pay for it). But the step: open the
2022-12-30 09:26:06 +00:00
webpage, click the upload button and choose files seems boring and
time-consuming. So I use Rclone, it supports Google Drive, One Drive and
many providers but I only use Google Drive for now. The commands are
simple:
</p>
<div class="highlight highlight-source-shell">
<pre><span class="pl-c"><span class="pl-c">#</span> Sync from local to remote</span>
2023-07-30 09:37:36 +00:00
<span class="pl-c"><span class="pl-c">#</span> remote can be gdrive, 1drive, ..., anything you previously config with rclone</span>
2022-07-10 11:09:42 +00:00
rclone sync MyBooks remote:MyBooks -P --exclude .DS_Store
<span class="pl-c"><span class="pl-c">#</span> Sync from remote to local</span>
2022-12-30 09:26:06 +00:00
rclone sync remote:MyBooks MyBooks -P --exclude .DS_Store</pre>
</div>
<p>
Before you use Rclone to sync to Google Drive, you should read
<a href="https://rclone.org/drive/" rel="nofollow"
>Google Drive rclone configuration</a
>
first.
</p>
2023-06-10 04:53:34 +00:00
<p>For private data, I use restic which use Rclone as backend:</p>
2022-12-30 09:26:06 +00:00
<div class="highlight highlight-source-shell">
<pre><span class="pl-c"><span class="pl-c">#</span> Init</span>
2022-09-07 14:13:47 +00:00
restic -r rclone:remote:PrivateData init
<span class="pl-c"><span class="pl-c">#</span> Backup</span>
2022-09-07 14:13:47 +00:00
restic -r rclone:remote:PrivateData backup PrivateData
2022-11-21 07:13:27 +00:00
<span class="pl-c"><span class="pl-c">#</span> Cleanup old backups</span>
2022-11-21 07:13:27 +00:00
restic -r rclone:remote:PrivateData forget --keep-last 1 --prune
2022-12-03 07:43:46 +00:00
<span class="pl-c"><span class="pl-c">#</span> Restore</span>
2023-07-30 09:37:36 +00:00
<span class="pl-c"><span class="pl-c">#</span> Be careful because restic restore fullpath</span>
<span class="pl-c"><span class="pl-c">#</span> See https://github.com/restic/restic/issues/2092</span>
2022-12-30 09:26:06 +00:00
restic -r rclone:remote:PrivateData restore latest --target <span class="pl-k">~</span></pre>
</div>
<p>
The next data is my passwords and my OTPs. These are the things which I'm
scare to lose the most. First thing first, I enable 2-Step Verification
for all of my important accounts, should use both OTP and phone method.
</p>
<p>
2023-08-06 10:52:12 +00:00
I use Bitwarden for passwords (that is a long story, coming from Google
2022-12-30 09:26:06 +00:00
Password manager to Firefox Lockwise and then settle down with Bitwarden)
and Aegis for OTPs. The reason I choose Aegis, not Authy (I use Authy for
so long but Aegis is definitely better) is because Aegis allows me to
2023-08-06 10:52:12 +00:00
extract all the OTPs to a single file (can be encrypted), which I use to
2022-12-30 09:26:06 +00:00
transfer or backup easily.
</p>
<p>
As long as Bitwarden provides free passwords stored, I use all of its
apps, extensions so that I can easily sync passwords between laptops and
phones. The thing I need to remember is the master password of Bitwarden
in my head.
</p>
<p>
2023-08-06 10:52:12 +00:00
With Bitwardent/Aegis, I also can export the data (must always be
encrypted), then:
2022-12-30 09:26:06 +00:00
</p>
2023-08-06 10:52:12 +00:00
<ul>
<li>Sync to Google Drive</li>
<li>Store locally in my laptop</li>
<li>Don't store locally in phone (can not keep track easily)</li>
</ul>
2023-11-19 15:59:21 +00:00
<h3>
<a
id="user-content-backup-work-related-data"
class="anchor"
aria-hidden="true"
tabindex="-1"
href="#backup-work-related-data"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Backup work related data
2023-06-30 15:54:50 +00:00
</h3>
<p>APIs tools:</p>
<ul>
<li>
<a href="https://httpie.io/app" rel="nofollow">HTTPie</a>
<ul>
<li>Already sync online (for now).</li>
</ul>
</li>
</ul>
<p>
Stay away from Postman, it's lag and you can accidentally upload private
data publicly.
</p>
2023-11-19 15:59:21 +00:00
<h2>
<a
id="user-content-recovery-strategy"
class="anchor"
aria-hidden="true"
tabindex="-1"
href="#recovery-strategy"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Recovery strategy
2022-12-30 09:26:06 +00:00
</h2>
<p>
There are many strategies that I process to react as if something strange
is happening to my devices.
</p>
2023-06-10 04:17:23 +00:00
<ul>
<li>
If I lost my laptops, single laptop or all, do not panic as long as I
have my phones. The OTPs are in there, the passwords are in Bitwarden
cloud, other data is in Google Drive so nothing is lost here.
</li>
<li>
If I lost my phone, but not my laptops, I use the OTPs which are stored
locally in my laptops.
</li>
<li>
In the worst situation, I lost everything, my laptops, my phone. The
first step is to recover my SIM, then log in to Google account using the
password and SMS OTP. After that, log in to Bitwarden account using the
2023-08-06 10:52:12 +00:00
master password and OTP from Gmail, which I log in previously.
2023-06-10 04:17:23 +00:00
</li>
</ul>
2023-11-19 15:59:21 +00:00
<h2>
<a
id="user-content-misc"
class="anchor"
aria-hidden="true"
tabindex="-1"
href="#misc"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>Misc
2023-06-10 04:53:34 +00:00
</h2>
<p>
To backup everything is hard, so keep it simple and only backup important
things. Pick one then stay away from other cloud services:
</p>
<ul>
2023-08-06 10:52:12 +00:00
<li>TODOis, Evernote, ... -&gt; Google Keep / Notion</li>
2023-06-10 04:53:34 +00:00
<li>Dropbox, OneDrive, ... -&gt; Google Drive</li>
</ul>
2023-11-19 15:59:21 +00:00
<h2>
<a
id="user-content-the-end"
class="anchor"
aria-hidden="true"
tabindex="-1"
href="#the-end"
><span aria-hidden="true" class="octicon octicon-link"></span></a
>The end
2022-12-30 09:26:06 +00:00
</h2>
<p>This guide will be updated regularly I promise.</p>
2022-12-25 19:22:39 +00:00
<div>
Feel free to ask me via
<a href="mailto:hauvipapro+posts@gmail.com">email</a> or
2023-08-20 17:29:13 +00:00
<a rel="me" href="https://hachyderm.io/@haunguyen">Mastodon</a>.
<br />Source code is available on
2022-12-30 09:55:38 +00:00
<a href="https://github.com/haunt98/posts-go">GitHub</a>
2023-08-20 17:29:13 +00:00
<a href="https://codeberg.org/yoshie/posts-go">Codeberg</a>
<a href="https://git.sr.ht/~youngyoshie/posts-go">sourcehut</a>
<a href="https://gitea.treehouse.systems/yoshie/posts-go">Treehouse</a>
<a href="https://gitlab.com/youngyoshie/posts-go">GitLab</a>
2022-12-25 19:22:39 +00:00
</div>
</body>
</html>