<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: PhoenixLandPirate</title>
    <description>The latest articles on DEV Community by PhoenixLandPirate (@phoenixlandpirate).</description>
    <link>https://dev.to/phoenixlandpirate</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F464157%2F177f177b-30da-4c47-95b9-80313c1b9e26.jpg</url>
      <title>DEV Community: PhoenixLandPirate</title>
      <link>https://dev.to/phoenixlandpirate</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/phoenixlandpirate"/>
    <language>en</language>
    <item>
      <title>Bridging using Matrix with Ansible. (WIP)</title>
      <dc:creator>PhoenixLandPirate</dc:creator>
      <pubDate>Fri, 04 Dec 2020 19:53:03 +0000</pubDate>
      <link>https://dev.to/phoenixlandpirate/bridging-using-matrix-with-ansible-wip-l7o</link>
      <guid>https://dev.to/phoenixlandpirate/bridging-using-matrix-with-ansible-wip-l7o</guid>
      <description>&lt;h1&gt;
  
  
  Bridging and why?
&lt;/h1&gt;

&lt;p&gt;What is a Bridge? well as the name suggests, its a link between one place and another, in this case, its linking messaging platforms of different kinds, to one messaging platform.&lt;/p&gt;

&lt;p&gt;Why do this? theres a few reasons why.&lt;/p&gt;

&lt;p&gt;One place,  if you bridge your chats, then everyone who messages you will be in one place, you only have to open one app, to get all your messages, you might not want this for everyone everywhere, some accounts you want to keep seperate, but for those chats who you wish where just on one app, its easy, when you get a new phone, or computer, you just have to login to one app, you dont need to download loads of apps.&lt;/p&gt;

&lt;p&gt;Storage space and battery life, applications take up storage space, they all have there little jobs running in the background, each waking up your phone, or taking a bit of energy, slowing your phone down, or wasting battery life, and data.&lt;/p&gt;

&lt;p&gt;Avoid using dodgy apps, Facebook apps, are known for their obtrusive nature, how they send weird data, if you want to talk to your friends on facebook, but you want control over your data, you can't do it without bridges.&lt;/p&gt;

&lt;p&gt;Freedom of movement, many messaging apps limit where you can use them, some apps only work on desktop, others only on phone, some don't work on windows phone, Ubuntu Touch, sailfish, etc, with a matrix bridge, anything that can connect to a matrix client will let you read your messages, you don't have to be on your phone, to message your whatsapp friends, you can message your facebook friends on Plasma mobile.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Set Up.
&lt;/h2&gt;

&lt;p&gt;I started with creating a Linode server, 1gb of ram with 25 GB of storage, on CentOS7 (CentoOS 8 is not supported by the playbook we are using) depending on how many messages you want to send on the services, you may need a much bigger server, I plan on keeping an eye on how much the server uses, and upgrade it when/if I need to, if I only get a handful of messages through a bridge, that just use standard text then a low end server should be fine.&lt;/p&gt;

&lt;p&gt;CentOS7 uses yum, so using yum we will update and restart the server&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$ sudo yum update&lt;br&gt;
$ reboot&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;From there I will be following this readme &lt;a href="https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/README.md"&gt;https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/README.md&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On centOS 7, or at least the version on Linode, python and cronie are already installed, so we can bypass installing them&lt;br&gt;
I already have a server running ansible, so I can just ssh into that machine.&lt;/p&gt;

&lt;p&gt;Then we need to buy a dns, I bought a cheap one from namecheap, this doesn't need to be anything easy to remember, as no one is going to use this except you, it doesn't have to be a .com or anything to recognizable, so I went with the cheapest, using a .xyz&lt;/p&gt;

&lt;h3&gt;
  
  
  NameCheap to Linode
&lt;/h3&gt;

&lt;p&gt;This is how I set up NameCheap DNS with Linode, however if you're using different services, you may want to read there documentation.&lt;/p&gt;

&lt;p&gt;Go to your dashboard, then click manage on the DNS page, go to the NAMESERVERS secotion, and use a Custom DNS, and add the linode server's&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ns1.linode.com&lt;br&gt;
ns2.linode.com&lt;br&gt;
ns3.linode.com&lt;br&gt;
ns4.linode.com&lt;br&gt;
ns5.linode.com&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then click the green tick, you may need to be pacient because it can take up to 24 hours to make the Name servers change.&lt;/p&gt;

&lt;p&gt;Go to your linode cloud service, then click Domains, and make the Master domain, the Domain is the url you bought, and the SOA Email address is just the accountable, so in short, your email, if you get an error saying that the domain isn't valid, you might just have your finger on the button to quickly. &lt;/p&gt;

&lt;p&gt;Now its time to set up your DNS.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Host&lt;/th&gt;
&lt;th&gt;Priority&lt;/th&gt;
&lt;th&gt;Weight&lt;/th&gt;
&lt;th&gt;Port&lt;/th&gt;
&lt;th&gt;Target&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A&lt;/td&gt;
&lt;td&gt;matrix&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;matrix-server-IP&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CNAME&lt;/td&gt;
&lt;td&gt;element&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;matrix.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CNAME&lt;/td&gt;
&lt;td&gt;dimension (*)&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;matrix.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CNAME&lt;/td&gt;
&lt;td&gt;jitsi (*)&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;matrix.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SRV&lt;/td&gt;
&lt;td&gt;_matrix-identity._tcp&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;443&lt;/td&gt;
&lt;td&gt;matrix.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The ones marked with &amp;gt;(*) are optional, and since we are only using this as a bridge server, we will not be setting them up.&lt;/p&gt;

