6

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)'
Siscia
  • 173
  • 3

1 Answers1

5

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.

shodanshok
  • 44,038
  • 6
  • 98
  • 162
  • Ok, this is amazing! Thanks! Yes, I am aware that it may not help... But is worth to try :) – Siscia Feb 06 '19 at 15:28