You've just finished installing and configuring all those packages on your first machine. Now it's just a matter of cloning the hard drive into all the others and changing the hostname. Right?
Well, not so easy. If you wish to avoid conflicts on your network, backups and elsewhere, i.e. if you wanna end up with a unique fingerprint for each machine, you must go a few steps further.
Here follows a checklist to help you out. It's aimed at Debian and derivates (e.g. Ubuntu), though other distros won't be much different.
The old way: edit /etc/hostname
and /etc/hosts
The systemd way: hostnamectl set-hostname newhostname
rm -f /etc/machine-id /var/lib/dbus/machine-id
dbus-uuidgen --ensure=/etc/machine-id
dbus-uuidgen --ensure
rm /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server
systemctl restart ssh
tune2fs /dev/sdXN -U random
mlabel -i /dev/sdXN -n
swapoff -a
mkswp /dev/sdXN
Replace the UUID at /etc/initramfs-tools/conf.d/resume
with the new swap UUID (check blkid
) and run update-initramfs -u
If you are using UUIDs in /etc/fstab
remember to update them.
Some goes for /etc/hdparm.conf
gdisk /dev/sdXN
and then an interaction as follows:
Command (? for help): x
Expert command (? for help): c
Partition number (1-3): 1
Enter the partition's new unique GUID ('R' to randomize): R
New GUID is C9C56646-E53D-427C-B905-941DCF2A1CAB
Repeat for all partitions and finally save it:
Expert command (? for help): w
Expert command (? for help): q
PARTUUID is generated with the Windows Disk Signature (disk identifier) and the partition number. You can change the disk identifier with fdisk /dev/sdXN
:
Command (m for help): x
Expert command (m for help): i
Enter the new disk identifier: 0x19ef8aa3
Disk identifier changed from 0x9eff18bb to 0x19ef8aa3.
Expert command (? for help): w
Expert command (? for help): q
fdisk
offers no option to generate a random ID, you should make one up yourself.