{"id":34,"date":"2015-07-09T12:33:00","date_gmt":"2015-07-09T11:33:00","guid":{"rendered":"https:\/\/techblog.dansbo.dk\/?p=34"},"modified":"2024-01-03T12:39:47","modified_gmt":"2024-01-03T11:39:47","slug":"expand-a-zpool-with-a-single-supporting-device-on-linux","status":"publish","type":"post","link":"https:\/\/techblog.dansbo.dk\/?p=34","title":{"rendered":"Expand a zpool with a single supporting device on linux"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Initial Status:<\/h2>\n\n\n\n<p>Because I have had trouble with the way ZFS on Linux (ZOL) handles failing drives, I have decided to create a software<br>RAID set of my drives before creating my zpool.<\/p>\n\n\n\n<p>This means that my zpool is created with a single device (\/dev\/md0). If I remember correctly, it was created like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>zpool create pool0 md0<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">EXPANSION:<\/h2>\n\n\n\n<p>By default pool\u2019s are not set to autoexpand so it is needed to set the autoexpand to on:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>zpool set autoexpand=on pool0<\/code><\/pre>\n\n\n\n<p>Before I could get the pool expanded I needed to grow my RAID set. It is done by first adding a device to the existing<br>RAID set and then \u201cgrowing\u201d it with the new amount of devices.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mdadm \/dev\/md0 --add \/dev\/sdd\nmdadm --grow \/dev\/md0 --raid-devices=4<\/code><\/pre>\n\n\n\n<p>After the RAID set have reshaped, the extra space is available for use. According to all information I could find, it should be possible to expand the pool by either exporting and importing it<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>zpool export pool0\nzpool import pool0<\/code><\/pre>\n\n\n\n<p>or by expanding the online pool<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>zpool online -e pool0 md0<\/code><\/pre>\n\n\n\n<p>I tried both several times and in different order, but to no avail. My pool was fixed at its original size.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">REBOOT:<\/h2>\n\n\n\n<p>Finally I decided to do a reboot to see if that would change anything. Remember to save the new mdadm configuration before rebooting.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Remove existing array configuration from mdadm.conf file\ngrep -v ARRAY \/etc\/mdadm\/mdadm.conf > \/tmp\/mdadm.conf\n# Add new array configuration to mdadm.conf\ncat \/tmp\/mdadm.conf > \/etc\/mdadm\/mdadm.conf\nmdadm --examine --scan >> \/etc\/mdadm\/mdadm.conf<\/code><\/pre>\n\n\n\n<p>After the reboot, the pool was still the original size, but now it actually worked to do an online expansion.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>zpool online -e pool0 md0<\/code><\/pre>\n\n\n\n<p>And that solved the problem. Unfortunately I do not know why I could not perform the online expansion without a reboot.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Initial Status: Because I have had trouble with the way ZFS on Linux (ZOL) handles failing drives, I have decided to create a softwareRAID set of my drives before creating&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-34","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/techblog.dansbo.dk\/index.php?rest_route=\/wp\/v2\/posts\/34","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techblog.dansbo.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techblog.dansbo.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techblog.dansbo.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techblog.dansbo.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=34"}],"version-history":[{"count":1,"href":"https:\/\/techblog.dansbo.dk\/index.php?rest_route=\/wp\/v2\/posts\/34\/revisions"}],"predecessor-version":[{"id":35,"href":"https:\/\/techblog.dansbo.dk\/index.php?rest_route=\/wp\/v2\/posts\/34\/revisions\/35"}],"wp:attachment":[{"href":"https:\/\/techblog.dansbo.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=34"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techblog.dansbo.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=34"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techblog.dansbo.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=34"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}