3

I have a CentOS server that is using zfs to manage a big, slow, network attached volume.

We read quite a lot from this volume, hence I would like to optimize the read performances.

The idea is clearly a L2ARC cache.

Unfortunately I only have a single SSD disk attached to this machine already formated with xfs hosting the / and I cannot attach more (managed machine by somebody else).

I was wondering if it was possible to create a file in the SSD disk and somehow put the L2ARC in that file.

I was thinking about mounting in loop the disk, however it seems like the loop mounting support only read-only devices.

Is there an alternative?

$ dd if=/dev/zero of=/root/cache size...
$ mount -o rw,loop /root/cache /mnt/cache-file
mount: /dev/loop0 is write-protected, mounting read-only
mount: unknown filesystem type '(null)'
4

Yes, you can use a file for L2ARC. You don't even need the loopback mount: you can simply issue zpool add tank cache <absolute_file_path>

That said, L2ARC is only useful in specific circumstances, so it is not granted that it will improve your situation.

  • Ok, this is amazing! Thanks! Yes, I am aware that it may not help... But is worth to try :) – Siscia Feb 6 at 15:28

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.