{"id":1457,"date":"2020-03-04T09:02:22","date_gmt":"2020-03-04T15:02:22","guid":{"rendered":"http:\/\/blog.ls-al.com\/?p=1457"},"modified":"2020-04-12T11:57:05","modified_gmt":"2020-04-12T16:57:05","slug":"restic-recover-os","status":"publish","type":"post","link":"https:\/\/blog.ls-al.com\/restic-recover-os\/","title":{"rendered":"Restic recover OS"},"content":{"rendered":"
Note the following:<\/p>\n
$ ssh ubuntu@192.168.1.160\n$ sudo -i\n\n# export AWS_ACCESS_KEY_ID=<secret..>\n# export AWS_SECRET_ACCESS_KEY=<secret..>\n# export RESTIC_PASSWORD=<secret..>\n# export RESTIC_REPOSITORY=sftp:rr@192.168.1.111:\/ARCHIVE\/restic-os-restore-poc\n# cd \/usr\/local\/bin\/\n# wget https:\/\/github.com\/restic\/restic\/releases\/download\/v0.9.6\/restic_0.9.6_linux_amd64.bz2\n# bzip2 -d restic_0.9.6_linux_amd64.bz2 \n# mv restic_0.9.6_linux_amd64 restic\n# chmod +x restic \n# mkdir \/mnt\/restore\n# sfdisk -d \/dev\/sda < partition-table\n# mkfs.ext4 \/dev\/sda1\n# mkdir \/mnt\/restore\/\n# mount \/dev\/sda1 \/mnt\/restore\/\n# \/usr\/local\/bin\/restic snapshots\n# time \/usr\/local\/bin\/restic restore latest -t \/mnt\/restore --exclude '\/etc\/fstab' --exclude '\/etc\/crypttab' --exclude '\/boot\/grub\/grub.cfg' --exclude '\/etc\/default\/grub'\n\n# mount --bind \/dev \/mnt\/restore\/dev\n# mount -t sysfs sys \/mnt\/restore\/sys\n# mount -t proc proc \/mnt\/restore\/proc\n# mount -t devpts devpts \/mnt\/restore\/dev\/pts\n# mount -t tmpfs tmp \/mnt\/restore\/tmp\n# mount --rbind \/run \/mnt\/restore\/run\n# mount -t tmpfs tmp \/mnt\/restore\/tmp\n\n# chroot \/mnt\/restore \/bin\/bash\n# lsblk | grep sda\n# grub-install \/dev\/sda\n# update-grub\n# blkid | grep sda\n\n# UUID=$(blkid | grep sda | cut -d' ' -f2 | cut -d\\ -f2)\n# echo $UUID \/ ext4 errors=remount-ro 0 1 > \/etc\/fstab\n\n# sync\n# exit\n# init 0<\/code><\/pre>\nNote:<\/strong><\/p>\nNew server booted and worked but graphics (GNOME login) login for ubuntu account stalled on login. This fixed it: dconf reset -f \/org\/gnome\/<\/em><\/strong><\/p>\nMy restic backup command works but just for reference since restic has no include flag rsync seem to have a better exclude\/include functionality syntax like this: *rsync --include=\/dev\/{console,null} --exclude={\/dev\/,\/proc\/,\/sys\/,\/tmp\/,\/run\/,\/mnt\/,\/media\/,\/lost+found}<\/em><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"My test to recover an Ubuntu server OS from a backup. Note the following: I used Ubuntu 20.04 (focal) which<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[99],"tags":[115],"class_list":["post-1457","post","type-post","status-publish","format-standard","hentry","category-restic","tag-restic"],"_links":{"self":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/1457","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/comments?post=1457"}],"version-history":[{"count":0,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/1457\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/media?parent=1457"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/categories?post=1457"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/tags?post=1457"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}