{"id":859,"date":"2016-02-16T03:06:08","date_gmt":"2016-02-16T11:06:08","guid":{"rendered":"https:\/\/www.cloudinsidr.com\/content\/?p=859"},"modified":"2017-10-20T07:02:53","modified_gmt":"2017-10-20T15:02:53","slug":"how-to-restore-your-instance-data-from-a-backup-using-snapshots-on-aws-ec2ebs","status":"publish","type":"post","link":"https:\/\/www.cloudinsidr.com\/content\/how-to-restore-your-instance-data-from-a-backup-using-snapshots-on-aws-ec2ebs\/","title":{"rendered":"How to Restore Your Instance Data from a Backup using Snapshots on AWS EC2\/EBS"},"content":{"rendered":"<p>You are writing all these backups as individual EC2 snapshots and\/or full AMIs on AWS EC2 but how can you actually use them, should disaster befall your data?<\/p>\n<p>Here is how to do that on Linux.<\/p>\n<p><!--more--><\/p>\n<h6>Step 1. Create a volume from a snapshot<\/h6>\n<p>In the AWS Management Console, find the snapshot that holds you backup.<\/p>\n<figure id=\"attachment_862\" aria-describedby=\"caption-attachment-862\" style=\"width: 680px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/01_create_volume_from_snapshot.png\" rel=\"attachment wp-att-862\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-862\" src=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/01_create_volume_from_snapshot-1024x678.png\" alt=\"AWS EC2: create an EBS volume from a snapshot\" width=\"680\" height=\"450\" srcset=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/01_create_volume_from_snapshot-1024x678.png 1024w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/01_create_volume_from_snapshot-600x397.png 600w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/01_create_volume_from_snapshot-300x199.png 300w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/01_create_volume_from_snapshot-768x509.png 768w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/01_create_volume_from_snapshot.png 1025w\" sizes=\"(max-width: 680px) 100vw, 680px\" \/><\/a><figcaption id=\"caption-attachment-862\" class=\"wp-caption-text\">AWS EC2: create an EBS volume from a snapshot<\/figcaption><\/figure>\n<p>Next, create a volume from it and attach the volume to your running instance.<\/p>\n<figure id=\"attachment_864\" aria-describedby=\"caption-attachment-864\" style=\"width: 681px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/03_attach_the_volume.png\" rel=\"attachment wp-att-864\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-864\" src=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/03_attach_the_volume.png\" alt=\"AWS EC2: attaching an EBS volume to an instance\" width=\"681\" height=\"372\" srcset=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/03_attach_the_volume.png 681w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/03_attach_the_volume-600x328.png 600w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/03_attach_the_volume-300x164.png 300w\" sizes=\"(max-width: 681px) 100vw, 681px\" \/><\/a><figcaption id=\"caption-attachment-864\" class=\"wp-caption-text\">AWS EC2: attaching an EBS volume to an instance<\/figcaption><\/figure>\n<p>Add a name label to your volume to help avoid a mishap.<\/p>\n<figure id=\"attachment_863\" aria-describedby=\"caption-attachment-863\" style=\"width: 680px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/02_label_the_volume.png\" rel=\"attachment wp-att-863\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-863\" src=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/02_label_the_volume-1024x312.png\" alt=\"AWS EC2: Label your EBS volume\" width=\"680\" height=\"207\" srcset=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/02_label_the_volume-1024x312.png 1024w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/02_label_the_volume-600x183.png 600w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/02_label_the_volume-300x91.png 300w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/02_label_the_volume-768x234.png 768w, https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2016\/02\/02_label_the_volume.png 1169w\" sizes=\"(max-width: 680px) 100vw, 680px\" \/><\/a><figcaption id=\"caption-attachment-863\" class=\"wp-caption-text\">AWS EC2: Label your EBS volume<\/figcaption><\/figure>\n<h6>Step 2. Identify your backup volume in Linux<\/h6>\n<p>Now is the time to have a look at the currently attached file systems:<\/p>\n<pre>fdisk -l<\/pre>\n<p>Compare this with the contents of fstab:<\/p>\n<pre>cat \/etc\/fstab<\/pre>\n<p>Make a note of the address of the volume.<\/p>\n<h6>Step 3. Replace the UUID and adjust the label<\/h6>\n<p>Read out the UUID of the supplemental drive:<\/p>\n<pre>xfs_admin -u \/dev\/xvdg1<\/pre>\n<p>Replace the UUID with a newly generated one:<\/p>\n<pre>xfs_admin -U generate \/dev\/xvdg1<\/pre>\n<p>Change the label:<\/p>\n<pre>xfs_admin -L \"Backup\" \/dev\/xvdg1<\/pre>\n<p>You should see output resembling this one:<\/p>\n<p>writing all SBs<\/p>\n<pre>new label = \"Backup\"<\/pre>\n<h6>Step 4. Mount the file system<\/h6>\n<p>Before you can access the volume, you need to mount the file system:<\/p>\n<pre>mount \/dev\/xvdg1 \/var\/www\/backup<\/pre>\n<p>Should you encounter problems, see:<\/p>\n<pre>dmesg | tail<\/pre>\n<p>for leads on trooubleshooting.<\/p>\n<h6>Step 5. Do your thing with the backup<\/h6>\n<p>Next, switch to the source directory containing your backup files:<\/p>\n<pre>cd \/path\/to\/your\/backup<\/pre>\n<p>Then copy or move the files.<\/p>\n<h6>Step 6. Always clean up after yourself<\/h6>\n<p>Exit the directory and unmount the volume:<\/p>\n<pre>cd \/<\/pre>\n<pre>umount \/dev\/xvdg1<\/pre>\n<p>Now\u00a0feel free to detach the volume and destroy it (you still get to keep the original snapshot!).<\/p>\n<p>Related:\u00a0<a href=\"https:\/\/www.cloudinsidr.com\/content\/a-cyber-security-showdown-aws-versus-microsoft-azure\/\">How to ramp up your defenses: a cyber security showdown of AWS versus Microsoft Azure<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You are writing all these backups as individual EC2 snapshots and\/or full AMIs on AWS EC2 but how can you actually use them, should disaster befall your data? Here is how to do that on Linux.<\/p>\n","protected":false},"author":101012,"featured_media":76,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[16],"tags":[58,78,63],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v14.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Restore Your Instance Data from a Backup using Snapshots on AWS EC2\/EBS - CloudInsidr<\/title>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.cloudinsidr.com\/content\/how-to-restore-your-instance-data-from-a-backup-using-snapshots-on-aws-ec2ebs\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Restore Your Instance Data from a Backup using Snapshots on AWS EC2\/EBS - CloudInsidr\" \/>\n<meta property=\"og:description\" content=\"You are writing all these backups as individual EC2 snapshots and\/or full AMIs on AWS EC2 but how can you actually use them, should disaster befall your data? Here is how to do that on Linux.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.cloudinsidr.com\/content\/how-to-restore-your-instance-data-from-a-backup-using-snapshots-on-aws-ec2ebs\/\" \/>\n<meta property=\"og:site_name\" content=\"CloudInsidr\" \/>\n<meta property=\"article:published_time\" content=\"2016-02-16T11:06:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-10-20T15:02:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2015\/11\/cloudinsidr_logo_900px-wide.png\" \/>\n\t<meta property=\"og:image:width\" content=\"900\" \/>\n\t<meta property=\"og:image:height\" content=\"326\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#website\",\"url\":\"https:\/\/www.cloudinsidr.com\/content\/\",\"name\":\"CloudInsidr\",\"description\":\"Cyber security, infotech\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.cloudinsidr.com\/content\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/how-to-restore-your-instance-data-from-a-backup-using-snapshots-on-aws-ec2ebs\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2015\/11\/cloudinsidr_logo_900px-wide.png\",\"width\":900,\"height\":326,\"caption\":\"cloudinsidr.com logo (900px wide)\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/how-to-restore-your-instance-data-from-a-backup-using-snapshots-on-aws-ec2ebs\/#webpage\",\"url\":\"https:\/\/www.cloudinsidr.com\/content\/how-to-restore-your-instance-data-from-a-backup-using-snapshots-on-aws-ec2ebs\/\",\"name\":\"How to Restore Your Instance Data from a Backup using Snapshots on AWS EC2\/EBS - CloudInsidr\",\"isPartOf\":{\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/how-to-restore-your-instance-data-from-a-backup-using-snapshots-on-aws-ec2ebs\/#primaryimage\"},\"datePublished\":\"2016-02-16T11:06:08+00:00\",\"dateModified\":\"2017-10-20T15:02:53+00:00\",\"author\":{\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#\/schema\/person\/73723b2da71b6d515d17ca593ea5dc68\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.cloudinsidr.com\/content\/how-to-restore-your-instance-data-from-a-backup-using-snapshots-on-aws-ec2ebs\/\"]}]},{\"@type\":[\"Person\"],\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#\/schema\/person\/73723b2da71b6d515d17ca593ea5dc68\",\"name\":\"Filipe Martins\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/dbac033b4d26da8ca1fbde233e49c8dc?s=96&d=mm&r=g\",\"caption\":\"Filipe Martins\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/posts\/859"}],"collection":[{"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/users\/101012"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/comments?post=859"}],"version-history":[{"count":8,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/posts\/859\/revisions"}],"predecessor-version":[{"id":1592,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/posts\/859\/revisions\/1592"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/media\/76"}],"wp:attachment":[{"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/media?parent=859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/categories?post=859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/tags?post=859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}