{"id":198,"date":"2023-11-24T11:16:30","date_gmt":"2023-11-24T03:16:30","guid":{"rendered":"http:\/\/8.141.4.74\/?p=198"},"modified":"2024-03-29T14:33:44","modified_gmt":"2024-03-29T06:33:44","slug":"vmware%e4%b8%ad%e7%9a%84%e8%87%aa%e5%8a%a8%e5%85%89%e9%a9%b1%e6%8c%82%e8%bd%bd%e7%ae%a1%e7%90%86%ef%bc%9a%e4%bd%bf%e7%94%a8autofs%e9%85%8d%e7%bd%aecentos%e8%99%9a%e6%8b%9f%e6%9c%ba","status":"publish","type":"post","link":"http:\/\/8.141.4.74\/?p=198","title":{"rendered":"VMware\u4e2d\u7684\u81ea\u52a8\u5149\u9a71\u6302\u8f7d\u7ba1\u7406\uff1a\u4f7f\u7528autofs\u914d\u7f6eCentOS\u865a\u62df\u673a"},"content":{"rendered":"<h1>Linux \u5149\u9a71\u6302\u8f7d\u7ba1\u7406<\/h1>\n<h2>1.VMware\u6dfb\u52a0\u5149\u9a71\u81ea\u52a8\u66f4\u6362\u7684\u539f\u7406<\/h2>\n<blockquote>\n<p>\u524d\u8a00\uff1a\u5728VMware\u4e2d\uff0c\u4e00\u4e2aCentOS 8 \u7684\u7cfb\u7edf\uff0c\u4f7f\u7528 autofs \u81ea\u52a8\u6302\u8f7d\u4ee5\u540e\uff0c\u90a3\u4e48\u6b64\u65f6\u4f1a\u6709\u4e24\u4e2a\u914d\u7f6e\u6587\u4ef6\uff0c\/etc\/auto.maste\u548c\/etc\/auto.misc,\u5e76\u4e14\u6211\u4eec\u4f7f\u7528lsblk\u67e5\u770b\u7684\u65f6\u5019\uff0c\u4f1a\u6709\u4e00\u5757sr0\u7684\u5149\u9a71\u5b58\u5728\uff0c\u5f53\u6211\u4eec ls \/misc\/cd \u5c31\u4f1a\u8fdb\u53bb\u5230\u8fd9\u5757CentOS 8\u7684\u5149\u9a71\u91cc\u9762\u3002<\/p>\n<p>\u90a3\u4e48\u5f53\u6211\u4eec\u518d\u6b21\u6dfb\u52a0\u4e00\u5757CentOS 7\u7684\u5149\u9a71\u7684\u65f6\u5019\uff0c\u5f53\u6211\u4eec\u91cd\u542f\u670d\u52a1\u5668\u4ee5\u540e\u4e4b\u524dCentOS 8\u5bf9\u5e94\u7684\u5149\u9a71\u7f16\u53f7\u5c31\u53d8\u6210\u4e86sr1\uff0c\u540e\u6765\u6dfb\u52a0\u7684CentOS 7\u7684\u5149\u9a71\u7684\u7f16\u53f7\u5c31\u53d8\u6210\u4e86sr0\uff0c\u4f46\u662f\u6bcf\u6b21 cd \/misc\/cd \u8fdb\u5165\u7684\u5c31\u662fsr0(\u4e5f\u5c31\u662f\u4f1a\u8fdb\u5165\u5230CentOS 7\u7684\u5149\u9a71\u91cc\u9762\uff0c\u800c\u4e0d\u662fCentOS 8\u7684\u91cc\u9762)\u3002\u8fd9\u4e2a\u505a\u5b9e\u9a8c\u7684\u65f6\u5019\u5c31\u5f88\u6709\u95ee\u9898\u3002<\/p>\n<p>\u539f\u7406\uff1a\u5728VMware\u865a\u62df\u673a\u4e2d\uff0cSR0\u548cSR1\u4ee3\u8868\u5149\u9a71\u8bbe\u5907\u7684\u540d\u79f0\u3002\u5f53\u4f60\u5728\u865a\u62df\u673a\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684\u5149\u9a71\u8bbe\u5907\u65f6\uff0cVMware\u4f1a\u5c06\u5176\u5206\u914d\u4e3aSR0\uff0c\u800c\u539f\u6765\u7684\u5149\u9a71\u8bbe\u5907\u4f1a\u88ab\u91cd\u547d\u540d\u4e3aSR1\u3002<\/p>\n<p>\u8fd9\u662f\u7531\u4e8eLinux\u5185\u6838\u89c4\u5b9a\uff0c\u5728\u540c\u4e00\u603b\u7ebf\u4e0a\uff0c\u8bbe\u5907\u7684\u547d\u540d\u987a\u5e8f\u662f\u6839\u636e\u5b83\u4eec\u5728\u603b\u7ebf\u4e0a\u7684\u4f4d\u7f6e\u6765\u786e\u5b9a\u7684\u3002\u65b0\u6dfb\u52a0\u7684\u5149\u9a71\u8bbe\u5907\u88ab\u89c6\u4e3a\u4f4d\u4e8e\u603b\u7ebf\u7684\u9876\u90e8\uff0c\u56e0\u6b64\u88ab\u547d\u540d\u4e3aSR0\u3002\u539f\u6765\u7684\u5149\u9a71\u8bbe\u5907\u5219\u88ab\u8ba4\u4e3a\u662f\u5728\u603b\u7ebf\u7684\u4e0b\u65b9\uff0c\u56e0\u6b64\u88ab\u91cd\u547d\u540d\u4e3aSR1\u3002<\/p>\n<p>\u89e3\u51b3\u601d\u8def\uff1a\u5c06autofs\u6302\u8f7d\u7684\u76ee\u5f55\u7ed1\u5b9a\u5bf9\u5e94\u7684\u5149\u9a71\u3002\u56e0\u4e3a\u6700\u65b0\u52a0\u5165\u7684\u5149\u9a71\u4f1a\u53d8\u6210sr0\uff0c\u90a3\u4e48\u6211\u4eec\u5c06CentOS8\u5bf9\u5e94\u7684sr1\u7ed1\u5b9aautofs\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<\/blockquote>\n<pre><code class=\"language-bash\">#\u7f16\u8f91\/etc\/auto.master\u6587\u4ef6\n[root@centos8 ~]#vi \/etc\/auto.master\n#\n# Sample auto.master file\n# This is a &#039;master&#039; automounter map and it has the following format:\n# mount-point [map-type[,format]:]map [options]\n# For details of the format look at auto.master(5).\n#\n\/misc   \/etc\/auto.misc\n#\n# NOTE: mounts done from a hosts map will be mounted with the\n#   &quot;nosuid&quot; and &quot;nodev&quot; options unless the &quot;suid&quot; and &quot;dev&quot;\n#   options are explicitly given.\n#\n\/net    -hosts\n#\n# Include \/etc\/auto.master.d\/*.autofs\n# The included files must conform to the format of this file.\n#\n+dir:\/etc\/auto.master.d\n#\n# If you have fedfs set up and the related binaries, either\n# built as part of autofs or installed from another package,\n# uncomment this line to use the fedfs program map to access\n# your fedfs mounts.\n#\/nfs4  \/usr\/sbin\/fedfs-map-nfs4 nobind\n#\n# Include central master map if it can be found using\n# nsswitch sources.\n#\n# Note that if there are entries for \/net or \/misc (as\n# above) in the included master map any keys that are the\n# same will not be seen as the first read key seen takes\n# precedence.\n#\n+auto.master\n\n\u8fd9\u91cc\u9762\u7684\u5173\u952e\u4fe1\u606f\u5c31\u662f \/misc   \/etc\/auto.misc \u524d\u9762\/misc\u6302\u8f7d\u7684\u76ee\u5f55\uff0c\u540e\u9762\u662f\u5bf9\u5e94\u7684\u914d\u7f6e\u6587\u4ef6\n\n#\u7f16\u8f91\/etc\/auto.misc\n[root@centos8 ~]#vi \/etc\/auto.misc\n#\n# This is an automounter map and it has the following format\n# key [ -mount-options-separated-by-comma ] location\n# Details may be found in the autofs(5) manpage\n\ncd      -fstype=iso9660,ro,nosuid,nodev :\/dev\/cdrom\n\n# the following entries are samples to pique your imagination\n#linux      -ro,soft        ftp.example.org:\/pub\/linux\n#boot       -fstype=ext2        :\/dev\/hda1\n#floppy     -fstype=auto        :\/dev\/fd0\n#floppy     -fstype=ext2        :\/dev\/fd0\n#e2floppy   -fstype=ext2        :\/dev\/fd0\n#jaz        -fstype=ext2        :\/dev\/sdc1\n#removable  -fstype=ext2        :\/dev\/hdd\n\ncd      -fstype=iso9660,ro,nosuid,nodev :\/dev\/cdrom\uff0c\u540c\u7406cd\u662f\u76ee\u5f55\u8ddf\u4e4b\u524d\u7684\u5408\u5728\u4e00\u8d77\u5c31\u662f\/misc\/cd,\u610f\u601d\u5c31\u662f\u5149\u9a71\u6700\u540e\u662f\u6302\u8f7d\u5230\/misc\/cd \u8fd9\u4e2a\u76ee\u5f55\u4e0b\u7684\uff0c\u81f3\u4e8e\u4e3a\u4ec0\u4e48\u6bcf\u6b21\u627e\u5230\u7684sr0\u8fd9\u4e2a\u5149\u9a71\uff0c\u5c31\u662f\u540e\u9762\u7684\/dev\/cdrom,\u6211\u4eec\u5c06\u8fd9\u53e5\u8bdd\u4fee\u6539\u6210\uff1a\ncd      -fstype=iso9660,ro,nosuid,nodev :\/dev\/sr1 \u610f\u601d\u5c31\u662f\u8fd9\/dev\/sr1\u8fd9\u4e2a\u5149\u9a71\u6302\u8f7d\u5230\/misc\/cd\u4e0b\uff0c\u800c\/dev\/sr1\u5c31\u662f\u5bf9\u5e94\u7684CentOS 8\u7cfb\u7edf\u7684\u5149\u9a71\n\n#\u91cd\u542fautofs\u670d\u52a1\n[root@centos8 ~]#systemctl restart autofs\n#\u6302\u8f7d\u6210\u529f\n[root@centos8 ~]#ls \/misc\/cd\nAppStream  BaseOS  EFI  images  isolinux  LICENSE  media.repo  TRANS.TBL\n[root@centos8 ~]#lsblk\nNAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT\nsda      8:0    0  200G  0 disk\n\u251c\u2500sda1   8:1    0  100G  0 part \/\n\u251c\u2500sda2   8:2    0   50G  0 part \/data\n\u251c\u2500sda3   8:3    0    2G  0 part [SWAP]\n\u251c\u2500sda4   8:4    0    1K  0 part\n\u2514\u2500sda5   8:5    0    1G  0 part \/boot\nsdb      8:16   0   20G  0 disk\nsdc      8:32   0   10G  0 disk\nsr0     11:0    1  9.5G  0 rom\nsr1     11:1    1 10.1G  0 rom  \/misc\/cd\n[root@centos8 ~]#\n\n#\u8fd9\u91cc\u8981\u63d0\u5230\u4e00\u70b9sda\u786c\u76d8\u4f1a\u51fa\u73b0\u8fd9\u79cd\u60c5\u51b5\uff0c\u6d4b\u8bd5\u591a\u6b21\u53d1\u73b0nvme\u7684\u78c1\u76d8\u4e0d\u4f1a\uff0c\u540e\u52a0\u7684\u662f1\uff0c\u6700\u5f00\u59cb\u662fsr0\n[root@CentOS8 ~]# lsblk\nNAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT\nsr0          11:0    1 10.1G  0 rom\nsr1          11:1    1  9.5G  0 rom\nnvme0n1     259:0    0  200G  0 disk\n\u251c\u2500nvme0n1p1 259:1    0    1G  0 part \/boot\n\u251c\u2500nvme0n1p2 259:2    0  100G  0 part \/\n\u251c\u2500nvme0n1p3 259:3    0    2G  0 part [SWAP]\n\u251c\u2500nvme0n1p4 259:4    0    1K  0 part\n\u251c\u2500nvme0n1p5 259:5    0    1G  0 part \/home\n\u2514\u2500nvme0n1p6 259:6    0   50G  0 part \/data\n[root@CentOS8 ~]#<\/code><\/pre>\n<h2>2.Mount\u6c38\u4e45\u6302\u8f7d<\/h2>\n<blockquote>\n<p>\u5728\u672c\u5730\u642d\u5efayum\u670d\u52a1\u5668\u7684\u65f6\u5019\uff0c\u6bcf\u6b21\u5c06CentOS 7\u30018\u7684\u5149\u9a71\u6302\u8f7d\u5230\/var\/www\/html\/ \u5bf9\u5e94\u7684\u76ee\u5f55\u4e0b\uff0c\u4f46\u662f\u91cd\u542f\u4ee5\u540e\u5c31\u6d88\u5931\u4e86\uff0c\u56e0\u4e3amount\u53ea\u662f\u4e34\u65f6\u6302\u8f7d\u91cd\u542f\u4ee5\u540e\u5c31\u6ca1\u6709\u4e86<\/p>\n<\/blockquote>\n<pre><code class=\"language-bash\">#\u67e5\u770b\/dev\/sr0\u3001\/dev\/sr1\u5149\u9a71\u5bf9\u5e94\u7684UUID\n[root@CentOS8 ~]# blkid \/dev\/sr0 \/dev\/sr1\n\/dev\/sr0: BLOCK_SIZE=&quot;2048&quot; UUID=&quot;2021-11-13-01-04-26-00&quot; LABEL=&quot;CentOS-8-5-2111-x86_64-dvd&quot; TYPE=&quot;iso9660&quot; PTUUID=&quot;5fb10f71&quot; PTTYPE=&quot;dos&quot;\n\/dev\/sr1: BLOCK_SIZE=&quot;2048&quot; UUID=&quot;2020-11-02-15-15-23-00&quot; LABEL=&quot;CentOS 7 x86_64&quot; TYPE=&quot;iso9660&quot; PTUUID=&quot;6b8b4567&quot; PTTYPE=&quot;dos&quot;\n[root@CentOS8 ~]#\n\n#\u6c38\u4e45\u6302\u8f7d\u5c31\u662f\u8981\u5c06\u6302\u8f7d\u5199\u5728\u6587\u4ef6\u4e2d\n[root@CentOS8 ~]# vim \/etc\/fstab\n#\n# \/etc\/fstab\n# Created by anaconda on Wed Feb  8 15:36:41 2023\n#\n# Accessible filesystems, by reference, are maintained under &#039;\/dev\/disk\/&#039;.\n# See man pages fstab(5), findfs(8), mount(8) and\/or blkid(8) for more info.\n#\n# After editing this file, run &#039;systemctl daemon-reload&#039; to update systemd\n# units generated from this file.\n#\nUUID=c01e07b0-beae-4dd0-b526-0d523b6529b9 \/                       xfs     defaults        0 0\nUUID=6d3cbcc9-3487-4e85-b47d-3202436a1f57 \/boot                   xfs     defaults        0 0\nUUID=2fc5880a-2c3a-44b7-8c98-ed510c8b7179 \/data                   xfs     defaults        0 0\nUUID=ffc7d5bf-38d5-4cc0-9d62-e97679bcedc6 \/home                   xfs     defaults        0 0\nUUID=2cc78375-3da1-44a1-955e-0bb6499459b7 none                    swap    defaults        0 0\n#\u65b0\u589e\u4e24\u884c\nUUID=2021-11-13-01-04-26-00     \/var\/www\/html\/centos\/8  iso9660 defaults        0       0\nUUID=2020-11-02-15-15-23-00     \/var\/www\/html\/centos\/7\/os\/x86_64        iso9660 defaults        0       0\n[root@CentOS8 ~]#\n\n#\u65b0\u589e\u7684\u4e24\u884c\u62f7\u8d1d\u5230\u6587\u4ef6\u4e2d\uff0cUUID\u5c31\u662f\/dev\/sr0\u3001\/dev\/sr1\u5bf9\u5e94UUID\uff0c\u8fd9\u4e2a\u662f\u552f\u4e00\u7684\uff0c\u8fd9\u91cc\u5176\u5b9e\u4e5f\u53ef\u4ee5\u5c06UUID=2021-11-13-01-04-26-00\u8fd9\u4e00\u5217\u66ff\u6362\u6210\/dev\/sr0\uff0c\u4f46\u662f\u8fd9\u6837\u6709\u53ef\u80fd\u4ee5\u540e\u5149\u9a71\u7684\u540d\u5b57\u6539\u4e86\uff0c\u90a3\u4e48\u5c31\u7ed1\u5b9a\u9519\u4f4d\u4e86\u3002\/var\/www\/html\/centos\/8 \u8fd9\u4e2a\u5730\u5740\u5c31\u662f\u8981\u6302\u8f7d\u7684\u5730\u5740 \u540e\u9762\u7684\u662f\u6587\u4ef6\u7c7b\u578b\uff0c\u5c31\u662f\u4e0a\u9762\u7528blkid \u67e5\u770b\u51fa\u6765\u7684TYPE\uff0c\u540e\u9762\u662fdefaults 0 0\u5c31\u884c\u3002\n\n#\u914d\u7f6e\u6587\u4ef6\u751f\u6548\n[root@CentOS8 ~]#mount -a\n[root@CentOS8 ~]# mount -a\nmount: \/var\/www\/html\/centos\/8: WARNING: device write-protected, mounted read-only.\nmount: \/var\/www\/html\/centos\/7\/os\/x86_64: WARNING: device write-protected, mounted read-only.\n[root@CentOS8 ~]#\n\n[root@CentOS8 ~]# lsblk\nNAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT\nsr0          11:0    1 10.1G  0 rom  \/var\/www\/html\/centos\/8\nsr1          11:1    1  9.5G  0 rom  \/var\/www\/html\/centos\/7\/os\/x86_64\nnvme0n1     259:0    0  200G  0 disk\n\u251c\u2500nvme0n1p1 259:1    0    1G  0 part \/boot\n\u251c\u2500nvme0n1p2 259:2    0  100G  0 part \/\n\u251c\u2500nvme0n1p3 259:3    0    2G  0 part [SWAP]\n\u251c\u2500nvme0n1p4 259:4    0    1K  0 part\n\u251c\u2500nvme0n1p5 259:5    0    1G  0 part \/home\n\u2514\u2500nvme0n1p6 259:6    0   50G  0 part \/data\n[root@CentOS8 ~]#\n#\u8fd9\u6837\u5c31\u6c38\u4e45\u6302\u8f7d\u6210\u529f\u4e86<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Linux \u5149\u9a71\u6302\u8f7d\u7ba1\u7406 1.VMware\u6dfb\u52a0\u5149\u9a71\u81ea\u52a8\u66f4\u6362\u7684\u539f\u7406 \u524d\u8a00\uff1a\u5728VMware\u4e2d\uff0c\u4e00\u4e2aCen [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,3],"tags":[23],"views":187,"_links":{"self":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts\/198"}],"collection":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=198"}],"version-history":[{"count":1,"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts\/198\/revisions"}],"predecessor-version":[{"id":199,"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts\/198\/revisions\/199"}],"wp:attachment":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=198"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=198"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}