Provide several variations on the use of the nfsuuid tool in a udev rule in order to automagically uniquify NFSv4 clients. Signed-off-by: Benjamin Coddington <bcodding@xxxxxxxxxx> --- tools/nfsuuid/example_udev.rules | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tools/nfsuuid/example_udev.rules diff --git a/tools/nfsuuid/example_udev.rules b/tools/nfsuuid/example_udev.rules new file mode 100644 index 000000000000..31117387ac59 --- /dev/null +++ b/tools/nfsuuid/example_udev.rules @@ -0,0 +1,28 @@ +# This is a sample udev rules file that demonstrates how to get udev +# to set a unique but persistent client id uniquifier for the kernel +# NFS client. The NFS client exposes a sysfs entry that can be used to +# "uniquify" a client. Values written to this entry are used to create +# the client's identifier to distinguish a client from all other clients +# that may claim state from a particular server. Clients typically use +# several sources of information to generate a client ID such as hostname, +# and NFS version numbers, however these values may collide in certain +# sitations. +# +# These examples use the `nfsuuid` helper available from nfs-utils, see +# the man page nfsuuid(8). +# +# Write the default output of `nfsuuid` to /sys/fs/nfs/net/nfs_client/identifier +# This either creates a new, random uuid or returns one previously saved: +# KERNEL=="nfs_client", ATTR{identifier}=="(null)", PROGRAM="/usr/bin/nfsuuid", ATTR{identifier}="%c" +# +# Generate a new, random uuid on every boot: +# KERNEL=="nfs_client", ATTR{identifier}=="(null)", PROGRAM="/usr/bin/nfsuuid -rf/dev/null", ATTR{identifier}="%c" +# +# Generate a deterministic uuid based on /etc/machine-id, or return the previously saved one: +# KERNEL=="nfs_client", ATTR{identifier}=="(null)", PROGRAM="/usr/bin/nfsuuid machine", ATTR{identifier}="%c" +# +# Always use a deterministic uuid based on /etc/machine-id: +# KERNEL=="nfs_client", ATTR{identifier}=="(null)", PROGRAM="/usr/bin/nfsuuid -r machine", ATTR{identifier}="%c" +# +# Generate a new, random uuid or return the one previously saved in /var/nfs/client_id: +# KERNEL=="nfs_client", ATTR{identifier}=="(null)", PROGRAM="/usr/bin/nfsuuid -f/var/nfs/client_id", ATTR{identifier}="%c" -- 2.31.1