&lt;p&gt;To add the A type, just click add an A/AAAA Record, make the Hostname matrix, and the matrix-server-IP, is just the IP address of the server.&lt;br&gt;
Do similarly with the CNAME and SRV's.&lt;/p&gt;

&lt;p&gt;This is roughly what your set up should look like if you're not using some of the extra features offered in the playbook!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/8fgDnmct"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OabY0jcd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/qqzRqmTV/Screenshot-20201204-214536-1.png" alt="Roughly how mine looks"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Playbook
&lt;/h3&gt;

&lt;p&gt;Now its time to configure the Ansible and the playbook.&lt;/p&gt;

&lt;p&gt;so lets ssh into the Ansible server.&lt;/p&gt;

&lt;p&gt;first I had to install git as it didn't git preinstalled&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$ sudo yum install git&lt;br&gt;
$ sudo yum install python-dns&lt;br&gt;
$ git clone &lt;a href="https://github.com/spantaleev/matrix-docker-ansible-deploy.git"&gt;https://github.com/spantaleev/matrix-docker-ansible-deploy.git&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;cd into the new folder and set up with some simple commands.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$ cd matrix-docker-ansible-deploy&lt;br&gt;
$ mkdir inventory/host_vars/matrix.&lt;br&gt;
$ cp examples/host-vars.yml inventory/host_vars/matrix./vars.yml&lt;br&gt;
$ nano inventory/host_vars/matrix./vars.yml&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;in this file you just add your websites URL, your email address and add two secrets.&lt;br&gt;
however, you can also set up some bots quite easily here to get a list of all the options use&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$ ls roles&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;for this set up we're going to use the instagram, facebook and some other services.&lt;br&gt;
So first you'll want to see what the defaults are using &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$ less roles//defaults/main.yml&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;At the start I'm just running them as default as possible, editing them if I need to change a config option, to do that we edit our var file&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$ nano inventory/host_vars/matrix./vars.yml&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/crHmS2Xt"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eoTEkpKL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/Kv7snyTf/image.png" alt="What the set up looked like after a bit of tweaking"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We also need to configure the hosts file, this just points the Ansible playbook, to the server we want to change.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$ cp examples/hosts inventory/hosts&lt;br&gt;
$ nano inventory/hosts&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Also to make this a bit easier, it might be a good idea to generate a ssh key so generate a ssh using ssh-keygen, &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$ ssh-keygen&lt;br&gt;
$ cat $HOME/.ssh/id_rsa.pub&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then copy that output to your other servers authorized keys&lt;br&gt;
nano .ssh/authorized_keys&lt;/p&gt;

&lt;p&gt;once that's done, go back to our ansible server and run&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$ ansible-playbook -i inventory/hosts setup.yml --tags=setup-all&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Mine still didn't work, so I had to open a few ports.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$ firewall-cmd --zone=public --add-port= --permanent&lt;br&gt;
$ firewall-cmd --reload               &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After getting kicked out of the facebook room and told that I don't have permission to use my bots, I asked how to fix my issue, turns out in the var.yml you have to tell the service that you have to whitelist servers which aren't your own.&lt;/p&gt;

&lt;p&gt;To fix that, I just added the following to the vars.yml&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;matrix_mautrix_facebook_configuration_extension_yaml: |&lt;br&gt;
  bridge:&lt;br&gt;
    permissions:&lt;br&gt;
      # Keep the default used by the playbook, referencing the current domain&lt;br&gt;
      ' matrix_mautrix_facebook_homeserver_domain ': user&lt;br&gt;
      another-server.com: user&lt;/p&gt;

&lt;p&gt;matrix_mx_puppet_instagram_provisioning_whitelist:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"@.*: matrix_domain|regex_escape "&lt;/li&gt;
&lt;li&gt;"@.*:another-domain.com"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;matrix_mx_puppet_discord_provisioning_whitelist:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"@.domain.com"&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is roughly how it should look depending on how you plan to organzise your vars.yml page, with your personal data in.&lt;br&gt;
&lt;a href="https://postimg.cc/Ty7dZywD"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LG32re9G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/KzF13BhJ/image.png" alt="Var.yml with the added whitelists"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;then run the following commands to update the matrix server. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$ ansible-playbook -i inventory/hosts setup.yml --tags=setup-all&lt;br&gt;
$ ansible-playbook -i inventory/hosts setup.yml --tags=start&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This fixed Instagram and Discord bridging, however Facebook refused to work, for now I've decided to ssh into the server which hosts my matrix bridges directly, this is a bad idea, as its extra leg work, and something that's easy to forget when updating your Ansible config file.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$ nano /matrix/mautrix-facebook/config/config.yaml&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;scroll down to bridge, in that subgroup, near the bottom, you'll see permissions, this will have your url: user, just change that to be the domain you wish to use, with : user, for example/&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;permissions&lt;br&gt;
     matrix.org: user&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This allows anyone with a matrix.org account to message your Facebook bot, and use it as a bridge, if you don't want that you can configure it to be more strict by specifying the user.&lt;/p&gt;

&lt;p&gt;when you've configured this, you then go back to your Ansible server and run.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$ ansible-playbook -i inventory/hosts setup.yml --tags=start&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;However remember that every time that you run ansible-playbook with the tags "setup-all" you'll have to ssh into your matrix server to change the Facebook config file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up and Logging in.
&lt;/h2&gt;

&lt;p&gt;Now its just a matter of logging in, to login you have to start a chat with the bot, and usually give login details, however sometimes its a bit more complicated.&lt;/p&gt;

&lt;h3&gt;
  
  
  Instagram
&lt;/h3&gt;

