Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
en:linux:nfs_unique_machineid [2020/05/06 03:21] alex created |
en:linux:nfs_unique_machineid [2020/05/06 03:59] (current) alex |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Unique machine ID for nfs root systems ====== | ====== Unique machine ID for nfs root systems ====== | ||
| + | When multiple hosts running systemd share the same NFS root, they will also share the same machine-id. This can cause issues, especially with journald. Journald logging can be disabled by deleting ''/var/log/journal'' which solves most of the problems, but a better solution is to use unique machine-id values on all of the hosts. Modern motherboards provide a unique UUID accessible via DMI, so a reasonable option is to write this out to /run during boot and point systemd at that as the machine-id. Here is a simple way to set that up. | ||
| + | Create the file ''/etc/initramfs-tools/scripts/init-top/machineid'': | ||
| + | |||
| + | <code bash machineid> | ||
| + | #!/bin/sh -e | ||
| + | |||
| + | PREREQS="" | ||
| + | |||
| + | prereqs() { echo "$PREREQS"; } | ||
| + | |||
| + | case "$1" in | ||
| + | prereqs) | ||
| + | prereqs | ||
| + | exit 0 | ||
| + | ;; | ||
| + | esac | ||
| + | |||
| + | # write sanitized motherboard UUID to /run/machine-id | ||
| + | sed 's/-//g' /sys/class/dmi/id/product_uuid > /run/machine-id | ||
| + | |||
| + | # requires the following symbolic links: | ||
| + | # ln -sf /run/machine-id /etc/machine-id | ||
| + | # ln -sf /run/machine-id /var/lib/dbus/machine-id | ||
| + | |||
| + | </code> | ||
| + | |||
| + | Rebuild the initramfs (for example ''update-initramfs -u'') and replace ''/etc/machine-id'' and ''/var/lib/dbus/machine-id'' with symlinks to ''/run/machine-id''. | ||