{"id":304,"date":"2013-05-14T16:57:17","date_gmt":"2013-05-14T23:57:17","guid":{"rendered":"http:\/\/blog.ls-al.com\/?p=304"},"modified":"2013-05-14T17:05:05","modified_gmt":"2013-05-15T00:05:05","slug":"zfs-on-linux-resize-rpool","status":"publish","type":"post","link":"https:\/\/blog.ls-al.com\/zfs-on-linux-resize-rpool\/","title":{"rendered":"ZFS on Linux resize rpool"},"content":{"rendered":"

In a previous article I setup Ubuntu 13.04 to run off a ZFS root pool.\u00a0 During my setup I used 4G out of an 8G disk for rpool only and mentioned we can just resize later.\u00a0\u00a0 Turns out ZFS on linux have a bug and to get autoextend to work you need to do an extra step.<\/p>\n

Note: Since I could not find a tool (including parted) to resize a ZFS physical partition; and my parition layout on the main disk was simple enough; I just ended up booting a livecd and deleting sda2 and creating it bigger.<\/p>\n

Partitions before I started:<\/strong><\/p>\n

# fdisk -l\r\n...\r\nDevice Boot\u00a0\u00a0\u00a0\u00a0\u00a0 Start\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 End\u00a0\u00a0\u00a0\u00a0\u00a0 Blocks\u00a0\u00a0 Id\u00a0 System\r\n\/dev\/sda1\u00a0\u00a0 *\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 63\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 96389\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 48163+\u00a0 be\u00a0 Solaris boot\r\n\/dev\/sda2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 96390\u00a0\u00a0\u00a0\u00a0 7903979\u00a0\u00a0\u00a0\u00a0 3903795<\/span>\u00a0\u00a0 bf\u00a0 Solaris<\/pre>\n

Partitions after I deleted and recreated sda2:<\/strong><\/p>\n

# fdisk -l\r\nDisk \/dev\/sda: 8589 MB, 8589934592 bytes\r\n...\r\nDevice Boot\u00a0\u00a0\u00a0\u00a0\u00a0 Start\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 End\u00a0\u00a0\u00a0\u00a0\u00a0 Blocks\u00a0\u00a0 Id\u00a0 System\r\n\/dev\/sda1\u00a0\u00a0 *\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 63\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 96389\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 48163+\u00a0 be\u00a0 Solaris boot\r\n\/dev\/sda2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 96390\u00a0\u00a0\u00a0 16777215\u00a0\u00a0\u00a0\u00a0 8340413<\/span>\u00a0\u00a0 bf\u00a0 Solaris<\/pre>\n

First boot after partition change:<\/strong><\/p>\n

# df -h\r\nFilesystem\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Size\u00a0 Used Avail Use% Mounted on\r\nrootfs\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3.7G\u00a0 3.1G\u00a0 580M\u00a0 85% \/\r\n\r\n# zpool list\r\nNAME\u00a0\u00a0\u00a0 SIZE\u00a0 ALLOC\u00a0\u00a0 FREE\u00a0\u00a0\u00a0 CAP\u00a0 DEDUP\u00a0 HEALTH\u00a0 ALTROOT\r\nrpool\u00a0 3.69G\u00a0 3.06G\u00a0\u00a0 638M\u00a0\u00a0\u00a0 83%\u00a0 1.00x\u00a0 ONLINE\u00a0 -\r\n\r\n# zfs list\r\nNAME\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 USED\u00a0 AVAIL\u00a0 REFER\u00a0 MOUNTPOINT\r\nrpool\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3.06G\u00a0\u00a0 580M\u00a0\u00a0\u00a0 31K\u00a0 \/rpool\r\nrpool\/ROOT\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3.06G\u00a0\u00a0 580M\u00a0\u00a0\u00a0 31K\u00a0 \/rpool\/ROOT\r\nrpool\/ROOT\/ubuntu-1\u00a0 3.06G\u00a0\u00a0 580M\u00a0 3.06G\u00a0 \/<\/pre>\n

Try a normal autoexpand:<\/strong><\/p>\n

# zpool get autoexpand rpool\r\nNAME\u00a0\u00a0 PROPERTY\u00a0\u00a0\u00a0 VALUE\u00a0\u00a0 SOURCE\r\nrpool\u00a0 autoexpand\u00a0 off\u00a0\u00a0\u00a0\u00a0 default\r\n\r\n# zpool set autoexpand=on rpool\r\n\r\n# zpool get autoexpand rpool\r\nNAME\u00a0\u00a0 PROPERTY\u00a0\u00a0\u00a0 VALUE\u00a0\u00a0 SOURCE\r\nrpool\u00a0 autoexpand\u00a0 on\u00a0\u00a0\u00a0\u00a0\u00a0 local<\/pre>\n

Then I tried a reboot to see if zfs will pickup the autoexpand change.\u00a0 That did not work and rebooting is most likely not necessary at all.<\/p>\n

I found a bug on ZFS on linux list:
\nhttp:\/\/rainemu.swishparty.co.uk\/cgi-bin\/gitweb.cgi?p=zfs;a=commitdiff;h=3b2e400c94eb488cff53cf701554c26d5ebe52e4<\/p>\n

Then tried onlining the rpool and it worked.<\/strong><\/p>\n

# zpool online -e rpool \/dev\/disk\/by-id\/scsi-SATA_VBOX_HARDDISK_VBb59e0ffb-68fb0252-part2\r\n\r\n# zpool list\r\nNAME\u00a0\u00a0\u00a0 SIZE\u00a0 ALLOC\u00a0\u00a0 FREE\u00a0\u00a0\u00a0 CAP\u00a0 DEDUP\u00a0 HEALTH\u00a0 ALTROOT\r\nrpool\u00a0 7.94G\u00a0 3.07G\u00a0 4.87G\u00a0\u00a0\u00a0 38%\u00a0 1.00x\u00a0 ONLINE\u00a0 -\r\n\r\n# df -h | grep rpool\r\nrpool\/ROOT\/ubuntu-1\u00a0 7.9G\u00a0 3.1G\u00a0 4.8G\u00a0 40% \/\r\nrpool\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 4.8G\u00a0\u00a0\u00a0\u00a0 0\u00a0 4.8G\u00a0\u00a0 0% \/rpool\r\nrpool\/ROOT\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 4.8G\u00a0\u00a0\u00a0\u00a0 0\u00a0 4.8G\u00a0\u00a0 0% \/rpool\/ROOT\r\n\r\n# df -h | grep rootfs\r\nrootfs\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 7.9G\u00a0 3.1G\u00a0 4.8G\u00a0 40% \/<\/pre>\n","protected":false},"excerpt":{"rendered":"

In a previous article I setup Ubuntu 13.04 to run off a ZFS root pool.\u00a0 During my setup I used<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"class_list":["post-304","post","type-post","status-publish","format-standard","hentry","category-zfs"],"_links":{"self":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/304","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/comments?post=304"}],"version-history":[{"count":0,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/304\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/media?parent=304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/categories?post=304"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/tags?post=304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}