Migrating your notebook from a smaller to a larger disk

My colleague Christophe Pauliat - Principal Sales Consultant at Oracle - came up with a really nifty way to migrate his Solaris based notebook from a smaller disk to a larger one. I will copy his mail in verbatim here, because i think it’s extremely useful. It somewhat resembles the “workaround” for ZFS resizing, however Christophe does takes this significantly forward and does this for boot disks.

OS: Solaris 11 express 2010.11 + SRU8 


1) Copy data + OS on the new HDD
    a) connection of the new 500 GB HDD as an external USB HDD (using a USB external HDD box)
    b) creation of a Solaris 2 partition with fdisk and make it active (bootable)
         # fdisk /dev/rdsk/c4t0d0p0
    c) with the format command, create a partition s0 with all cylinders except cylinder 0
    d) Mirroring the existing ZFS pool (rpool) to the new HDD
         # zpool attach -f rpool c1t0d0s0 c4t0d0s0
        - c1t0d0 is the 80 GB HDD (old HDD)
        - c4t0d0 is the 500 GB HDD (new HDD)
        - the option -f is necessary to bypass the warning "partition 0 overlaps partition 2"
    e) wait for the sync to be finished (with zpool status)
    f) Install Grub on the new HDD
        #  installgrub -m /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c4t0d0s0
    g) Split the pool rpool by detaching to new HDD to create a new pool
        # zpool split rpool rpool2 c4t0d0s0
        note: I chose not to detach the old HDD because I wanted it to be usable in case of problem

2) Shutdown OS and laptop, disconnect the USB external HDD and replace the internal 80 GB HDD by the new one

3) Rename the new pool rpool2 to rpool
     - Boot on a Solaris 11 Express LiveCD or the network using AI
    note: In my case, I used an AI server I had installed before (Solaris 11 express 2010.11 with no SRU)
    - zpool import rpool2 rpool        to rename the pool
    - zpool export rpool                    to export it so that there is no warning in step 4

4) Boot on the new HDD
    - It works just fine, but the pool size is still the size of the old HDD (80 GB)
      altough it uses a 500 GB partition (c4t0d0s0)

5) Increase the pool size to use the whole partition
     # zpool set autoexpand=on rpool 

The autoexpand really does an large amount of the trick. The size of a mirrored pool is always the size of the smallest disk. When you have an 80 GB and a 500 GB disk, the size of the pool is 80 GB. Remove the 80 GB disk. The smallest disk is now 500 GB and the size of the pool is 500 GB now as well, as long as you’ve activated autoexpand.