{"id":3429,"date":"2014-08-02T10:08:48","date_gmt":"2014-08-02T10:08:48","guid":{"rendered":"http:\/\/really.zonky.org\/?p=3429"},"modified":"2014-08-02T10:08:48","modified_gmt":"2014-08-02T10:08:48","slug":"debian-testing-the-resilience-of-a-mirrored-installation","status":"publish","type":"post","link":"https:\/\/really.zonky.org\/?p=3429","title":{"rendered":"Debian: Testing The Resilience Of A Mirrored Installation"},"content":{"rendered":"<p>One of the questions I always ask myself when setting up a resilient server, is just how well will it cope with a disk failure? Ultimately you cannot answer that without trying it out.<\/p>\n<p>But as practice (and to determine whether it mostly works), it&#8217;s perfectly sensible to try it out on a virtual machine.<\/p>\n<h2>Debian Installation<\/h2>\n<p>If you are looking for full instructions on installing Debian, this is not the place to look. I configured the virtual machine with 2GBytes of memory, an LsiLogic SAS controller with two attached disks each of 64GBytes.<\/p>\n<p>The installation process was much as per normal (I unselected &#8220;Desktop&#8221; to save time), but the storage was somewhat different :-<\/p>\n<ul>\n<li>Manual partitioning method<\/li>\n<li>Create an empty partition on both disks<\/li>\n<li>Select Software RAID<\/li>\n<li>Create an MD device<\/li>\n<li>RAID1<\/li>\n<li>And put both disks into the RAID<\/li>\n<li>Configure LVM<\/li>\n<li>Create a Volume Group (&#8220;sys&#8221;)<\/li>\n<li>Select md0 for the volume group device<\/li>\n<li>Create logical volumes (boot: 512MB, root: 16GB, var: 8GB, home: 512M (it&#8217;s a server))<\/li>\n<li>In the partitioning manager select each Logical Volume in turn and specify the file system parameters.<\/li>\n<\/ul>\n<p>You will notice that no swap was created &#8211; this was a mistake that I&#8217;m in the unfortunate habit of making! However for a test, it wasn&#8217;t a problem and with LVM it is possible to create swap after the installation.<\/p>\n<h2>Post Installation<\/h2>\n<p>After the server has booted, it is possible to check the second hard disk for the presence of\u00a0<em>grub<\/em> in the MBR (<em>dd if=\/dev\/sdb of=\/var\/tmp\/sdb.boot bs=1M count=1<\/em>, and then run\u00a0<em>strings<\/em> on the result). It turns out that nothing is installed in the MBR of the second disk by default. Which would make booting in a degraded environment an interesting challenge (i.e. you&#8217;ll have to find a rescue CD and boot off the relevant hard disk).<\/p>\n<p>However this can be fixed by installing grub onto the second hard disk:\u00a0<em>grub-install \/dev\/sdb<\/em><\/p>\n<h2>Testing Resilience<\/h2>\n<p>But what happens when you lose a disk? Now is the time to test. Shut down the virtual machine and remove the\u00a0<em>second\u00a0<\/em>hard disk &#8211; leaving the first hard disk in place does not provide a full test.<\/p>\n<p>If your first attempt at booting afterwards results in a failure to acquire a grub menu, then either you have failed to run\u00a0<em>grub-install<\/em> as detailed above (guess what mistake I made?), or your BIOS settings don&#8217;t permit the computer to boot off anything other than the first hard disk.<\/p>\n<p>However, in my second attempt, the server booted normally with the addition of a few messages that indicate that there is just one disk making up the mirrored pair.<\/p>\n<h2>Summary<\/h2>\n<ol>\n<li>Yes, you\u00a0<em>can<\/em> put\u00a0<em>\/boot<\/em> onto an LVM file system that sits on mirrored disks. That hasn&#8217;t always been the case.<\/li>\n<li>It is still necessary to run\u00a0<em>grub-install<\/em> to put Grub onto the MBR of the second hard disk.<\/li>\n<li>It works.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>One of the questions I always ask myself when setting up a resilient server, is just how well will it cope with a disk failure? Ultimately you cannot answer that without trying it out. But as practice (and to determine whether it mostly works), it&#8217;s perfectly sensible to try it out on a virtual machine. <a href='https:\/\/really.zonky.org\/?p=3429' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_share_on_mastodon":"0"},"categories":[4,209,226],"tags":[1017,1231,43,485,1230],"class_list":["post-3429","post","type-post","status-publish","format-standard","hentry","category-it","category-linux-it","category-working-notes","tag-debian","tag-grub","tag-linux","tag-lvm","tag-raid1","category-4-id","category-209-id","category-226-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1f2KI-Tj","_links":{"self":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/3429","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3429"}],"version-history":[{"count":1,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/3429\/revisions"}],"predecessor-version":[{"id":3430,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/3429\/revisions\/3430"}],"wp:attachment":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3429"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3429"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3429"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}