Gavin Maltby
2008-Sep-01 04:03 UTC
[zfs-discuss] RFE: allow zfs to interpret ''.'' as da datatset?
Hi, I''d like to be able to utter cmdlines such as $ zfs set readonly=on . $ zfs snapshot . at now with ''.'' interpreted to mean the dataset corresponding to the current working directory. This would shorten what I find to be a very common operaration - that of discovering your current (working directory) dataset and performing some operation on it. I usally do this with df and some cut and paste: (gavinm at hyper:fx-review/fmaxvm-review2/usr/src/uts )-> df -h . Filesystem size used avail capacity Mounted on tank/scratch/gavinm/fx-review/fmaxvm-review2 1.0T 15G 287G 5% /tank/scratch/gavinm/fx-review/fmaxvm-review2 (gavinm at hyper:fx-review/fmaxvm-review2/usr/src/uts )-> zfs set readonly=on tank/scratch/gavinm/fx-review/fmaxvm-review2 I know I could script this, but I''m thing of general ease-of-use. The failure semantics where . is not a zfs filesystem are clear; perhaps one concern would be that it would be all to easy to target the wrong dataset with something like ''zfs destroy .'' - I''d be happy to restrict the usage to non-destructive operations only. Cheers Gavin
Mark J Musante
2008-Sep-02 12:59 UTC
[zfs-discuss] RFE: allow zfs to interpret ''.'' as da datatset?
On Mon, 1 Sep 2008, Gavin Maltby wrote:> I''d like to be able to utter cmdlines such as > > $ zfs set readonly=on . > $ zfs snapshot . at now > > with ''.'' interpreted to mean the dataset corresponding to the current > working directory.Sounds like it would be a useful RFE.> This would shorten what I find to be a very common operaration - that of > discovering your current (working directory) dataset and performing some > operation on it. I usally do this with df and some cut and paste:There''s an easier way: the zfs list command can take a pathname argument and, by using some options, you can filter the output: cur_datset="$(zfs list -Ho name $(pwd))" Regards, markm