
Sun May 21 17:04:28 PDT 2017
based on
https://hardforum.com/threads/howto-openindiana-growing-resizing-expanding-a-zfs-root-pool-in-esx-hard-drive.1680337/

1. Shut down omniosdev

2. Take a snapshot of your VM.

3. Edit the VM Hard Drive settings. INCREASE the size of the VM Disk. (20G)

4. Boot from GParted CDROM. Choose Option 2, Enter command line prompt.

5. At the prompt, fdisk /dev/sda (pick your correct disk)

6. Press p to print the current partition table.

7. Make a note of the Start and End of the Solaris partition in case you 
have to restore it with Gparted fdisk. Do not mix fdisk versions 
(OmniOS vs Debian vs Linux as they may show different layouts. Use 
the same one to restore as what you viewed it with)

8. My Start:16065 my End: 25157789

9. Delete the Solaris partition: press d (if you have only have 1 
partition, it will be deleted otherwise you will be prompted for the 
correct partition to delete)

10. Press p to ensure it has been deleted

11. Create a new partition: press n

12. Primary partition / Partition 1 (in my case)

13. First Sector: 16065 (The start of the previous Solaris partition)

14. Last Sector: Use the default value value to take all the free space)

15. Press p to print the layout. Notice the new END.

16. Press a and select the partition to make it bootable.

17. Press t and select the partition. Then type in bf as the Hex code

18. Press p to print the layout

19. So now we have a bigger Solaris partition that's bootable and starts 
    on the exact same sector as the previous partition.

20. Press w to write the table to disk.

21. Edit your VM or replace the CD and Reboot into the OmniOS CD.

22. go to the shell

23. execute "format"

24. Specify your VM's Boot disk, eg: mine was disk 0 (c2t0d0)

25. Press p and enter for partition.

26. Press p and enter again to print the partition

27. Notice the difference between Total Cylinders and the size of the root / 
    backup due to the now bigger drive.

28. The field showing the total disk Cylinders S=2607. (Mine was 2607, 
    yours will differ) Edit both the root and backup partition to resize them 
    to S-2 (root) and S-1 (backup) cylinders respectively. My New root = 2605 
    (S-2) and My New backup is 2606 (S-1)

29. Hit 0 for root partition:
    Just hit enter to accept the defaults on the following three questions: ID 
    tag: root / Permission flags: wm / Starting cyl:1 When prompted for the 
    Partition Size enter 2605e

30. Hit 2 for backup partition: Just hit enter to accept the defaults on 
    the following three questions: ID tag: root / Permission flags: wm / 
    Starting cyl:0 When prompted for the Partition Size enter 2606e

31. Press p to print layout.

Note the bigger sizes now for the partitions.

32. Press l to label (write) new layout to disk and answer y when prompted.

33. Remove CDrom and boot into OmnioOS

34. zpool scrub rpool

35. when scrub finishes, "zpool set autoexpand=on rpool"
    and reboot

36. zpool set autoexpand=off rpool

