{"id":1848,"date":"2021-05-10T10:44:31","date_gmt":"2021-05-10T17:44:31","guid":{"rendered":"https:\/\/jim-zimmerman.com\/?p=1848"},"modified":"2021-05-10T10:44:31","modified_gmt":"2021-05-10T17:44:31","slug":"mount-a-disk-partition-using-the-uuid-in-linux","status":"publish","type":"post","link":"https:\/\/jim-zimmerman.com\/?p=1848","title":{"rendered":"Mount a disk partition using the UUID in linux."},"content":{"rendered":"<p>I was mounting an external drive using the partition device file.  I found that over time the mounted partition would give an I\/O error.  It turned out it was because the device file had changed.  I decided to mount it using UUID to see if took care of the issue.  <\/p>\n<p>Here what I did to mount it and add it to the startup:<\/p>\n<blockquote><p># fdisk \/dev\/sdc<\/p>\n<p>Welcome to fdisk (util-linux 2.33.1).<br \/>\nChanges will remain in memory only, until you decide to write them.<br \/>\nBe careful before using the write command.<\/p>\n<p>Command (m for help): p<br \/>\nDisk \/dev\/sdc: 3.7 TiB, 4000787029504 bytes, 7814037167 sectors<br \/>\nDisk model: One Touch HDD<br \/>\nUnits: sectors of 1 * 512 = 512 bytes<br \/>\nSector size (logical\/physical): 512 bytes \/ 4096 bytes<br \/>\nI\/O size (minimum\/optimal): 4096 bytes \/ 4096 bytes<br \/>\nDisklabel type: gpt<br \/>\nDisk identifier: E396A756-646C-40DC-A8F8-59CC11D40FA8<\/p>\n<p>Device     Start        End    Sectors  Size Type<br \/>\n\/dev\/sdc1   2048 7814035455 7814033408  3.7T Linux filesystem<\/p>\n<p>Command (m for help): quit<\/p><\/blockquote>\n<p>Use this command to determine the UUID:<\/p>\n<blockquote><p># blkid<br \/>\n&#8230;<br \/>\n\/dev\/sdc1: UUID=&#8221;20f17e14-71c3-498f-8872-97dcd80c1d3e&#8221; TYPE=&#8221;ext4&#8243; PARTUUID=&#8221;ccbd82af-94e0-431a-a54b-b9100a087133&#8243;<br \/>\n&#8230;<\/p><\/blockquote>\n<p>You can use lsblk as well:<\/p>\n<blockquote><p># lsblk -fs<br \/>\nNAME           FSTYPE      LABEL UUID                                   FSAVAIL FSUSE% MOUNTPOINT<br \/>\n&#8230;<br \/>\nsdc1           ext4              20f17e14-71c3-498f-8872-97dcd80c1d3e<br \/>\n\u00e2\u201d\u201d\u00e2\u201d\u20acsdc<br \/>\n&#8230;<\/p><\/blockquote>\n<p>Add the entry to the fstab:<\/p>\n<blockquote><p># vi \/etc\/fstab<br \/>\n&#8230;<br \/>\nUUID=20f17e14-71c3-498f-8872-97dcd80c1d3e \/external ext4 defaults 0 0<\/p><\/blockquote>\n<p>Then mount it:<\/p>\n<blockquote><p># mount \/external<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>I was mounting an external drive using the partition device file. I found that over time the mounted partition would give an I\/O error. It turned out it was because the device file had changed. I decided to mount it using UUID to see if took care of the issue. Here what I did to [&#038;hellip<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[48,184,502],"class_list":["post-1848","post","type-post","status-publish","format-standard","hentry","category-documentation","tag-linux","tag-mount","tag-uuid"],"share_on_mastodon":{"url":"","error":""},"_links":{"self":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1848"}],"version-history":[{"count":2,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1848\/revisions"}],"predecessor-version":[{"id":1850,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1848\/revisions\/1850"}],"wp:attachment":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}