&lt;p&gt;@_instagrampuppet_bot:DOMAIN.COM &lt;/p&gt;

&lt;p&gt;for Instagram, I just plain logged into this one, it even works with 2FA, to login just type&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;link $USERNAME $PASSWORD&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Wait for it to ask you for your 2fa code then just type that, and you're in.&lt;/p&gt;

&lt;h3&gt;
  
  
  Discord
&lt;/h3&gt;

&lt;p&gt;Before you run the ansible commands, you have to get yourself a discord client ID as well as a Client Secret, but how do you do that?&lt;/p&gt;

&lt;p&gt;First go to the &lt;a href="https://discord.com/developers/applications"&gt;developer website&lt;/a&gt; then create a new application, create app, then find the create bot button, and click that, "Yes Do it".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://postimg.cc/kDbmJYGG"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Qpshy9wG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.postimg.cc/gcMkKfPV/image.png" alt="Page here"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you'll be on a page that shows you the Client ID, copy and paste that to the vars.yaml in between the quote marks here.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;matrix_mx_puppet_discord_client_id: "CLIENT ID"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Next to that will be the client secret, click copy and then paste it to the vars.yml, in between the quote marks here.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;matrix_mx_puppet_discord_client_secret: "SECRET ID"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now use the Ansible commands to setup and start the services.&lt;/p&gt;

&lt;p&gt;join the room  @_discordpuppet_bot:DOMAIN.COM&lt;/p&gt;

&lt;p&gt;Now we can't login by using our username/email, or password, we actually have to use an ID.&lt;/p&gt;

&lt;p&gt;Press CTRL+SHIFT+I in the discordapp, and then click on the network tab on the client, press f5 to reload, so that the page can store the information needed.&lt;/p&gt;

&lt;p&gt;In the search box, type /api, and click applications, then in headers, search for the autherzation title, copy the code in there.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZdaJPwl4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://discordhelp.net/image/api-search-authorization.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZdaJPwl4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://discordhelp.net/image/api-search-authorization.png" alt="Auth"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then to login just use&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;link user AUTHCODE&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;and you'll be in, though be warned its against the discord terms and services to use the Auth code like this.&lt;/p&gt;

&lt;h3&gt;
  
  
  Facebook
&lt;/h3&gt;

&lt;p&gt;Facebook isn't as difficult as discord, however it's not as simple as instagram either.&lt;/p&gt;

&lt;p&gt;first start a chat with the facebook bot @facebookbot:DOMAIN.COM&lt;/p&gt;

&lt;p&gt;message the bot with&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;login-cookie&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;and follow the instructions from there, make sure you use messanger.com, and dont go to facebook.com and open messanger in full screen, if you use facebook.com/messanger then you'll get a failed login!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Backing up securely with Restic</title>
      <dc:creator>PhoenixLandPirate</dc:creator>
      <pubDate>Thu, 26 Nov 2020 14:14:48 +0000</pubDate>
      <link>https://dev.to/phoenixlandpirate/backing-up-securely-with-restic-3795</link>
      <guid>https://dev.to/phoenixlandpirate/backing-up-securely-with-restic-3795</guid>
      <description>&lt;h1&gt;
  
  
  Backing up securely
&lt;/h1&gt;

&lt;p&gt;We all know the saying, you should always back up your stuff, if you don't back it up, there's lots of things that can go wrong, your hard-drive might fail, or might just have some data loss, you might accidently delete the wrong folder, and not realise it until its to late, or maybe you accidently over wrote a newer file, with an older version, maybe someone could have locked you out of your computer, or encrypted your hard-drive, or perhaps you just forget your password.&lt;/p&gt;

&lt;p&gt;Todays blog is about Local backup's only, however the tools used in this can be used to back up your things securely online to, the biggest issue with online backups being the cost of service if you have a huge amount of storage to back up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install Restic
&lt;/h2&gt;

&lt;p&gt;Restic is the backup software that we're going to use, its Open Source, with strong encryption, versioning, and only transfers what you need to, so you don't use up more space than you need to.&lt;/p&gt;

&lt;p&gt;Restic works on Linux, Mac, BSD, and Windows, however if you want to use Restic, you still need to know your way around a shell. &lt;/p&gt;

&lt;h3&gt;
  
  
  Windows Scoop and PowerShell
&lt;/h3&gt;

&lt;p&gt;To install Restic on Windows, you have to use the Scoop module, and thus you need to be comfortable with PowerShell.&lt;/p&gt;

