ZFS Need help with 2 ZFS questions

mrjayviper

Active Member

Thanks: 4
Messages: 171

#1
1. When using auto ZFS during installation, it creates several datasets. How can I make a snapshot of the whole pool without to make a snapshot of individual dataset?

As a test, I did these steps:
  1. I made a backup of the zroot pool using zfs snapshot zroot@initial.
  2. I created a folder inside /root.
  3. I then restore the snapshot using zfs rollback zroot@initial and the folder inside /root is still there.
2. Which leads me to question 2. As I was looking at the output of zfs list, I began to think the advantages of using zfs datasets. I can see it's use for different compression per datasets (text heavy files vs images) and perhaps permissions/etc. But perhaps there are other things/reasons for using datasets that I haven't thought of? I am asking since I am in the process of moving my pool. I guess looking at best/better practices for home users.

Thanks :)
 

SirDice

Administrator
Staff member
Administrator
Moderator

Thanks: 6,599
Messages: 28,129

#2
How can I make a snapshot of the whole pool without to make a snapshot of individual dataset?
You can't. By its very definition a snapshot always refers to a dataset.

Your zroot doesn't contain any datasets, it's just a placeholder. It's zroot/ROOT/default that contains your root filesystem.
 

tokred

New Member

Thanks: 3
Messages: 6

#4
ad 1.:
Your question is a bit ambiguous. One answer might be that you can make recursive snapshots with the parameter -r, i.e. snapshotting a certain dataset (or whole pool) with all descendent datasets in a single command.

Regarding your rollback test, and as SirDice already implied: For a default installation, zroot is NOT mounted to /, but zroot/ROOT/default is. Therefore, your results were unexpected as you would have had to snapshot and rollback zroot/ROOT/default in order to "undo" the subfolder.

ad 2.:
Criteria to create additional datasets are quite individual and potentially more relevant in server scenarios. For me, datasets are mainly snapshot-driven and therefore depend on volatility of data, potential of requiring rollbacks or the possibility to individually snapshot and send/receive to backup systems. Others may use delegation features which results in a more user/privilege-oriented dataset structure. Of course, different property requirements also require separate datasets. Although compression is not necessarily an example (thanks to LZ4, nowadays you quite always "want" it enabled), but maybe more because of properties like recordsize or quota.

Regards
 

SirDice

Administrator
Staff member
Administrator
Moderator

Thanks: 6,599
Messages: 28,129

#5
Isn't the new ZFS's zpool(8) feature checkpoint an appropriate way to achieve this ?
I actually didn't know it existed. Looks useful. There does seem to be a few caveats but I can certainly imagine scenarios where it could be used.
 
Top