{"id":26,"date":"2012-07-09T04:46:35","date_gmt":"2012-07-09T04:46:35","guid":{"rendered":"http:\/\/rln.d13dns.com\/?p=26"},"modified":"2012-07-09T04:46:35","modified_gmt":"2012-07-09T04:46:35","slug":"ubuntu-12-04-xen-xcp-xapi-bare-metal-recovery-via-rsnapshot","status":"publish","type":"post","link":"https:\/\/randomlinuxnotes.d13.com\/?p=26","title":{"rendered":"ubuntu 12.04 xcp bare metal recovery via rsnapshot"},"content":{"rendered":"<p>I&#8217;m verifying my backup process via a bare metal recovery to identical hardware so I thought I&#8217;d take some notes&#8230;<\/p>\n<p>I got started on my ubuntu xen xcp\/xapi setup with this excellent guide:<br \/> http:\/\/francispereira.com\/blog\/step-by-step-guide-to-setting-up-xen-and-xenapi-xcp-on-ubuntu-12-04-and-managing-it-with-xencenter\/<\/p>\n<p>Booted a usb based rescue disk to partition my disks the same as oringinal dom0, then rsync over the stuff from my dom0 rsnapshot, created \/dev \/proc and \/sys directories, mounted them with &#8211;bind and then chrooted on to the actual partition to rebuild grub<\/p>\n<pre>sudo grub-install \/dev\/sdb<\/pre>\n<pre>\nsudo grub-install --recheck \/dev\/sdb<\/pre>\n<pre>\nsudo update-grub<\/pre>\n<p>Then umounted things and rebooted, and volia&#8230; but networking wasn&#8217;t happy&#8230; after some banging around I discovered my old nemesis the udev persistent crap, who ever thought of this has some explaining to do, how could this have ever been worth it? Maybe I&#8217;m just not in the use case where it&#8217;s good for my network adapter to seemingly randomly stop working. None the less, a quick<\/p>\n<pre>rm of \/etc\/udev\/rules.d\/70-persistent-net.rules<\/pre>\n<p>and a reboot and things were back to the way they should be. (also updated my rsnapshot exclude list so I can forget about udev for a while).<\/p>\n<p><strong>UPDATE<\/strong>(9\/3\/12): just booted the box and realized that it was unhappy about UUIDs of the new filesystems (\/dev\/sda1 (root) and \/dev\/sda2 (swap) in my case so some grub editing was needed to boot, and then also updating of \/etc\/fstab and running update-grub.<\/p>\n<p>With xen xcp-xapi on ubuntu we&#8217;re pretty much off book so for this portion of the restore I&#8217;m planning to clean things out, create a new LVM, and then import from basic generic vxa images, and then restore domU data\/settings from rsnapshot.<\/p>\n<p>I cleaned out the xe setup with a number of commands including xe sr-forget, xe vm-destroy, xe pbd-unplug, xe pdb-destroy, xe vdi-destroy, and xe vbd-destroy, also the -list version of the above helps to identify what to destroy.<\/p>\n<p>I recreated the LVM (synopsis of steps from above guide).<\/p>\n<pre>fdisk, n, p, 3, , t, 8e, W. #(use the rest of the disk)<\/pre>\n<pre>\npvcreate \/dev\/sda3<\/pre>\n<pre>\nvgcreate VolumeGroup \/dev\/sda3<\/pre>\n<pre>\npvdisplay #(get size from here)<\/pre>\n<pre>\nlvcreate --size G -n LocalStorage VolumeGroup<\/pre>\n<pre>\nxe sr-create type=ext name-label=Local Storage device-config:device=\/dev\/mapper\/VolumeGroup-LocalStorage<\/pre>\n<p>Next I set the recently created sr as the default SR and imported a vxa. then used nmap to find it, as that&#8217;s faster way to find it than logging in to my wrt.<\/p>\n<pre>xe sr-list<\/pre>\n<pre>\nxe pool-list<\/pre>\n<pre>\nxe pool-param-set uuid= default-SR=<\/pre>\n<pre>\nxe vm-import filename=.vxa<\/pre>\n<pre>\nxe vm-start vm=<\/pre>\n<pre>\nnmap -PN -sS 10.0.0.0\/24 192.168.1.0\/24<\/pre>\n<p>I then rsync&#8217;ed the domU settings\/data back and rebooted. I use the -anv in order to see what it&#8217;s going to do before it mucks things up&#8230;<\/p>\n<pre>rsync -anv --delete --exclude-from= . host:\/|less<\/pre>\n<pre>rsync -a -delete --exclude-from= . host:\/<\/pre>\n<p><strong>update<\/strong>(9\/3\/12): also snapshots weren&#8217;t working as I needed to specify the default SR<\/p>\n<pre>xe sr-list<\/pre>\n<pre>\nxe pool-list<\/pre>\n<pre>\nxe pool-param-set suspend-image-SR=  uuid=<\/pre>\n<p>Things I learned:<\/p>\n<ul>\n<li>good to have the output of fdisk<\/li>\n<li>I still really hate the udev permanent ethernet crap<\/li>\n<li>bunch of xe commands<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m verifying my backup process via a bare metal recovery to identical hardware so I thought I&#8217;d take some notes&#8230; I got started on my ubuntu xen xcp\/xapi setup with this excellent guide: http:\/\/francispereira.com\/blog\/step-by-step-guide-to-setting-up-xen-and-xenapi-xcp-on-ubuntu-12-04-and-managing-it-with-xencenter\/ Booted a usb based rescue disk to partition my disks the same as oringinal dom0, then [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[114,119,139,154,155,158],"class_list":["post-26","post","type-post","status-publish","format-standard","hentry","category-rln","tag-recovery","tag-rsnapshot","tag-ubuntu","tag-xapi","tag-xcp","tag-xen"],"_links":{"self":[{"href":"https:\/\/randomlinuxnotes.d13.com\/index.php?rest_route=\/wp\/v2\/posts\/26","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomlinuxnotes.d13.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomlinuxnotes.d13.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomlinuxnotes.d13.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/randomlinuxnotes.d13.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=26"}],"version-history":[{"count":0,"href":"https:\/\/randomlinuxnotes.d13.com\/index.php?rest_route=\/wp\/v2\/posts\/26\/revisions"}],"wp:attachment":[{"href":"https:\/\/randomlinuxnotes.d13.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=26"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomlinuxnotes.d13.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=26"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomlinuxnotes.d13.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=26"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}