&lt;p&gt;First make sure that the ExecutionPolicy is set to RemoteSigned for the current user, if you don't understand ExecutionPolicy's it just tells PowerShell what level of security, it should be on, for the current user or machine, in this command we're changing the ExecutionPolicy so that it requires that all scripts and configs, that have been gotten remotely (Not on the local machine) must be signed by a trusted publisher, for the Current User, only, this doesn't change the ExecutionPolicy for any other user on the machine.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Set-ExecutionPolicy RemoteSigned -scope CurrentUser&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then we want to use PowerShell to download and install scoop using this command.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Invoke-Expression (New-Object System.Net.WebClient).DownloadString('&lt;a href="https://get.scoop.sh'"&gt;https://get.scoop.sh'&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then install Restic by using the command&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;scoop install Restic&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;you can than use Restic from the PowerShell environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Mac
&lt;/h3&gt;

&lt;p&gt;If you use a Mac you can either use homebrew, or MacPorts, since brew is more widely used, it would be of more use in future projects to install homebrew over MacPorts in my opinion, however, you're more than welcome to install software however you like on your own computer.&lt;/p&gt;

&lt;p&gt;To Install homebrew use the command&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;/bin/bash -c "$(curl -fsSL &lt;a href="https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"&gt;https://raw.githubusercontent.com/Homebrew/install/master/install.sh)&lt;/a&gt;"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then you can install programs using brew install, to install Restic just use&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;brew install restic&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now Restic is up and running&lt;/p&gt;

&lt;h3&gt;
  
  
  Linux and BSD's
&lt;/h3&gt;

&lt;p&gt;Install using your local repositories.&lt;/p&gt;

&lt;h3&gt;
  
  
  Alternatively
&lt;/h3&gt;

&lt;p&gt;You can download releases from the Restic GitHub release page, and then you can use Restic self-update when there's a newer version.&lt;/p&gt;

&lt;p&gt;You can also build Restic from Source.&lt;/p&gt;

&lt;h2&gt;
  
  
  Local or Online?
&lt;/h2&gt;

&lt;p&gt;Restic supports many different Backup Locations, these include local back ups, online back ups using someone else's cloud infrastructure, or your own remote services.&lt;/p&gt;

&lt;p&gt;A local back up is what I'm going to use in this blog, and so for further examples of other services, I suggest looking at the manual or reading someone else's remote back up solution, however, the majority of this blog will be the same regardless, however where you point the commands to and from will be different, there will also be extra account set up to think about that I wont go talk about in this Blog&lt;/p&gt;

&lt;h3&gt;
  
  
  Local
&lt;/h3&gt;

&lt;p&gt;Local backups are a great option, they're much faster than using the wireless, and wont slowdown any other time sensitive task ran over the network.&lt;/p&gt;

&lt;p&gt;Local also means "buy once" it might be a more upfront cost depending on what hard-drive you get, but you only need to pay that once, for online services, you have to pay monthly to keep up and running.&lt;/p&gt;

&lt;p&gt;It can be very cheap if you're going to get a spinning disk/s, however the backup will run slowly, this isn't a big problem if you're only backing up a small amount of data, but if you're backing up a lot, then you might want to purchase a more expensive higher speed SSD, however, a slow backup is better than no backup.&lt;/p&gt;

&lt;p&gt;You may also want to consider a SSD if you're planning on moving your backup data around, as HDD's are more perceptible to damage from falls, drops, or bangs.&lt;/p&gt;

&lt;p&gt;Local also means that your data is there, so if you use an external drive, you can unmount the drive from one computer, and restore the data to a new machine, without using more bandwidth.&lt;/p&gt;

&lt;p&gt;However Local means that you can only access the data if you have the storage medium in front of you, if you don't have the storage media, you don't have your data, if you need to get to your data remotely there are ways of doing it, but its a bit more effort, and can open yourself up to security issues, It also means that if you loose your backup device, or if it breaks then you've lost the data on that drive, which might not be to big of a problem if you still have your primary storage device, but if the reason you loose your data is due to a fire, or a electrical surge damages every device hooked into your computer, than you'll loose two drives in one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Online
&lt;/h3&gt;

&lt;p&gt;Online backups are great as you can use them anywhere, however they can be slow, especially if you live remote, it can be easier to deal with the cost up front if you're subscribing monthly or yearly, however it may cost more in the long run, if you're only backing up a small amount of data then some backup platforms will allow you to use them for free.&lt;/p&gt;

&lt;p&gt;However if you're using your own backup machine, say a raspberry pi that you've set up in another location, the price will barely be different from someone who's using a Local copy.&lt;/p&gt;

&lt;p&gt;A remote copy that you own will mean you still have to worry about some of the issues that you have to worry about with Local storage, however you don't need to worry about having both storage options breaking at the same time, but you will have to worry about Online issues, such as bandwidth.&lt;/p&gt;

&lt;p&gt;With backing up online, a standard backing up procedure you would also have to be concerned with privacy, but due to Restic's encryption, that isn't a issue that we have to worry about.&lt;/p&gt;

&lt;p&gt;If you wish to use online services, Restic offers you the following backup options&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Provider&lt;/th&gt;
&lt;th&gt;Init URL scheme&lt;/th&gt;
&lt;th&gt;Price as of writing&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SFTP&lt;/td&gt;
&lt;td&gt;restic -r sftp:user@host:/srv/restic-repo init&lt;/td&gt;
&lt;td&gt;Self Rolled&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;REST Server&lt;/td&gt;
&lt;td&gt;restic -r rest:&lt;a href="http://host:8000/"&gt;http://host:8000/&lt;/a&gt;
&lt;/td&gt;
&lt;td&gt;Self Rolled&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Minio Server&lt;/td&gt;
&lt;td&gt;restic -r s3:&lt;a href="http://localhost:9000/restic"&gt;http://localhost:9000/restic&lt;/a&gt; init&lt;/td&gt;
&lt;td&gt;Self Rolled&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wasabi&lt;/td&gt;
&lt;td&gt;restic -r s3:https:/// init&lt;/td&gt;
&lt;td&gt;$5.99 for 1 TB per month&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Backblaze B2&lt;/td&gt;
&lt;td&gt;restic -r b2:bucketname:path/to/repo init&lt;/td&gt;
&lt;td&gt;$0.005 per GB (Aprox $5 for 1 TB)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Amazon S3&lt;/td&gt;
&lt;td&gt;restic -r s3:s3.amazonaws.com/bucket_name init&lt;/td&gt;
&lt;td&gt;$0.024 per GB (Aprox $24 per month for 1 TB)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Microsoft Azure Blob Storage&lt;/td&gt;
&lt;td&gt;restic -r azure:foo:/ init&lt;/td&gt;
&lt;td&gt;$0.01 per GB (Aprox $10 per month for 1 TB)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Google Cloud Storage&lt;/td&gt;
&lt;td&gt;restic -r gs:foo:/ init&lt;/td&gt;
&lt;td&gt;They have a calculator&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;rclone services&lt;/td&gt;
&lt;td&gt;restic -r rclone:foo:bar init&lt;/td&gt;
&lt;td&gt;Depends what service you're using rclone with&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Both
&lt;/h3&gt;

&lt;p&gt;If you can afford the option to do Local and Online, than its best to have one copy in the cloud, and one copy on your desk, it allows you to have the best of both worlds, however the issue majortially, as always will be the cost.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up Local Storage (Linux Only)
&lt;/h2&gt;

&lt;p&gt;I bought a Samsung SSD 860 EVO, with 2TB's of storage as my backup device, it means I don't have to worry about issues with spinning disks or affecting my network speeds, my Pictures directory is 184 GB's so that would take a very long time to upload on my current data speed.&lt;/p&gt;

&lt;p&gt;However I do plan to add a online storage backup at some point.&lt;/p&gt;

&lt;h3&gt;
  
  
  Partitioning the Drive
&lt;/h3&gt;

&lt;p&gt;First step is obvious, you must first plug in the external drive, my external drive connector is USB-C and so I decided to take advantage of the extra speed that USB-C offers over USB type 3, and used a USB-C to USB-C plug. &lt;/p&gt;

&lt;p&gt;When I plugged in my SSD it didn't mount, which was quite worrying, however, when I opened KDE Partition Manager, it showed up without a Partition table, this maybe that the Drive didn't come with a partition table on it by default, or more likely, the partition table it came with, just isn't supported on Linux, which one however, we may never know.&lt;/p&gt;

&lt;p&gt;So the first thing to do is format the disk, just click on the drive,  and then click "New Partition Table" choose GPT, and create the new partition table, however, before we actually create the new partition table, theirs no point in doing that, if we don't add an actual partition, CTRL+N or click "New" will swing open a new popup window in this window, I decided to swap the File system to BTRFS, I didn't enable encryption with LUK's because all the data on the drive will already be encrypted with Restics back up encryption.&lt;/p&gt;

&lt;p&gt;I gave it a Label, and then clicked next, typing in my password as it was prompted, and then I mounted the device.&lt;/p&gt;

&lt;p&gt;As I'm using KDE Partition manager, I have the problem that I can only write to the device if I'm root, you can check this yourself if you're using Linux and KDE Partition manager, by using ls -l&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ls -l /run/media/$USER&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This will show you your drives and some information about them, if you see "root root" that means you have to change the owner, but if you see your username instead than that means you'll be okay.&lt;/p&gt;

&lt;p&gt;To change the ownership to your current user use chown&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sudo chown $USER:$USER /run/media/$USER/backup&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now the device is ready for restic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Restic on a Local drive
&lt;/h2&gt;

&lt;p&gt;First thing to do when starting a new Restic backup is to initiate the repo.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;restic init --repo /run/media/$USER/backup&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This will then ask you for a new password for the backup, if the data is extremly private, then please do not make a memorable password, but rather use an impossible password, by using a password manager the likes of KeePass or bit-warden, and keep that safe.&lt;/p&gt;

&lt;p&gt;Restic will also give you a repository location, mine for example is 2849ef4f60, this is an important number as if you create more repos you'll have to use the repo number to navigate through them.&lt;/p&gt;

&lt;p&gt;Now I'm going to back up my Pictures folder, my Pictures folder has all my photos organized into folders, except the Import folder, and some db folder's that I don't need to backup so I create a .exclude.txt file in my Pictures directory, simply saying "import".&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;restic -r /run/media/$USER/backup backup --tag Photos --verbose=2 ~/Pictures --exclude-file=.exclude.txt&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Okay so lets go through this&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;part of the command&lt;/th&gt;
&lt;th&gt;What it means&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;restic&lt;/td&gt;
&lt;td&gt;this starts restic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-r&lt;/td&gt;
&lt;td&gt;We are looking for a repository to backup or restore&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;/run/media/$USER/backup&lt;/td&gt;
&lt;td&gt;This is the repository that we're backing up or restoring from&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;backup&lt;/td&gt;
&lt;td&gt;We're backing up some data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;--tag Photos&lt;/td&gt;
&lt;td&gt;What we're backing up should be tagged, and the tag to this snapshot is Photos&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;--verbose=2&lt;/td&gt;
&lt;td&gt;We are going to display everything we're doing on the commandline&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;~/Pictures&lt;/td&gt;
&lt;td&gt;This is the folder we're backing up&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;--exclude-file=.exclude.txt&lt;/td&gt;
&lt;td&gt;We aren't backing up anything that this document tells us not to&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Then that's it, all I need to do now is choose.&lt;/p&gt;

&lt;h2&gt;
  
  
  Restic Backup options
&lt;/h2&gt;

&lt;p&gt;Lets look through some options that you can use when backing up your files.&lt;/p&gt;

&lt;p&gt;Excluding&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Exluding command&lt;/th&gt;
&lt;th&gt;What you exclude&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;--exclude=" "&lt;/td&gt;
&lt;td&gt;This excludes items with that name, or naming scheme&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;--iexclude=" "&lt;/td&gt;
&lt;td&gt;Same as exclude, but ignores the case of paths&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;--exclude-caches&lt;/td&gt;
&lt;td&gt;Exclude folders containtng a special file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;--exclude-file=excludes.txt&lt;/td&gt;
&lt;td&gt;Excludes items listed in given file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;--iexclude-file=excludes.txt&lt;/td&gt;
&lt;td&gt;same as exclude-file execept ignores the case of paths&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;--exclude-if-present foo&lt;/td&gt;
&lt;td&gt;Excludes a folders content if it contains a dffile called foo (optionaly having a given header, no wildcards for hte file name supported)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;--exclude-larger-than size&lt;/td&gt;
&lt;td&gt;Excludes files larger than the given size&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Including&lt;br&gt;
--files-from /tmp/files-to-backup /tmp/aditional-file&lt;/p&gt;

&lt;p&gt;Reading from stdin&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;set -o pipefail&lt;br&gt;
mysqldump [...] | restic -r /srv/restic-repo backup --stdin --stdin-filename production.sql&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This pipes the sqldump to a Restic backup, the backup then reads it as standard in using --stdin and we then give that stdin a filename using --stdin-filename.&lt;/p&gt;

&lt;h2&gt;
  
  
  Working with repositories
&lt;/h2&gt;

&lt;p&gt;You can list a repository by using Restic -r /srv/restic-repo snapshots.&lt;/p&gt;

&lt;p&gt;This will give you the ID, Date, Host, Tags, and Directory it backed up from, you can filter these by path using --path=, for example,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;restic -r /run/media/$USER/backup snapshots --path="/home/$USER/Pictures"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Will just show you snapshots that are backed up from the pictures directory, you can also filter by user by using '--host &amp;amp;USER', not only can you filter using these tags, you can also list them so that they're specifically grouped by hosts, tags, or directory's, by using --group-by&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;restic -r /run/media/$USER/backup snapshots --group-by paths&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This will group things according to the path that that the backup is from.&lt;/p&gt;

&lt;p&gt;It is important to check the integrity of a backup, to make sure that a hard-drive hasn't scrambled any data, or that someone with malicious intent hasn't tried to edit, the file, you can do this by using the check command.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;restic -r /run/media/$USER/backup check&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If your backup hasn't been tempered with or is still working fine, it will tell you there are no errors and you can continue using the backup, otherwise it's best to restore what you can and create a new backup.&lt;/p&gt;

&lt;p&gt;The check command also checks such as none referenced packs in the index, it will often give you some recommendations of what to do with the result of the command, in my case Restic suggests that I have files in the repo which are duplicated, that I can get rid of by using the Restic prune command.&lt;/p&gt;

&lt;p&gt;This command can be used to save a lot of hard-drive space&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$ restic -r /run/media/*/backup prune&lt;br&gt;
enter password for repository: &lt;br&gt;
repository 2849ef4f opened successfully, password is correct&lt;br&gt;
counting files in repo&lt;br&gt;
building new index for repo&lt;br&gt;
[0:05] 100.00%  16742 / 16742 packs&lt;br&gt;
repository contains 16742 packs (73165 blobs) with 80.012 GiB&lt;br&gt;
processed 73165 blobs: 1989 duplicate blobs, 2.430 GiB duplicate&lt;br&gt;
load all snapshots&lt;br&gt;
find data that is still in use for 2 snapshots&lt;br&gt;
[0:00] 100.00%  2 / 2 snapshots&lt;br&gt;
found 71176 of 73165 data blobs still in use, removing 1989 blobs&lt;br&gt;
will remove 0 invalid files&lt;br&gt;
will delete 0 packs and rewrite 1021 packs, this frees 2.430 GiB&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Restoring from a snapshot
&lt;/h2&gt;

&lt;p&gt;Whats the point in having a backup if you don't know how to get the data back off the drive?&lt;/p&gt;

&lt;p&gt;One way of restoring from a snapshot is by straight up restoring the data.&lt;/p&gt;

&lt;p&gt;First step is to identify which backup you want to restore, by listing your repos, and choosing the ID, for me my id for the latest backup of Photos, is 31e587ea, so to restore my latest backup of that path, I would use the command.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$ restic -r /run/media/*/backup restore 31e587ea --target /Pictures&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you don't want top bother with finding out the ID, you can use tell Restic that you want the latest copy of the Pictures file by using the latest and --path tags.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$ restic -r /run/media/*/backup restore latest --target /Pictures --path "/home/Pictures"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;However, perhaps I just want to browse the content of a restic folder, without restoring it, perhaps you only want to restore a handful of files, due to corruption, or are using the backup drive as a portable hard drive.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;mkdir /mnt/restic&lt;br&gt;
restic -r /run/media/*/backup mount /mnt/restic&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This mounts the Restic backup to a mnt directory, so you can easily browse through it using your favourite file manager.&lt;/p&gt;

&lt;h2&gt;
  
  
  Automating the backups.
&lt;/h2&gt;

&lt;p&gt;You can automate Restic backups using systemd, using the code as a base bellow, and paste it into our favourite text editor of choice, and save the file to &lt;em&gt;~/.config/systemd/user/restic-backup.service file.&lt;/em&gt;  you may have to make some of the folders yourself, and you should edit this to reflect your backup system.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;[Unit]&lt;br&gt;
Description=Restic backup service&lt;br&gt;
[Service]&lt;br&gt;
Type=oneshot&lt;br&gt;
ExecStart=restic -r $RESTIC_REPOSITORY backup --verbose --tag Photos $RESTIC_PATHS  --password-file="$HOME/Documents/Keys/Backup_Codes/resticpassword"&lt;br&gt;
ExecStart=restic -r $RESTIC_REPOSITORY backup --verbose --tag Documents $RESTIC_PATHS_DOCUMENTS  --password-file="$HOME/Documents/Keys/Backup_Codes/resticpassword"&lt;br&gt;
ExecStartPost=restic -r $RESTIC_REPOSITORY forget --verbose --group-by "paths" --keep-within 1y0m0d0h --password-file="$HOME/Documents/Keys/Backup_Codes/resticpassword"&lt;br&gt;
EnvironmentFile=$HOME/.config/restic-backup.conf&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;These reference an Environment file, which will give the service the needed attributes to run the backup&lt;/p&gt;

&lt;p&gt;This is waht my restic-backup.conf looks like&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;RESTIC_PATHS_PICTURES="$USER/Pictures"&lt;br&gt;
RESTIC_PATHS_DOCUMENTS="$USER/Documents"&lt;br&gt;
RESTIC_REPOSITORY="/run/media/*/Backup"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Last but not least is the timer, if you wish to have a weekly timer, just copy and paste this into a new file, and name it "restic-backup.timer", if youd rather your backups happen hourly, just replace weekly with hourly.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;[Unit]&lt;br&gt;
Description=Backup with restic weekly&lt;br&gt;
[Timer]&lt;br&gt;
OnCalendar=weekly&lt;br&gt;
Persistent=true&lt;br&gt;
[Install]&lt;br&gt;
WantedBy=timers.target&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then to kick it of just type&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;systemctl --user enable --now restic-backup.timer&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There you have it that's how you make it so restic automatically backs up your data weekly, using systemd, while also removing year old snapshots, however you still need to prune your data now and again, so you can create another automatic systemd process, or prune it yourself, restic is pretty slow when pruning, so you don't want to do it to often, and you want to make sure that you make a log using the check command to make sure that nothing went wrong during pruning.&lt;/p&gt;

&lt;p&gt;Perhaps you've left the timer running for a few days, or have had your computer turned off during the scheduled time, and you want to know where the system is with your backup, you can use systemctl to tell you how long it is until the next time the process will run and when it ran last.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;systemctl --user list-timers&lt;br&gt;
NEXT                        LEFT        LAST                        PASSED       UNIT                ACTIVATES&lt;br&gt;&lt;br&gt;
Mon 2020-12-07 00:00:00 GMT 5 days left Mon 2020-11-30 00:00:57 GMT 1 day 1h ago restic-backup.timer restic-backup.service&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then you can double check that the backup worked and was successful using the restic check command and restic snapshot command, to make sure that the backup happened and was effective, and to make sure nothing broke, in case something like a shutdown during a backup affected the backup.&lt;/p&gt;

</description>
      <category>restic</category>
      <category>backup</category>
    </item>
    <item>
      <title>Upgrading the PinePhone MainBoard</title>
      <dc:creator>PhoenixLandPirate</dc:creator>
      <pubDate>Fri, 20 Nov 2020 22:58:42 +0000</pubDate>
      <link>https://dev.to/phoenixlandpirate/upgrading-the-pinephone-mainboard-k45</link>
      <guid>https://dev.to/phoenixlandpirate/upgrading-the-pinephone-mainboard-k45</guid>
      <description>&lt;h2&gt;
  
  
  backing up
&lt;/h2&gt;

&lt;p&gt;At the time of writing Ubuntu Touch has many issue around mounting, sharing files, moving files, etc, so its not as simple as just copying and pasting your files from your storage to your SDcard, unless you know your way around the command line.&lt;/p&gt;

&lt;p&gt;I decided to back my PinePhone up using the already pre-installed JumpDrive, to enter this, just volume up as you power on the phone, a image of Yumi should appear, saying that its waiting for a command, if you plug in the PinePhone you'll get a big list of mountable drives, we want to mount userdata, than move up into user-data and then phablet.&lt;/p&gt;

&lt;p&gt;This gives us a view of all our documents, I selected all the files and straight copied and paste them into a PinePhone sub folder so that I can easily copy and paste them back onto the PinePhone after the upgrade, ultimately this also gives me the ability to properly look the files to remove any old outdated files and just organize my phone a bit more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flashing JumpDrive
&lt;/h2&gt;

&lt;p&gt;You'll need a spare SDcard that you don't mind writing over, the new PinePhone mainboard doesn't come with any OS pre-installed, so we have to give the phone a OS to boot off, so that we can flash Ubuntu Touch later!&lt;/p&gt;

&lt;p&gt;First download the latest &lt;a href="https://github.com/dreemurrs-embedded/Jumpdrive/releases/tag/0.6"&gt;JumpDrive&lt;/a&gt;, once that's downloaded, use your favourite flasher, I personally use Etcher, though other people may rather use dd.&lt;/p&gt;

&lt;p&gt;After that's flashed you can forget about it until we've installed the mainboard.&lt;/p&gt;

&lt;h2&gt;
  
  
  Taking apart the PinePhone
&lt;/h2&gt;

&lt;p&gt;Unplug and turn off the PinePhone, take the back cover off, there's a little lip in the bottom right, take the battery out, and remove your SDcard and/or Sim card if you have any installed, this isn't necessary however it means as soon as the mainboard is out, you don't need to worry about it again.&lt;/p&gt;

&lt;p&gt;Next is to unscrew the inner frame, this has 15 screws, including a warranty screw, as soon as you remove that screw you have voided your warranty, put the screws to the side, they're all the same size so you don't have to worry about which ones go where, but do keep them safe, because you don't get any extra's, Gently lift up the inner frame, holding onto it from the gap where the battery was, and the outer-side, gently pull it up, holding the rest of the phone down if necessary.&lt;/p&gt;

&lt;p&gt;Great you're at the level where you can remove the mainboard, this bit is a bit fidgety, first remove the tags at the bottom of the mainboard gently, these are the easiest to remove, then lift the antenna cable up off the mainboard, there are 3 left to do at this stage, the one on the left, and two on the top, leave the cameras for now, these are easier to remove when the mainboard is out of the case, flip the piece that's keeping the ribbon cables in, and gently remove the cables.&lt;/p&gt;

&lt;p&gt;If you didn't use a tool for the last part you'll want one now, the mainboard is kept in place by some tabs, and if you try to remove the mainboard with your nails, you'll most likely hurt yourself, you don't want to use anything metal either as you may damage your mainboard, however, if you have a plastic prying tool that should work fine, if all you have is metal, you can use that, just make sure to be careful.&lt;/p&gt;

&lt;p&gt;Get your tool under the mainboard, and lift it up gently, moving around the mainboard, as they un-clip, then when all the tabs are un-clipped, you can take the mainboard out with your hand, next flick the locks on the mainboard for the camera's and remove them from the mainboard, you'll want to add these to your new mainboard before you put the new mainboard in the case.&lt;/p&gt;

&lt;h2&gt;
  
  
  Putting it back together
&lt;/h2&gt;

&lt;p&gt;Grab your new mainboard, and open up all the slots for input, slide in the ribbon cables for the camera's, and clip them back in, now you can put the mainboard back in, make sure the mainboard has the kill switches facing you, put the mainboard in the phone, but be careful not have the cables above the mainboard, so you don't squish or break any when you're pushing the new mainboard down, as long as the cables are above the mainboard, push down until you hear the tabs click and hold the mainboard back in place, you may need to wiggle it around a little.&lt;/p&gt;

&lt;p&gt;Put the rest of the ribbon cables back in and close the tabs, this may be a bit finicky, but if you give it a few goes you'll be okay, the hardest one to put back in, is the antenna cable, you may want to pull the cable out of the phone a bit to give yourself more wiggle room to get it hooked up, its also recommended that you use something like a flat ended screwdriver to push the cable back in, then make sure you push the cable back into the space its allotted.&lt;/p&gt;

&lt;p&gt;After all the cables are in, plug in your SDcard with JumpDrive installed, and battery, its best to test the device before you put it back together again, if the screen turns on and JumpDrive starts, you haven't destroyed your device.&lt;/p&gt;

&lt;p&gt;Remove the battery again and put the inner frame back on, screw the frame back into place, and put your battery back in.&lt;/p&gt;

&lt;p&gt;You also get a thermal pad with your mainboard, that sticks onto the inner part of the back cover so you may want to add that now, then put your back on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ubuntu Touch Time
&lt;/h2&gt;

&lt;p&gt;Download the latest version of Ubuntu Touch from the official &lt;a href="https://ci.ubports.com/job/rootfs/job/rootfs-pinephone-systemimage"&gt;Jenkins&lt;/a&gt;, if you use etcher you can use the compressed file to flash, however all this does is extract the file somewhere else and then pushes it to your phone, this is usually okay if the file that's being extracted isn't to big, but the file that comes out the other end is about 13GB's so I recommend extracting it somewhere locally, that way if something goes wrong, you know where, you know why, and you know what to do about it, also extracting large archives like that can take a tole on a computer, especially if your computer is lower end, so don't do much while extracting, unless you have a powerful computer.&lt;/p&gt;

&lt;p&gt;After the img is extracted, turn your phone on and plug it in, then flash with your favourite flashing tool, however, be aware that with JumpDrive gives you an option to write to the eMMC or the SDcard, make sure you get the right partition (eMMC if you want it internally), for me the eMMC drive was located at /dev/sde.&lt;/p&gt;

&lt;p&gt;Wait for that to finish flashing, turn off your phone, open your phone back up for the last time, remove your JumpDrive Sd card and insert your normal one and you Sim card if you so wish, and turn the phone back on for its first boot.&lt;/p&gt;

&lt;p&gt;It takes a bit longer to boot on first run, but after its finished booting, go through the setup wizard, and check that everything else is working, such as sound, Bluetooth, cameras, etc, to make sure that you've connected everything correctly before you start bringing all your stuff over.&lt;/p&gt;

&lt;h2&gt;
  
  
  Migration
&lt;/h2&gt;

&lt;p&gt;To migrate your stuff we turn off the phone, and turn it back on holding volume down, then remember where your data should be stored on the phone? userdata/user-data/phablet, so copy and paste your back up folders into that folder.&lt;/p&gt;

&lt;p&gt;You may run into permission errors, and if so you can use &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sudo chmod 772 * -R&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you're not comfortable with the command line than I don't recommend restoring your data like this, and rather just reinstall everything and use your sd card to transfer your files in your standard directories back.&lt;/p&gt;

&lt;p&gt;after you've copied everything you want back, reboot into Ubuntu Touch, open the terminal and use&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ls -laR &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Check and see who the owner and group the files belong to, if they belong to "system" then Ubuntu Touch wont be able to use them, the easiest way to fix the owner issue, is by using this command&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sudo chown phablet:phablet -R&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This changes every file from your home directory to be owned by phablet, and this will fix a lot of issues you have later when reinstalling apps, or trying to look at your images in the gallery app.&lt;/p&gt;

&lt;p&gt;install UB tweak tool, and then install your other apps, if any app just shows a blank page, or doesn't work after the update, you're going to have to clear data, and start again with that app unfortunately.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enjoy
&lt;/h2&gt;

&lt;p&gt;Enjoy playing with your new 3GB version of the PinePhone!&lt;/p&gt;

</description>
      <category>pinephone</category>
      <category>ubuntutouch</category>
    </item>
  </channel>
</rss>
