Skip to content

[Use Case] Restore a btrfs subvolume backup from your Google Drive

l3iggs edited this page Feb 22, 2015 · 1 revision

WARNING: This restore method is very lightly tested and should probably not be relied upon
Let's assume the following things:

  • you have an encrypted, compressed btrfs snapshot backup file in the root level of your Google Drive named home.bak.xz.enc you'd like to restore from
  • you have drive and the xz and openssl utilities installed, initialized and working properly on your machine
  • you have a plain text file, ~/secretPassword, which contains a passphrase that was used during the encryption step of your backup

First, cd to your drive folder on your local machine, then:

sudo mkdir /restore # let's create a folder that will hold the incoming btrfs subvolume
drive pull -piped home.bak.xz.enc | openssl enc -d -aes-256-cbc -pass file:${HOME}/secretPassword | unxz | sudo btrfs receive /restore/

That's it!
You now have the read-only backup snapshot you made in /restore/home.snap.ro (or whatever you named it during backup). If you'd like, you can make it writable with btrfs property set -ts /restore/home.snap.ro ro false

Also see: [Backup a btrfs subvolume to your Google Drive]([Use Case] Backup a btrfs subvolume to your Google Drive)