Transferring root image of opensolaris to another disk
By vineeth on May 14, 2009
After so long, I got something really interesting that made me start my blogs again!
My Workstation runs opensolaris and this started as a pilot project to see whether opensolaris would serve me better than Solaris Express in my Work. So my initial installation of opensolaris had a small root partition of 20gb. It turned out that opensolaris was giving me whatever I wanted with a much better look and feel. My pilot project went live and I was permanently switching to opensolaris from SXCE. Now I got a problem, my root partition was running out of space .
My manager came to my help and gave me a second hard disk with a greater storage . Wow, Now I had space, but I didn't want to reinstall opensolaris on second disk. Yes, I wanted to transfer my root image to the second hard disk! My Unix common sense started working and I was lost in the world of format, fdisk, dd etc etc for some time. Wait a minute, did I hear ZFS??? Yes opensolaris has zfs boot, why should I worry? Its time to scrap years of obsolete concepts! .
So what I did was quick and neat!
1)Created a 50gb partition in the second disk(c9d0s0)
2)#zfs attach rpool c8d0S0 c9d0S0
Zfs started its resilvering process soon and I had my mirror ready in 15 minutes. Now installing grub on second hard disk
3)#installgrub -m /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c9d0s0
I didn't wan't to take chance, so I rebooted with the mirror configuration for rpool. I changed Hard disk order in BIOS and happily booted into opensolaris. I didn't want my mirror configuration any more and I had plans with that extra space in first hard disk. So I did:
4)#zpool detach rpool c8d0S0
There it is, I have my Opensolaris root image transfered to the second hard disk and happily running!
This was pretty interesting for me to see all the stuff going on so smoothly which would have been a bit complicated, if it was not for zfs. Now I have my root image transferred to a bigger partition and I have a lot more space in root partition now!
ZFS, you rock!!!