{"id":35,"date":"2012-03-04T16:57:26","date_gmt":"2012-03-04T15:57:26","guid":{"rendered":"http:\/\/esxi-v34\/wordpress\/?p=35"},"modified":"2013-01-26T19:44:48","modified_gmt":"2013-01-26T18:44:48","slug":"setting-up-a-mirror-through-geom-on-a-gpt-labeled-disk","status":"publish","type":"post","link":"\/wordpress\/freebsd\/setting-up-a-mirror-through-geom-on-a-gpt-labeled-disk\/","title":{"rendered":"Setting up a mirror through geom on a GPT labeled disk"},"content":{"rendered":"<p>Synchronise the disklayout<\/p>\n<pre><code>gpart backup ada0 &gt; \/tmp\/ada0.gpt\r\ngpart restore -F \/dev\/ada1 &lt; \/tmp\/ada0.gpt<\/code><\/pre>\n<p>Check that everything went as expected.<\/p>\n<pre><code>gpart show<\/code><\/pre>\n<p>Add the geom kernel module as loaded on startup<\/p>\n<pre><code>echo 'geom_mirror_load=\"YES\"' &gt;&gt; \/boot\/loader.conf<\/code><\/pre>\n<p>Add bootcode to the second disk<\/p>\n<pre><code>gpart bootcode -b \/boot\/pmbr -p \/boot\/gptboot -i 1 \/dev\/ada1<\/code><\/pre>\n<p>Reboot into single-user mode. Then load the geom kernel module<\/p>\n<pre><code>gmirror load<\/code><\/pre>\n<p>Set up the mirror<\/p>\n<pre><code>gmirror label -vb round-robin p1 \/dev\/ada0p1\r\ngmirror label -vb round-robin p2 \/dev\/ada0p2\r\ngmirror label -vb round-robin p3 \/dev\/ada0p3<\/code><\/pre>\n<p>Add the mirrored disk<\/p>\n<pre><code>gmirror insert p1 \/dev\/ada1p1\r\ngmirror insert p2 \/dev\/ada1p2\r\ngmirror insert p3 \/dev\/ada1p3<\/code><\/pre>\n<p>Wait for the disks to synchronise<\/p>\n<pre><code>gmirror status<\/code><\/pre>\n<p>Modify the fstab on the new device<\/p>\n<pre><code>mount \/dev\/mirror\/p2 \/mnt\r\ncp \/mnt\/etc\/fstab \/mnt\/etc\/fstab.old\r\nee \/mnt\/etc\/fstab<\/code><\/pre>\n<p>Reboot into multi-user mode<\/p>\n<p>To backout from this, using the second disk as main disk do the following with the assumption that first disk is disconnected, thus there&#8217;s only one physical disk left now named ada0:<\/p>\n<p>Boot into single-user mode. Then load the geom kernel module<\/p>\n<pre><code>gmirror load<\/code><\/pre>\n<p>Deactivate the now degraded mirror<\/p>\n<pre><code>gmirror deactivate p1 \/dev\/ada0p1\r\ngmirror deactivate p2 \/dev\/ada0p2\r\ngmirror deactivate p3 \/dev\/ada0p3<\/code><\/pre>\n<p>Clear metadata from the disks<\/p>\n<pre><code>gmirror clear \/dev\/ada0p1\r\ngmirror clear \/dev\/ada0p2\r\ngmirror clear \/dev\/ada0p3<\/code><\/pre>\n<p>fsck the the disk in order to be able to mount it<\/p>\n<pre><code>fsck \/dev\/ada0<\/code><\/pre>\n<p>Edit the fstab. ee can be run without having to mount \/usr<\/p>\n<pre><code>mount \/dev\/ada0p2 \/mnt\r\ncp \/mnt\/etc\/fstab \/mnt\/etc\/fstab.mirrored\r\nee \/mnt\/etc\/fstab<\/code><\/pre>\n<p>Reboot into multi-user mode<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Synchronise the disklayout gpart backup ada0 &gt; \/tmp\/ada0.gpt gpart restore -F \/dev\/ada1 &lt; \/tmp\/ada0.gpt Check that everything went as expected. gpart show Add the geom kernel module as loaded on startup echo &#8216;geom_mirror_load=&#8221;YES&#8221;&#8216; &gt;&gt; \/boot\/loader.conf Add bootcode to the second disk gpart bootcode -b \/boot\/pmbr -p \/boot\/gptboot -i 1 \/dev\/ada1 Reboot into single-user mode. Then <span class=\"ellipsis\">&hellip;<\/span> <span class=\"more-link-wrap\"><a href=\"\/wordpress\/freebsd\/setting-up-a-mirror-through-geom-on-a-gpt-labeled-disk\/\" class=\"more-link\"><span>Read More &rarr;<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[31,19,7,8],"_links":{"self":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts\/35"}],"collection":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/comments?post=35"}],"version-history":[{"count":3,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts\/35\/revisions"}],"predecessor-version":[{"id":102,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts\/35\/revisions\/102"}],"wp:attachment":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/media?parent=35"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/categories?post=35"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/tags?post=35"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}