ZFS zpool on a file

GEOM is a marvellous feature of FreeBSD.
md(4) is a GEOM provider.
ZFS vdevs may be constructed from any GEOM provider.
See mdconfig(8) (type vnode).
To create a 1GB provider with a backing store file, use something like:
Code:
sudo mdconfig -a -t vnode -s 1g -f BackingStoreFileName
 
Another thing, it's easy to take a backup. Just one file. clone or more efficient snapshot & zfs-send.
I see you are looking for a quick way to "mount" a zfs file, just like I said

Short version: you can't :) unless you allocate the same space of the original volume
Medium version: a thin disk (on a virtual machine) is the usual best try, but almost never works (because zfs' blocks spreads almost everythere, there is not a "defrag")

If you really want I have all the scripts necessary
Fragile ones, of course :)

If you try a way (that does require about the space of allocated data) please let me know
 
OK
Allocating a 100g (example) file into

Code:
truncate -s 100g /rpool/zfs.img
mdconfig /rpool/zfs.img
Beware, not always md0, you will get in console
creating the zpool immagine
Code:
zpool create immagine /dev/md0
now restore the "base" (in this example with pv)
Code:
cat /mynas/image/fullc.zfs |pv| zfs receive immagine/base@franco
now apply the difference
Code:
cat /mynas/image/differenza.zfs |pv| zfs receive -F immagine/base@differenza
Now rollback to latests
Code:
zfs rollback -r immagine/base@differenza

BTW

you can make then "base" with something like
Code:
zfs destroy -f tank/d@francobase
zfs snapshot tank/d@francobase
/sbin/zfs send tank/d@francobase |pv |/usr/local/bin/zpaqfranz a /temporaneo/zfs.zpaq fullc.zfs -stdin

And get the difference
Code:
touch /tank/d/momentosnap
zfs destroy -f tank/d@francodifferenza
zfs snapshot tank/d@francodifferenza
zfs send -i tank/d@francobase tank/d@francodifferenza |/usr/local/bin/zpaqfranz a /tempora
neo/zfs.zpaq differenza.zfs -stdin
 
The .zfs image restore is (for me) a last resort, when other systems have failed

Basically I keep a .zpaq file containing both the initial backup and the differential images (I also have the incremental function, but I don't like them, too fragile for my taste)

The .zpaq file is cloned using rsync (in my case) to remote OVH server
Therefore contains all the data (i.e. the basic snapshot PLUS all the additional ones)

In the event of a major disaster, I transfer it (rsynced the .zpaq file) locally (on a Windows machine actually :), from which I extract the difference.zfs file into a ramdisk
This usually takes a couple of minutes (rsync --append) and a couple for extraction

I have a "ready" FreeBSD virtual machine locally (with the restore of the base snapshot, the big one)

Through a Samba share (yes, samba) I apply the differences and roll back
Usually ~10 minutes for the disaster recovery of the data pool, ~20 minutes for zroot (requires a couple of digging and reboot)
 
Back
Top