How to migrate zpool Solaris 10/11


Migrate Zpool


#zpool list
NAME             SIZE  ALLOC   FREE  CAP  HEALTH  ALTROOT
zbackserver      831G  800G     31G  96%  ONLINE  -

#zfs list
NAME                                  USED   AVAIL  REFER  MOUNTPOINT
rpool                    136G  20.6G   115G  15%  ONLINE  -
zbackserver                           800G   31G    31K  none
zbackserver/backupserver              800G   31G    800G  /backup

We have a new LUN assigned on the server, we will need to label it
#format -e c5t600601600551220046512D30807CE311d0s2
format>label
SMI   <-------------Select SMI
EFI
format>p
partition>p
Part      Tag    Flag     First Sector        Size        Last Sector
  0        usr    wm               256      999.99GB         2934223710
  1 unassigned    wm                 0          0              0
  2 unassigned    wm                 0          0              0
  3 unassigned    wm                 0          0              0
  4 unassigned    wm                 0          0              0
  5 unassigned    wm                 0          0              0
  6 unassigned    wm                 0          0              0
  8   reserved    wm          2934223711       8.00MB         2936022094

format>quit

Create the new zpool in order to know the name to migrate the information


#zpool create zbackupserver-new c5t600601600551220046512D30807CE311d0
#zfs list
NAME                                  USED   AVAIL  REFER  MOUNTPOINT
rpool                    136G  20.6G   115G  15%  ONLINE  -
zbackserver                           800G   31G    31K  none
zbackserver/backupserver              800G   31G    800G  /backup
zbackserver-new                        31k   999G   999G  /backupserver-new

You can set the mountpoint to none


#zfs set mountpoint=none zbackserver-new
NAME                                  USED   AVAIL  REFER  MOUNTPOINT
rpool                    136G  20.6G   115G  15%  ONLINE  -
zbackserver                           800G   31G    31K  none
zbackserver/backupserver              800G   31G    800G  /backup
zbackserver-new                        31k   999G   999G  /backupserver-new     <----------Changed

Finally you can generate the snapshot in recursive mode for the zfs or pool that you need to migrate

#zfs snapshot -r zbackserver@snap1
#zfs list
NAME                                  USED   AVAIL  REFER  MOUNTPOINT
rpool                    136G  20.6G   115G  15%  ONLINE  -
zbackserver@                          800G   31G    31K    none              
zbackserver/backupserver              800G   31G    800G  /backup 
zbackserver@snap1                     800G   31G    31K    none               <---New Snap
zbackserver/backupserver@snap1        800G   31G    800G  /backup             <---New Snap
zbackserver-new                        31k   999G   999G  /backupserver-new

We have all the information in the snapshot, now we can copy to the new zpool "backupserver-new"


#time zfs send -rp zbackserver@snap1 | zfs receive -F zbackserver/backupserver-new

The command executed above should generate the same structure from the zpool that we are migrating


#zfs list
NAME                                  USED   AVAIL  REFER  MOUNTPOINT
rpool                    136G  20.6G   115G  15%  ONLINE  -
zbackserver                          800G   31G    31K    none              
zbackserver/backupserver              800G   31G    800G  /backup 
zbackserver@snap1                     800G   31G    31K    none             
zbackserver/backupserver@snap1        800G   31G    800G  /backup           
zbackserver-new                        31k   999G   999G  /none
zbackserver-new/backupserver           31k   999G   999G  /backup  <----Migrated

Now you should umount and export the zfs that you can not use more and the new pool

#zfs umount /backup
#zpool export zbackserver  
#zpool export zbackserver-new

Import the new pool with the new name and import the other one with different name in order to destroy

#zpool import zbackserver-new zbackserver
#zpool import zbackserver zbackserver-old
#zpool destroy zbackserver-old

You should have the new zpool with the /backup mountpoint

#df -h /backup

Regards
Roger


Comments

Anonymous said…
Good post you help me to know the steps