openzfs / zfs

OpenZFS on Linux and FreeBSD
https://openzfs.github.io/openzfs-docs
Other
10.64k stars 1.75k forks source link

Allow overriding some init-only properties if the dataset doesn't contain any files #13080

Open mqudsi opened 2 years ago

mqudsi commented 2 years ago

It's currently not possible to set properties like casesensitivity or normalization on a dataset after its creation; to set these, you should create a new dataset w/ these properties changed, sync the files over, then rename to replace the original. So far, so good.

After you've done that for all your datasets, you still can't change the property for the root dataset/pool, so any new top-level datasets you create in the future need to have these properties manually set. I would like to propose that if a dataset does not contain any of its own files (or any snapshots containing files), it should be allowed to change these properties.

e.g.

zpool create tank da1
zfs create tank/storage1
# Store files on tank/storage1. Store nothing on tank.
# Oops, I forgot to set these properties!
zfs create -o casensitivity=sensitive tank/storage2
rsync -avpP /tank/storage1 /tank/storage2
zfs destroy tank/storage1
zfs rename tank/storage2 tank/storage1
# I'm going to run into the same problem again if I create `tank/foo` 
# because it'll inherit the value from the root dataset

In this case where a dataset only contains other datasets but no files, shouldn't it be safe to change these properties (effectively just setting the "default" values for any future child datasets created)?

szubersk commented 2 years ago

First of all why would someone use rsync instead of zfs send | zfs recv? :) I'm afraid this might be a low-value feature.

mqudsi commented 2 years ago

@szubersk to avoid overwriting the changed properties, I think?

Anyway, you can certainly increase the value by changing the (intentionally minimal) ask: please consider allowing setting utf8_only even on petabyte-sized datasets if none of the referenced files have a non-unicode filename and case_sensitivity if there are no conflicts in the dataset contents.

nabijaczleweli commented 2 years ago

uuuh oesn't a dataset by definition contain, like, the directory inode (=> . and .. links, too). how are you gonna make a dataset not have any files?