{"id":950,"date":"2026-09-29T17:05:26","date_gmt":"2026-09-29T16:05:26","guid":{"rendered":"https:\/\/guillaumesblog.net\/?p=950"},"modified":"2026-09-29T17:05:26","modified_gmt":"2026-09-29T16:05:26","slug":"always-have-your-back-ups-ready","status":"publish","type":"post","link":"https:\/\/guillaumesblog.net\/index.php\/always-have-your-back-ups-ready\/","title":{"rendered":"Always have your back-ups ready!"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"798\" src=\"https:\/\/guillaumesblog.net\/wp-content\/uploads\/2026\/09\/datarecoveryhdd.jpg\" alt=\"\" class=\"wp-image-952\" srcset=\"https:\/\/guillaumesblog.net\/wp-content\/uploads\/2026\/09\/datarecoveryhdd.jpg 1024w, https:\/\/guillaumesblog.net\/wp-content\/uploads\/2026\/09\/datarecoveryhdd-300x234.jpg 300w, https:\/\/guillaumesblog.net\/wp-content\/uploads\/2026\/09\/datarecoveryhdd-767x598.jpg 767w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Always assume the worst immediately! Fun story I got locked out from my Debian instance because of a bug in the distro update, and this did prevent me from logging in from SSH. To make matters worst I did not set-up user passwords at VM creation and hence could not to access the console from the serial connection&#8230; so there was no way for me to enter the instance and to troubleshot.<\/p>\n\n\n\n<!--more-->\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"247\" src=\"https:\/\/guillaumesblog.net\/wp-content\/uploads\/2026\/09\/image-11-1024x247.png\" alt=\"\" class=\"wp-image-954\" srcset=\"https:\/\/guillaumesblog.net\/wp-content\/uploads\/2026\/09\/image-11-1024x247.png 1024w, https:\/\/guillaumesblog.net\/wp-content\/uploads\/2026\/09\/image-11-300x72.png 300w, https:\/\/guillaumesblog.net\/wp-content\/uploads\/2026\/09\/image-11-764x184.png 764w, https:\/\/guillaumesblog.net\/wp-content\/uploads\/2026\/09\/image-11-1200x289.png 1200w, https:\/\/guillaumesblog.net\/wp-content\/uploads\/2026\/09\/image-11.png 1520w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><figcaption class=\"wp-element-caption\">Could not access the machine.. I did not setup any password<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I am talking about this weird error from Debian 13 <a href=\"https:\/\/www.reddit.com\/r\/debian\/comments\/1tgg90j\/systemdsshgenerator_af_vsock_error\/\">here<\/a>&#8230; Anyway I ended up being very nervous about my ability to recover my website (this blog), since I usually do the back-ups manually (!) and also did not run one for a while&#8230; I would have for sure lost a couple of articles. I would have though that Debian would spare me from such dumb issues, as the distro had a reputation to be extremely stable. What happened is that I did an update during the previous connection a few months ago and did not take the necessary precautions you should always take before making any kind of updates.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thankfully I solved it by unmounting the disk and mounting it onto a new instance, attach my reserved IP to it and I could get going again. The take away is to not forget to setup passwords on users, and also to automate the back ups.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n# THE CRON JOB CODE\n\necho \"Prepping variables...\"\nCURRENTEPOCTIME=`date +\"%Y-%m-%d_%H%M%S\"`\nBACKUP_PATH=\"\/home\/admin\/backups\/backup_nginx_${CURRENTEPOCTIME}\"\necho \"Creating backup folder....\"\nmkdir -p \"${BACKUP_PATH}\"\necho \"Backing up DB....\"\nmysqldump -u root wordpress_db > \"${BACKUP_PATH}\/backup_db_${CURRENTEPOCTIME}.sql.bak\"\necho \"Backing up html folder...\"\ncp -R \/var\/www\/html \"$BACKUP_PATH\"\/\necho \"Tar-ing the lot...\"\ntar -czf \"${BACKUP_PATH}\"\/..\/backup_wp_website-\"$CURRENTEPOCTIME\".tar.gz -C \"$BACKUP_PATH\"\/.. .\nrm -rf \"${BACKUP_PATH}\"\necho \"Sending it to s3 Ohio...\"\n. \/root\/tos3\/env\/bin\/activate\npython \/root\/tos3\/main.py\necho \"Done\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And the python code with boto3 for an upload of the backup into S3<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import boto3, os, logging\nfrom botocore.exceptions import ClientError\n\ns3 = boto3.resource('s3')\ns3_client = boto3.client('s3')\nmy_bucket = s3.Bucket('bucket_name')\np = r\"\/home\/admin\/backups\/\"\n\nprint(\"Begin copy to bucket....\")\n\nfor file in os.scandir(p):\n    if file.is_file():\n        obj_name = os.path.basename(file)\n        try:\n            resp = s3_client.upload_file(file, my_bucket.name, obj_name)\n        except ClientError as e:\n            logging.error(e)\n\nprint(\"Script executed\")<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now I can sleep better, my cron job will execute periodically and store my backups safely in S3&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"406\" src=\"https:\/\/guillaumesblog.net\/wp-content\/uploads\/2026\/09\/image-12-1024x406.png\" alt=\"\" class=\"wp-image-957\" srcset=\"https:\/\/guillaumesblog.net\/wp-content\/uploads\/2026\/09\/image-12-1024x406.png 1024w, https:\/\/guillaumesblog.net\/wp-content\/uploads\/2026\/09\/image-12-300x119.png 300w, https:\/\/guillaumesblog.net\/wp-content\/uploads\/2026\/09\/image-12-766x304.png 766w, https:\/\/guillaumesblog.net\/wp-content\/uploads\/2026\/09\/image-12-1200x476.png 1200w, https:\/\/guillaumesblog.net\/wp-content\/uploads\/2026\/09\/image-12.png 1509w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Here are my take away, appreciate I am stating the obvious here \ud83d\ude42<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Take a snapshot of your VM before you run any update command<\/li>\n\n\n\n<li>Set up your users passwords so you can recover from the serial connection<\/li>\n\n\n\n<li>Automate your backups and send them into a long term durable storage like S3<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">See you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Always assume the worst immediately! Fun story I got locked out from my Debian instance because of a bug in the distro update, and this did prevent me from logging in from SSH. To make matters worst I did not set-up user passwords at VM creation and hence could not to access the console from &hellip; <a href=\"https:\/\/guillaumesblog.net\/index.php\/always-have-your-back-ups-ready\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Always have your back-ups ready!&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-950","post","type-post","status-publish","format-standard","hentry","category-conversation"],"_links":{"self":[{"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/posts\/950","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/comments?post=950"}],"version-history":[{"count":5,"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/posts\/950\/revisions"}],"predecessor-version":[{"id":959,"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/posts\/950\/revisions\/959"}],"wp:attachment":[{"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/media?parent=950"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/categories?post=950"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/guillaumesblog.net\/index.php\/wp-json\/wp\/v2\/tags?post=950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}