项目中经常会在虚拟化中通过模板生成或者克隆生成Linux虚拟机,但是生成的Linux虚拟机会产生相同的machine-id,需要重新生成machine-id以避免一些不必要的冲突。以下记录了重新生成machine-id过程,供大家参考。

查看machine-id

# cat /etc/machine-id
e2bd0adf084a4c289cf335da4cd2f4b4 * Original "machine-id".

清除machine-id

# cp -f /dev/null /etc/machine-id
cp: overwrite '/etc/machine-id'? * Clear original value.

# cat /etc/machine-id
 * Value has been cleared.

创建新machine-id

# systemd-machine-id-setup
Initializing machine ID from random generator. * Success to generate and setup the new value.

查看生成新的machine-id

# cat /etc/machine-id
dab09965986b4ea1ba34dc7a79bb2830 * New value of "machine-id".
Logo

更多推荐