2

I have a desktop machine with two sets of disks - small SSDs for things I need to be quick and large HDDs for things I need to be big.

I have set up the small SSDs into a pool called "rpool" and successfully followed the instructions to use it as Ubuntu's root filesystem - it even boots from it. https://github.com/zfsonlinux/zfs/wiki/Ubuntu-16.04-Root-on-ZFS

ZFS will not let me create a second pool ("hpool" for the HDDs) with a root of /. To work around this I've used a root of /hdd for hpool.

This means that all of my hdd datasets are mounting under /hdd, not under / where I want them to be - e.g. /hdd/tmp instead of /tmp.

How can I fix this? (Other than by a mess of symlinks.)

4 Answers 4

3

While creating a new pool you can use the -R option to specify the alternate root. The ZFS option -O canmount=off is added to prevent that this pool might be mounted first and to prevent the following error message when creating child filesystems in the new pool:

zfs create tpool/tst
cannot mount 'tpool' on '/': directory is not empty
cannot mount 'tpool/tst' on '/tst': failure mounting parent dataset

Create the second pool as follows:

zpool create -N -R / -O canmount=off tpool device

When you create a filesystem in the new pool using:

zfs create tpool/tst

It will show as:

NAME                                USED  AVAIL  REFER  MOUNTPOINT
rpool                              15.7G  15.3G    34K  /rpool
.
tpool                               146K   984M    31K  /
tpool/tst                            31K   984M    31K  /tst

ls -l /tst/
total 0
3

Answering to the question "How do I fix this?":

All datasets have a mountpoint property. You can set it to whatever directory you like. In your case, /hdd is just the default if you don't set it. e.g.:

zfs set mountpoint=/foo hdd/foo

Some other replies so far make good points but answer to the unasked question "What should I have done to avoid this in the first place?"

2

/hdd was chosen in your configuration because this is the base mountpoint where your pool has been mounted and ZFS uses inheritance for propagating certain properties.

You can mount every ZFS dataset where you want by setting its mountpoint property.

zfs set mointpoint=/tmp pool2/tmp

Please note that the child datasets of pool2/tmp will inherit the parent mointpoint, unless you correct it for each single one.

Also be careful when remounting system directories. It is hard to recover from easily made mistakes here.

1

You're doing it wrong.

ZFS does support mixed spinning and silicon storage in a single pool, but in a different way than you're attempting. Instead of manually managing which data goes where, ZFS wants to handle this for you via its ZIL and L2ARC caches.

Set up this way, ZFS will figure out what needs to be where based on your usage patterns.

If you must have manual management over what goes where, I'd suggest simply making three pools: one each for the SSDs, and a mirror or RAID-Z for the HDDs. Use one SSD pool for the root filesystem, one for /home, and the slow HDD pool for bulk data. Trying to squish it all into a single thing yet still maintaining manual management is mixing concepts. Either you want ZFS to manage which disks your data lives on or you do not.

2
  • Thanks for the explanation. I'm new to ZFS and have "filesystem trust issues" as the move from ext3 to ext4 slowed down writes by more than an order of magnitude for my workload.
    – fadedbee
    Oct 18, 2016 at 12:23
  • @chrisdew: If raw I/O rates are your primary concern, you will probably not be happy with ZFS regardless of how you set it up. ZFS's copy-on-write feature will always be a speed hit over filesystems that allow in-place overwrites. There are also other areas where ZFS trades speed for correctness or safety. In fact, the problem you had with ext4 was probably of a similar nature: ext4 turns on write barriers by default. ext3 does not, and in fact may be unable to use write barriers in some situations. (LVM2, md, etc.) Oct 18, 2016 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.