Machine ID


# cat /etc/machine-id
daab00e07fed481d8ccf145b7affc0c5
# rm /etc/machine-id
# systemd-machine-id-setup
Initializing machine ID from random generator.
# cat /etc/machine-id
2175d9b2344a499abd87920c6f76f9a1


Storage UUID



Use blkid command-line utility to determine device UUID :

# blkid

Sample output :

/dev/mapper/centos_centos71-root: UUID="2bc8e0d4-64b5-4dc8-bf4a-024fc980d98a" TYPE="ext4"
/dev/mapper/centos_centos71-swap: UUID="577f9541-8d2a-4666-ac8f-ff84b584eeca" TYPE="swap"
/dev/mapper/vg_data-centos7_vol: UUID="b100ad2b-ad89-4e2d-ba8e-7eda7d703c40" TYPE="ext4"

Verify the mounted partition :

# df -lh
Filesystem                        Size  Used Avail Use% Mounted on
/dev/mapper/centos_centos71-root   24G  3.1G   19G  15% /
devtmpfs                          1.9G     0  1.9G   0% /dev
tmpfs                             1.9G     0  1.9G   0% /dev/shm
tmpfs                             1.9G   25M  1.9G   2% /run
tmpfs                             1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs                             500M     0  500M   0% /etc/nginx/cache
/dev/sda1                         477M  230M  218M  52% /boot
tmpfs                             380M     0  380M   0% /run/user/0
/dev/mapper/vg_data-centos7_vol   9.8G   37M  9.2G   1% /data

How to change UUID for /dev/mapper/vg_data-centos7_vol which is in /data mounted partition 


a) Generate new UUId using uuidgen utility :

# uuidgen
fb5c697b-d1d6-49ab-afcd-27a22a5007c8

b) Please take note that the UUID may only be changed when the filesystem is unmounted.

# umount /data

c) Change UUID for LVM /dev/mapper/vg_data-centos7_vol with new generated UUID :

# tune2fs /dev/mapper/vg_data-centos7_vol -U fb5c697b-d1d6-49ab-afcd-27a22a5007c8
tune2fs 1.42.9 (28-Dec-2013)

d) Mount back the /data partition :

# mount /dev/mapper/vg_data-centos7_vol /data

e) Update /etc/fstab :

Option 1 :

UUID=fb5c697b-d1d6-49ab-afcd-27a22a5007c8 /data                   ext4    defaults        1 2

Option 2 :

/dev/mapper/vg_data-centos7_vol /data                   ext4    defaults        1 2

f) Verify new UUID for /dev/mapper/vg_data-centos7_vol

# blkid

Sample output :

/dev/mapper/centos_centos71-root: UUID="2bc8e0d4-64b5-4dc8-bf4a-024fc980d98a" TYPE="ext4"
/dev/mapper/centos_centos71-swap: UUID="577f9541-8d2a-4666-ac8f-ff84b584eeca" TYPE="swap"
/dev/mapper/vg_data-centos7_vol: UUID="fb5c697b-d1d6-49ab-afcd-27a22a5007c8" TYPE="ext4"


How to generate UUID for network interface


UUIDs (Universal Unique Identifier) for network interface card can be generated using the following command :

Command
Shell
1
uuidgen <DEVICE>

Example :

Command
Shell
1
uuidgen eth0

Then you can add it to your NIC config file (assuming your interface is eth0) :

NIC configuration file
Shell
1
/etc/sysconfig/network-scripts/ifcfg-eth0

Add/modify the following :

NIC configuration file option
Shell
1
UUID=<uuid>