News, tips, partners, and perspectives for the Oracle Solaris operating system

  • January 30, 2018

reflink(3c) What is it? Why do I care? And how can I use it?

Chris Beal
Senior Principal Software Engineer

Oracle Solaris 11.4 Beta is now available. One of the most requested features may seem like a tiny thing, but could have a huge impact on your VM deployments, or if you happen to deal with very large files regularly (eg video files).

Copying files is usually a case of telling the file system to read the blocks from disk, then telling them to write those same blocks to a different bit of the disk. reflink(3) allows you to tell the file system to simply create a new mapping to those blocks from a file system object (ie a file). ZFS will then keep track of any changes you make to the new file and write a copy of the modified blocks as part of the new file only. This is essentially like ZFS file system snapshot and clone, but on a file level.

Think of a common VM deployment scenario. Quite often you’ll be taking a standard VM image, and create multiple VMs from the same image. You can do this in Oracle Solaris 11.3 by putting each VM in its own ZFS file system or ZVOL, and using ZFS snapshot and ZFS clone to create new ones. In Oracle Solaris 11.4 Beta you can achieve the same thing using reflink(3c).

The overall effect of this is not only space savings, you’re only adding changes made to each file to the overall file system usage, but cpu usage and time are also reduced. This is because all you’re doing is getting the file system to create more meta data to track the new file and the changes. The reflink copy is near instantaneous and uses virtually no CPU resources, as it’s not doing the expensive read/ write cycle.

Of course we’re not saying you need to write a program to do the reflink for you. We have also modified the cp(1) command to add the ‘-z’ flag. This tells cp(1) to use reflink instead of copying by hand. In addition this is designed to be compatible with the Oracle VAAI/NFS plugin.

Join the discussion

Comments ( 3 )
  • Boyd Adamson Wednesday, January 31, 2018
    Is there any reason there is no cp flag "--reflink" for compatibility with the gnu coreutils implementation?
  • Artem Wednesday, October 10, 2018
    I noticed, when pool under high I/O, reflink works terribly slow.
    I tried to copy a 100g file and it took about 5 minutes. how can I speedup reflink, is any tune options available?
  • Paul Zuchowski Tuesday, March 26, 2019
    Check your block size (recordsize). Reflink performance is linear to the number of blocks to be copied, so choosing a larger block size speeds up the operation.
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.