Moving a ZFS Filesystem Between Pools

solariszfs

I am extending a Solaris 10 U8 server with an extra storage pool in addition to the root rpool.

What is the most effective / simple / reliable way of moving particular ZFS filesystem(s) from rpool to this new storage pool?

Can it be done online or should I shut down services using these pools first?

Best Answer

The question about disabling services essentially depends on the services themselves:

  • Are they actively writing to the file system you plan to move ?
  • Are they storing persistent data you want to keep.

In any case, sending a ZFS file system might take a long time. It is possible to minimize service unavailability by keeping them online most of the time that way:

  • create a snapshot

  • send that snapshot the way previously suggested but while keeping all services active

  • when the fs is received on the other pool, disable the critical services bounds to that file system. Make sure the new file system on the destination pool is not modified as changes will be discarded later anyway.

  • create a second snapshot (e.g. snapshot2)

  • send that second snapshot incrementally, that will be much quicker that the previous transfer. e.g.:

    zfs send -i rpool/filesystem@snapshot rpool/filesystem@snapshot2 \
        | zfs receive -F destinationpool/filesystem
    
  • when done, move the filesystem mount point from the old dataset to the new one. e.g.:

    zfs set mountpoint=/application/directory.old rpool/filesystem
    zfs set mountpoint=/application/directory destination/filesystem
    

    You need to make sure no process is bound to /application/directory (e.g.: accessing files or having it as its current directory) to achieve that.

  • re-enable the service(s) and you are done.

Related Topic