Howto: Openindiana Growing / Resizing / Expanding a ZFS Root Pool in ESX / Hard Drive

ozra

n00b
Joined
Mar 11, 2012
Messages
18
If your Boot Disk on Openindiana is running out of space (napp it will send alerts etc) You can resize it in the following way:

Hope this makes sense as I cannot upload all my screenshots. IM me if you want a PDF.

I had a problem with my Openindiana Boot disk. I allocated 12G when I built it but napp-it generate alerts due to only 8% space free on it once OpenIndiana Text was installed.
This blocked my immediate disk failure emails (testing) due to their being a constant alert flagged by Napp-it on the 24hr cycle.

Being a noob, I had to dumb down the info I found so that I can use it.
Most info here: http://www.distrans.org/wiki/unixsystems/opensolaris/growing_root_pool

I am not responsible for any data loss you may incur due to this guide. It works for me.


Download Openindiana GUI/Workstation version Live CD and copy it to your vmfs store. Do the same for a Gparted Live CD.
You will be booting off these CD’s as you cannot edit your partitions if you boot off the VM as the partitions you want to change are in use!



1. Shut down your Openindiana VM or Machine.

2. Take a snapshot of your VM.
For Expanding to a bigger physical HD, Use Clonezilla to Image. Do not expand the partitions in Clonezilla. Remove old HD. Boot of new bigger HD and check to make sure everything is OK.
If you are EXPANDING the size on the current HD, definitely make an Image backup first.

3. Edit the VM Hard Drive settings. INCREASE the size of the VM Disk. For EXPANDING a physical disk, clear space (GPARTED Live CD – fdisk) directly AFTER the Solaris partition.

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 (Openindiana 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 OpenIndiana GUI Live CD.

22. Open a terminal session in the Live CD and then issue an su

23. Default root password on Openindiana Live CD is ‘openindiana’

24. In the terminal after doing su, execute ‘format’

25. Specify your VM’s Boot disk, eg: mine was disk 8 as my Storage drives are still attached, c4t0d0

26. Press p and enter for partition.

27. Press p and enter again to print the partition




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 OpenIndiana.

34. If OpenIndiana does not boot anymore, use the rescue technique at the end of this info to repair.

35. After booting, Log into a terminal session or Console of Openindiana as root or su.

36. Do zpool get all rpool1 (mine is called rpool1)

Notice the difference between the rpool size new disk size

37. Do a ZFS scrub before expanding the pool to make sure it is sane: zpool scrub rpool1

38. Check zpool status rpool1 to make sure it completes ok.

39. Turn on autoexpand via napp-it or: zpool set autoexpand=on rpool1

40. zpool get all rpool1



Now my rpool1 size is 19.9G (from 12G) No more warnings from Napp-it!
The log files auto_mail_alert1.log and auto_mail_alert2.log have been deleted by napp-it. It warned I only had 8% space left on rpool1
So now I will get immediate alerts again.


41. reboot Openindiana






Non Booting Openindiana Rescue Technique:


Rescue recipes
OpenSolaris does not boot anymore
Source:http://www.codestrom.com/wandering/2008/10/rescue-boot-sol.html
Common causes can be:
1. corrupted boot archive
2. ZFS version unsupported by the bootloader
Boot into console mode from a livecd (genunix.org) and gain root privileges:
# pfexec su -
Get the list of zpool which can be imported:
# zpool import
Then import the appropriate pool and mount it:
# zpool import -R /mnt -f rpool
# mkdir /rootfs ; mount -F zfs rpool/ROOT/opensolaris /rootfs

1. Corrupted boot archive:
# rm /rootfs/platform/i86pc/boot_archive
# rm /rootfs/platform/i86pc/amd64/boot_archive
# bootadm update-archive -R /rootfs

2. GRUB update required:
# /rootfs/boot/solaris/bin/update_grub -R /rootfs
You are done:
# umount /rootfs
# init 6
 
Wow! Great consolidation of information. Thanks for contributing to the solaris community. I have copied this text into a file, if I need it in the future. :)
 
Thank you so much. I've been trying to figure out how to do this exact operation for 4 months. Getting tired of weekly emails saying 8% space left on the zpool root drive. Thought 12gb would be enough on an SSD to run it but obviously I'm going to up it to about 25gb instead. Otherwise my 48tb zfs has been perfect for me.
 
This is a nice detailed how-to guide. I've never tried it but couldn't you have created a second VMDK file of the new size, added it as a mirror to the rpool, then removed the original. If I'm not mistaken ZFS would then use the larger size. You still may need to play with the boot magic a little though.
 
Thank you for this nice walkthrough :)

Step 42 is missing though: Delete the VM Snapshot (or: in case everything fails: revert to snapshot ;) )
 
Back
Top