zfs

ZFS: "convert" a pool into a filesystem


I've created a pool trunk that is mounted under say /X. I didn't realize that I should have created a filesystem on that pool, so people on a shared server started to directly write into /X. Now I want to set up a quota, for which I've learned that this does not work on the pool level, but that I need a ZFS filesystem. I can create that filesystem, let's call it trunk/fs1, but I would like that all the existing data from the "pool level" is available in that filesystem and to mount the filesystem under /X, so that application code of my users does not break.

So long story short: the users should still be able to access their data under /X but this is now a ZFS filesystem (with a quota) rather than a pool. How can I achieve that?


Solution

  • The place where your users are currently writing data to now is called the "default filesystem" for the pool, so you do have a ZFS filesystem available to get/set properties on. However, there is still value in moving the data to another filesystem (for example if you want to have two different users who each have a separate quota).

    If you want to move the data into a newly-created filesystem, you just have to copy the data into the filesystem after you create it. Once you do that, you can unmount the default filesystem for the pool and then set the new filesystem to be in its original location with zfs set mountpoint=/X or similar mount tools (more explanation / examples here -- exact tooling varies a little bit by OS though so you might need to Google a bit).