{"id":144,"date":"2012-12-07T01:35:14","date_gmt":"2012-12-07T09:35:14","guid":{"rendered":"http:\/\/blog.ls-al.com\/?p=144"},"modified":"2013-08-30T13:45:25","modified_gmt":"2013-08-30T20:45:25","slug":"zfs-grow-rpool-disk","status":"publish","type":"post","link":"https:\/\/blog.ls-al.com\/zfs-grow-rpool-disk\/","title":{"rendered":"ZFS Grow rpool disk"},"content":{"rendered":"

Growing disks for virtual machines have become pretty trivial with tools like livecd's and gparted.\u00a0 Recently I had to grow my Solaris 11 disk from 16GB to 20GB. \u00a0And of course on Solaris it's a ZFS volume.<\/p>\n

I don't think gparted can re-size the Solaris2 partitions used by Solaris 11 so I did the re-size on a running system using format. \u00a0There might be a better way and I advise you NOT to do this on a critical system. \u00a0Nonetheless it worked for me on a Virtualbox as well as a KVM virtual machine.<\/p>\n

Re-sizing the disk on the host side is out of scope and you can use a myriad of ways to accomplish that for instance lvextend when using LVM.\u00a0 In this case I documented the re-sizing as was performed with Virtualbox.<\/p>\n

Also note this only worked on Solaris x86. \u00a0On Sparc there is no expand option for the partition in the format tool. \u00a0There is a way to resize a system disk but it is pretty painful. \u00a0Search my blog for Growing Solaris LDOM rpool.<\/p>\n

Re-size Disk:<\/strong><\/p>\n

$ vboxmanage showhdinfo Solaris11.vdi\r\n\r\nLogical size:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 16384 MBytes\r\n Current size on disk: 9818 MBytes\r\n\r\n$ vboxmanage modifyhd Solaris11.vdi --resize 20000\r\n 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%\r\n\r\n$ vboxmanage showhdinfo Solaris11.vdi\r\n Logical size:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 20000 MBytes\r\n Current size on disk: 9819 MBytes\r\n\r\n<\/pre>\n

Information before disk resize:<\/strong><\/p>\n

root@solaris:~# uname -a\r\n SunOS solaris 5.11 11.1 i86pc i386 i86pc\r\n\r\nroot@solaris:~# zpool status rpool\r\n pool: rpool\r\n NAME\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 STATE\u00a0\u00a0\u00a0\u00a0 READ WRITE CKSUM\r\n rpool\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ONLINE\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0 0\r\nc3t0d0s0\u00a0 ONLINE\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0 0\r\n\r\nroot@solaris:~# df -h | grep rpool\r\n rpool\/ROOT\/solaris-2\u00a0\u00a0\u00a0 16G\u00a0\u00a0 3.8G\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 7.0G\u00a0\u00a0\u00a0 36%\u00a0\u00a0\u00a0 \/\r\n\r\nroot@solaris:~# format\r\n AVAILABLE DISK SELECTIONS:\r\n 0. c3t0d0 <ATA-VBOX HARDDISK-1.0 cyl 2085 alt 2 hd 255 sec 63>\r\n \/pci@0,0\/pci8086,2829@d\/disk@0,0\r\n Specify disk (enter its number): 0\r\n selecting c3t0d0\r\n [disk formatted]\r\n \/dev\/dsk\/c3t0d0s0 is part of active ZFS pool rpool. Please see zpool(1M).\r\n\r\n...\r\npartition> pr\r\n Current partition table (original):\r\n Total disk cylinders available: 2085 + 2 (reserved cylinders)\r\n\r\nPart\u00a0\u00a0\u00a0\u00a0\u00a0 Tag\u00a0\u00a0\u00a0 Flag\u00a0\u00a0\u00a0\u00a0 Cylinders\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Size\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Blocks\r\n 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 root\u00a0\u00a0\u00a0 wm\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1 - 2084\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 15.96GB\u00a0\u00a0\u00a0 (2084\/0\/0) 33479460\r\n 1 unassigned\u00a0\u00a0\u00a0 wm\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (0\/0\/0)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\r\n 2\u00a0\u00a0\u00a0\u00a0 backup\u00a0\u00a0\u00a0 wu\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0 - 2086\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 15.99GB\u00a0\u00a0\u00a0 (2087\/0\/0) 33527655\r\n 8\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 boot\u00a0\u00a0\u00a0 wu\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0 -\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 7.84MB\u00a0\u00a0\u00a0 (1\/0\/0)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 16065\r\n\r\n...\r\n\r\nTotal disk size is 2088 cylinders\r\n Cylinder size is 16065 (512 byte) blocks\r\n\r\nCylinders\r\n Partition\u00a0\u00a0 Status\u00a0\u00a0\u00a0 Type\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Start\u00a0\u00a0 End\u00a0\u00a0 Length\u00a0\u00a0\u00a0 %\r\n =========\u00a0\u00a0 ======\u00a0\u00a0\u00a0 ============\u00a0 =====\u00a0\u00a0 ===\u00a0\u00a0 ======\u00a0\u00a0 ===\r\n 1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0     Active\u00a0\u00a0\u00a0 Solaris2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\u00a0 2087\u00a0\u00a0\u00a0 2087\u00a0\u00a0\u00a0 100<\/pre>\n

Physical disk information after resize at host level:<\/strong><\/p>\n

\r\n...\r\nTotal disk size is 2549 cylinders\r\n Cylinder size is 16065 (512 byte) blocks\r\n\r\nCylinders\r\n Partition\u00a0\u00a0 Status\u00a0\u00a0\u00a0 Type\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Start\u00a0\u00a0 End\u00a0\u00a0 Length\u00a0\u00a0\u00a0 %\r\n =========\u00a0\u00a0 ======\u00a0\u00a0\u00a0 ============\u00a0 =====\u00a0\u00a0 ===\u00a0\u00a0 ======\u00a0\u00a0 ===\r\n 1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Active\u00a0\u00a0\u00a0 Solaris2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\u00a0 2087\u00a0\u00a0\u00a0 2087\u00a0\u00a0\u00a0\u00a0 82<\/pre>\n

Tell the OS about the new size using expand:<\/strong><\/p>\n

\r\n...\r\npartition> expand\r\n Expansion of label cannot be undone; continue (y\/n) ? y\r\n The expanded capacity was added to the disk label.\r\n Disk label was written to disk.\r\n\r\n partition> pr\r\n Current partition table (original):\r\n Total disk cylinders available: 2546 + 2 (reserved cylinders)\r\n\r\nPart\u00a0\u00a0\u00a0\u00a0\u00a0 Tag\u00a0\u00a0\u00a0 Flag\u00a0\u00a0\u00a0\u00a0 Cylinders\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Size\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Blocks\r\n 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 root\u00a0\u00a0\u00a0 wm\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1 - 2084\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 15.96GB\u00a0\u00a0\u00a0 (2084\/0\/0) 33479460\r\n 2\u00a0\u00a0\u00a0\u00a0 backup\u00a0\u00a0\u00a0 wu\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0 - 2086\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 15.99GB\u00a0\u00a0\u00a0 (2087\/0\/0) 33527655\r\n 8\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 boot\u00a0\u00a0\u00a0 wu\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0 -\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 7.84MB\u00a0\u00a0\u00a0 (1\/0\/0)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 16065<\/pre>\n

Make the changes to the physical partition.\u00a0 I removed the \"backup\" slice as well since I don't need it.\u00a0<\/strong><\/p>\n

\r\n...\r\npartition> pr\r\n Current partition table (unnamed):\r\n Total disk cylinders available: 2546 + 2 (reserved cylinders)\r\n\r\nPart\u00a0\u00a0\u00a0\u00a0\u00a0 Tag\u00a0\u00a0\u00a0 Flag\u00a0\u00a0\u00a0\u00a0 Cylinders\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Size\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Blocks\r\n 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 root\u00a0\u00a0\u00a0 wm\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1 - 2545\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 19.50GB\u00a0\u00a0\u00a0 (2545\/0\/0) 40885425\r\n 8\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 boot\u00a0\u00a0\u00a0 wu\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0 -\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 7.84MB\u00a0\u00a0\u00a0 (1\/0\/0)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 16065\r\n\r\npartition> label\r\n Ready to label disk, continue? y\r\n<\/pre>\n

Finally scrub and grow ZFS:<\/strong><\/p>\n

root@solaris:~# zpool scrub rpool\r\n\r\nroot@solaris:~# zpool status rpool\r\n pool: rpool\r\n state: ONLINE\r\n scan: scrub in progress since Fri Dec\u00a0 7 14:21:25 2012\r\n 11.8M scanned out of 8.57G at 670K\/s, 3h43m to go\r\n 0 repaired, 0.13% done\r\n config:\r\n\r\nNAME\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 STATE\u00a0\u00a0\u00a0\u00a0 READ WRITE CKSUM\r\n rpool\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ONLINE\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0 0\r\n c3t0d0s0\u00a0   ONLINE\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0 0\r\n\r\nroot@solaris:~# zpool set autoexpand=on rpool\r\n\r\nroot@solaris:~# zpool get all rpool | grep size\r\n rpool\u00a0 size\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 19.4G\r\n\r\n root@solaris:~# df -h | grep ROOT\r\n rpool\/ROOT\/solaris-2\u00a0\u00a0       19G\u00a0 3.8G\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 10G\u00a0\u00a0\u00a0 27%\u00a0\u00a0\u00a0 \/\r\n rpool\/ROOT\/solaris-2\/var\u00a0\u00a0\u00a0 19G\u00a0\u00a0 955M\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 10G\u00a0\u00a0\u00a0\u00a0 9%\u00a0\u00a0\u00a0 \/var\r\n\r\nroot@solaris:~# zpool set autoexpand=off rpool<\/pre>\n","protected":false},"excerpt":{"rendered":"

Growing disks for virtual machines have become pretty trivial with tools like livecd’s and gparted.\u00a0 Recently I had to grow<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-144","post","type-post","status-publish","format-standard","hentry","category-solaris"],"_links":{"self":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/144","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=144"}],"version-history":[{"count":0,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/144\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/media?parent=144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/categories?post=144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/tags?post=144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}