26

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?

1

4 Answers 4

23

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.

1
  • 2
    Adding to what @dan-buhler & @ewwhite have written - You can also use zfs send -Rvn sourcepool@snapshotname to get the total estimated size. Then using that value, pass it to pv with, zfs send -R sourcepool@snapshotname | pv -s [total-estimated-size] | zfs receive -F destpool to get a better idea of when the send will actually finish. Feb 22, 2021 at 0:04
22

I'm repeating much of what jlliagre said, but with additions for descendent file systems. (Mostly so I have a reference when I forget.)

If you have sub-filesystems you'll want to use the -r flag on the zfs snapshot command, and the -r or -R flag on the zfs send command. The uppercase -R moves all properties, snapshots and clones.

To move an entire pool:

zfs snapshot -r sourcepool@moving
zfs send -R sourcepool@moving | zfs receive -F destpool

then to sync the changes for a shorter migration period shut down applications, shutdown samba, nfs

zfs snapshot -r sourcepool@moving2
zfs send -Ri sourcepool@moving sourcepool@moving2 | zfs receive -F destpool

If you are creating multiple intermediary snapshots for the migration, read the man page about the zfs send -I switch.

1
  • 3
    In my experiments, the exact command seemed to be: zfs send -R Pool0@moving | zfs receive -dF Pool1
    – TinkerTank
    May 12, 2012 at 20:12
12

I don't think this can be performed online, but my process would be to shut the necessary services down, take a snapshot and use zfs send/receive to make the migration. Something like:

zfs send rpool/filesystem@snapshot | zfs receive destinationpool/filesystem

Edit:

If you install the "pipe view" command (pv), you can monitor status of the transfer with:

zfs send rpool/filesystem@snapshot | pv | zfs receive destinationpool/filesystem
1
  • I didn't know about pv, thanks for sharing!
    – user9320
    Oct 25, 2020 at 0:32
8

You'll also find some benefit in using a tool like "mbuffer" in the pipeline; apparently ZFS send/recv performance improves dramatically if both ends can mostly stream data continuously, and without mbuffer (or something similar) you get a ping-pong effect where one continually blocks on the other.

2
  • Please note that this is a very old question (over 5 years) and your answer is unlikely to add anything to a question that old. Nov 24, 2015 at 17:10
  • 6
    This is great advice and I use it for pool moves as well.
    – Dan Buhler
    Apr 13, 2017 at 15:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .