{"id":6792,"date":"2016-12-20T23:44:55","date_gmt":"2016-12-20T15:44:55","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=6792"},"modified":"2023-04-28T09:47:05","modified_gmt":"2023-04-28T09:47:05","slug":"change-uuid-of-linux-partition","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/change-uuid-of-linux-partition\/","title":{"rendered":"How to Change UUID of Linux Partition on CentOS 7"},"content":{"rendered":"<p><img decoding=\"async\" class=\"alignnone wp-image-6808 size-full lazyload\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/12\/How-to-Change-UUID-of-Linux-Partition-on-CentOS-7.jpg\" alt=\"Change UUID\" width=\"1280\" height=\"905\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/12\/How-to-Change-UUID-of-Linux-Partition-on-CentOS-7.jpg 1280w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/12\/How-to-Change-UUID-of-Linux-Partition-on-CentOS-7-300x212.jpg 300w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/12\/How-to-Change-UUID-of-Linux-Partition-on-CentOS-7-768x543.jpg 768w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2016\/12\/How-to-Change-UUID-of-Linux-Partition-on-CentOS-7-1024x724.jpg 1024w\" data-sizes=\"(max-width: 1280px) 100vw, 1280px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1280px; --smush-placeholder-aspect-ratio: 1280\/905;\" \/><strong>UUID<\/strong> (Universally Unique IDentifier) should be unique and it is used to identify storage devices on a linux system.<\/p>\n<p>If you cloned a virtual machine from vCenter, the metadata containing information of UUID for the filesystem will be identical for the original and cloned copy, therefore the UUID is no longer unique in \/etc\/fstab.<\/p>\n<p>The following steps will show how to change UUID of linux partition on CentOS 7.<!--more--><\/p>\n<p>1) Use blkid command-line utility to determine device UUID :<\/p>\n<pre># blkid\r\n<\/pre>\n<p>Sample output :<\/p>\n<pre>\r\n\/dev\/mapper\/centos_centos71-root: UUID=\"2bc8e0d4-64b5-4dc8-bf4a-024fc980d98a\" TYPE=\"ext4\"\r\n\/dev\/mapper\/centos_centos71-swap: UUID=\"577f9541-8d2a-4666-ac8f-ff84b584eeca\" TYPE=\"swap\"\r\n\/dev\/mapper\/vg_data-centos7_vol: UUID=\"b100ad2b-ad89-4e2d-ba8e-7eda7d703c40\" TYPE=\"ext4\"\r\n<\/pre>\n<p>2) Another way to list out uuid by issue below command :<\/p>\n<pre># ls -l \/dev\/disk\/by-uuid\r\ntotal 0\r\nlrwxrwxrwx 1 root root 10 Dec 20 23:16 2bc8e0d4-64b5-4dc8-bf4a-024fc980d98a -&gt; ..\/..\/dm-1\r\nlrwxrwxrwx 1 root root 10 Dec 20 23:16 577f9541-8d2a-4666-ac8f-ff84b584eeca -&gt; ..\/..\/dm-0\r\nlrwxrwxrwx 1 root root 10 Dec 20 23:19 b100ad2b-ad89-4e2d-ba8e-7eda7d703c40 -&gt; ..\/..\/dm-2\r\n<\/pre>\n<p>3) Verify the mounted partition :<\/p>\n<p>There is mounted \/data in the system with UUID=&#8221;b100ad2b-ad89-4e2d-ba8e-7eda7d703c40&#8243;.<\/p>\n<pre># df -lh\r\nFilesystem                        Size  Used Avail Use% Mounted on\r\n\/dev\/mapper\/centos_centos71-root   24G  3.1G   19G  15% \/\r\ndevtmpfs                          1.9G     0  1.9G   0% \/dev\r\ntmpfs                             1.9G     0  1.9G   0% \/dev\/shm\r\ntmpfs                             1.9G   25M  1.9G   2% \/run\r\ntmpfs                             1.9G     0  1.9G   0% \/sys\/fs\/cgroup\r\ntmpfs                             500M     0  500M   0% \/etc\/nginx\/cache\r\n\/dev\/sda1                         477M  230M  218M  52% \/boot\r\ntmpfs                             380M     0  380M   0% \/run\/user\/0\r\n\/dev\/mapper\/vg_data-centos7_vol   9.8G   37M  9.2G   1% \/data\r\n<\/pre>\n<p>4. How to change UUID for \/dev\/mapper\/vg_data-centos7_vol which is in \/data mounted partition.<\/p>\n<p>a) Generate new UUId using uuidgen utility :<\/p>\n<pre># uuidgen\r\nfb5c697b-d1d6-49ab-afcd-27a22a5007c8\r\n<\/pre>\n<p>b) Please take note that the UUID may only be changed when the filesystem is unmounted.<\/p>\n<pre># umount \/data\r\n<\/pre>\n<p>c) Change UUID for LVM \/dev\/mapper\/vg_data-centos7_vol with new generated UUID :<\/p>\n<pre># tune2fs \/dev\/mapper\/vg_data-centos7_vol -U fb5c697b-d1d6-49ab-afcd-27a22a5007c8\r\ntune2fs 1.42.9 (28-Dec-2013)\r\n<\/pre>\n<p>d) Mount back the \/data partition :<\/p>\n<pre>\r\n# mount \/dev\/mapper\/vg_data-centos7_vol \/data\r\n<\/pre>\n<p>e) Update \/etc\/fstab :<\/p>\n<p>Option 1 :<\/p>\n<pre>UUID=fb5c697b-d1d6-49ab-afcd-27a22a5007c8 \/data                   ext4    defaults        1 2\r\n<\/pre>\n<p>Option 2 :<\/p>\n<pre>\/dev\/mapper\/vg_data-centos7_vol \/data                   ext4    defaults        1 2\r\n<\/pre>\n<p>f) Verify new UUID for \/dev\/mapper\/vg_data-centos7_vol<\/p>\n<pre># blkid\r\n<\/pre>\n<p>Sample output :<\/p>\n<pre>\/dev\/mapper\/centos_centos71-root: UUID=\"2bc8e0d4-64b5-4dc8-bf4a-024fc980d98a\" TYPE=\"ext4\"\r\n\/dev\/mapper\/centos_centos71-swap: UUID=\"577f9541-8d2a-4666-ac8f-ff84b584eeca\" TYPE=\"swap\"\r\n\/dev\/mapper\/vg_data-centos7_vol: UUID=\"fb5c697b-d1d6-49ab-afcd-27a22a5007c8\" TYPE=\"ext4\"\r\n<\/pre>\n<p><a href=\"https:\/\/linuxconfig.org\/how-to-retrieve-and-change-partitions-universally-unique-identifier-uuid-on-linux\" target=\"_blank\" rel=\"nofollow noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>UUID (Universally Unique IDentifier) should be unique and it is used to identify storage devices on a linux system. If you cloned a virtual machine from vCenter, the metadata containing&#8230;<\/p>\n","protected":false},"author":6,"featured_media":6808,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[2055],"tags":[1258,1874],"class_list":["post-6792","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","tag-centos-7","tag-uuid"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/6792","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=6792"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/6792\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/6808"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=6792"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=6792"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=6792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}