2

man zpool states that a vdev for a zfs pool can be a "regular file". Can I specify a sparse file (the warning about the integrity of the file being determined by the underlying filesystem should apply with the same relevance for a sparse file)?

The ZFS administration guide on https://pthree.org/2012/12/04/zfs-administration-part-i-vdevs/ states that file vdevs "must be preallocated, and not sparse files or thin provisioned" (thanks to @jlliagre).

On https://wiki.archlinux.org/index.php/Experimenting_with_ZFS sparse files are used without any comment.

Kalle Richter
  • 268
  • 6
  • 18
  • But don't do this, of course. It's not a *good* solution. I don't want the answers below to seem as though they're an endorsement for this type of solution. – ewwhite Aug 20 '14 at 20:16

2 Answers2

4

Yes, you can use sparse files as VDEVs when creating a ZFS pool. Although there was a bug affecting an early Linux ZFS port that prevented it to work, it was fixed four years ago.

You shouldn't expect performance or reliability with file based vdevs though.

Quoting the zpool manual page:

The use of files as a backing store is strongly discouraged. It is designed primarily for experimental purposes, ...

jlliagre
  • 8,861
  • 18
  • 36
0

Yes you can specify sparse file provided with an absolute path to file.I use it for testing purpose only.Refer File Vdevs for more details.

nagato
  • 46
  • 4
  • Interestingly, the link you posted states the opposite: " Further, the image files must be preallocated, and not sparse files or thin provisioned. " – jlliagre Aug 20 '14 at 06:48
  • try "zpool create tank absolute path to sparse file" will issues no error" ,same for other zfs operations – nagato Aug 20 '14 at 08:16
  • @RamSuradkar I guess, the fact that there's no error might be related to the fact that `zpool` won't check whether the file is a sparse file if it don't support it. Anyway, the specification is absolutely clear about it. It's crucial to understand content that you link if you post an answer, otherwise contribute the link to as a comment to the question, only! – Kalle Richter Aug 20 '14 at 09:34
  • well can you refer this "https://github.com/zfsonlinux/zfs/issues/33" from zfsonlinux.I too wanted to comment first,need 50 rep point :(,because question is not that much descriptive – nagato Aug 20 '14 at 09:49
  • @Ram You seem to miss my point. While your reply is otherwise correct, it doesn't make sense to suggest reading a document for more details when that document tells the exact opposite. – jlliagre Aug 20 '14 at 20:10
  • was @ram @nagato? not seeing an at-ram – Brian Thomas Oct 27 '16 at 23:48