{"id":2205,"date":"2023-05-09T16:23:32","date_gmt":"2023-05-09T08:23:32","guid":{"rendered":"https:\/\/blog.kingsbestone.com\/?p=2205"},"modified":"2024-01-05T13:50:01","modified_gmt":"2024-01-05T05:50:01","slug":"centos7%e6%b7%bb%e5%8a%a0%e7%a3%81%e7%9b%98%e4%b9%8b%e5%88%86%e5%8c%ba%e7%ae%a1%e7%90%86","status":"publish","type":"post","link":"https:\/\/blog.kingsbestone.com\/?p=2205","title":{"rendered":"\u3010\u7cfb\u7edf\u64cd\u4f5c\u3011centos7 \u5206\u533a\u7ba1\u7406"},"content":{"rendered":"<p><span style=\"font-family: 'comic sans ms', sans-serif;\">\u7075\u6d3b\u5bf9centos7\u7cfb\u7edf\u8fdb\u884c\u5206\u533a\uff0c\u4ee5\u7075\u6d3b\u5e94\u5bf9\u4e0d\u540c\u9700\u6c42\u3002<\/span><\/p>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">\u4e3b\u8981\u6d41\u7a0b\u4e3a\uff1a\u67e5\u770b\u76ee\u524d\u7cfb\u7edf\u78c1\u76d8\u72b6\u6001&#8211;&gt;\u521b\u5efa\u5e76\u6dfb\u52a0\u5206\u533a\u8868\u7c7b\u578b\uff08MBR\/GPT\uff09&#8211;&gt;\u81ea\u5b9a\u4e49\u5206\u533a\u5927\u5c0f&#8211;&gt;\u683c\u5f0f\u5316\u5206\u533a\u5e76\u9009\u62e9\u6587\u4ef6\u7cfb\u7edf\u7c7b\u578b\uff08xfs\uff09&#8211;&gt;\u6302\u8f7d\u78c1\u76d8&#8211;&gt;\u8bbe\u7f6e\u6c38\u4e45\u6302\u8f7d<\/span><\/p>\n<hr \/>\n<h1><span style=\"font-family: 'comic sans ms', sans-serif;\">1.\u51c6\u5907\u73af\u5883\uff1a<\/span><\/h1>\n<ul>\n<li><span style=\"font-family: 'comic sans ms', sans-serif;\">VMware workstation pro 15<\/span><\/li>\n<li><span style=\"font-family: 'comic sans ms', sans-serif;\">centos7\uff08\u6302\u8f7d2\u4e2a\u78c1\u76d8\uff09<\/span><\/li>\n<\/ul>\n<h1><span style=\"font-family: 'comic sans ms', sans-serif;\">2.\u67e5\u770b\u78c1\u76d8\u72b6\u6001\uff1a<\/span><\/h1>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">#\u67e5\u770b\u7cfb\u7edf\u7684\u78c1\u76d8\u4f7f\u7528\u60c5\u51b5\r\nlsblk\r\n#\u663e\u793a\u5757\u8bbe\u5907\u4fe1\u606f\r\nblkid\r\n#\u663e\u793a\u78c1\u76d8\u7a7a\u95f4\u4f7f\u7528\u91cf\u60c5\u51b5\r\ndf -h<\/pre>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">tips\uff1a\u4e0a\u9762\u4e3a\u5e38\u7528\u67e5\u770b\u547d\u4ee4<\/span><\/p>\n<h1><span style=\"font-family: 'comic sans ms', sans-serif;\">3.\u5206\u533a\u8868\u7c7b\u578b\u4e0e\u521b\u5efa\u78c1\u76d8\uff1a<\/span><\/h1>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">3-1.\u5206\u533a\u8868\u7c7b\u578b\u4e3b\u8981\u5206\u4e3a2\u79cd\uff0cMBR\u548cGPT\uff0c\u6839\u636e\u673a\u5668\u7684\u5b9e\u9645\u60c5\u51b5\u9009\u62e9\u5373\u53ef\uff0c\u4e3b\u677f\u517c\u5bb9UEFI\u9ed8\u8ba4\u63a8\u8350\u9009GPT\u683c\u5f0f\u3002<\/span><\/p>\n<ul>\n<li><span style=\"font-family: 'comic sans ms', sans-serif;\">MBR\uff08\u8001\u6280\u672f\uff0c\u6700\u5927\u517c\u5bb92TB\u5bb9\u91cf\uff0c\u4e3b\u677f\u542f\u52a8\u5f15\u5bfc\u5fc5\u987b\u4e3aBIOS\uff09<\/span><\/li>\n<li><span style=\"font-family: 'comic sans ms', sans-serif;\">GPT\uff08\u65b0\u6280\u672f\uff0c\u5bb9\u91cf\u53d7\u9650\uff0c\u4e3b\u677f\u542f\u52a8\u5f15\u5bfc\u5fc5\u987b\u4e3aUEFI\uff09<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">3-2.\u5728centos7\u4e2d\u5e38\u7528\u7684\u78c1\u76d8\u5206\u533a\u5de5\u5177\u67092\u4e2a\uff0cfdisk\u548cparted\uff0c\u5982\u679c\u4e3b\u677f\u517c\u5bb9UEFI\u542f\u52a8\uff0c\u4f18\u5148\u63a8\u8350parted\u8fdb\u884c\u5206\u533a\u3002<\/span><\/p>\n<ul>\n<li><span style=\"font-family: 'comic sans ms', sans-serif;\">fdisk\uff08\u8001\u7684\u78c1\u76d8\u5206\u533a\u5de5\u5177\uff0c\u5bf9MBR\u517c\u5bb9\u8f83\u597d\uff0cGPT\u517c\u5bb9\u4e0d\u662f\u5f88\u597d\uff09<\/span><\/li>\n<li><span style=\"font-family: 'comic sans ms', sans-serif;\">parted\uff08\u65b0\u7684\u78c1\u76d8\u5206\u533a\u5de5\u5177\uff0c\u652f\u6301MBR\u4e0eGPT\uff09<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">3-3.\u9ed8\u8ba4\u6211\u4f7f\u7528parted\u8fdb\u884c\u78c1\u76d8\u5206\u533a\u7ba1\u7406\uff0c\u521b\u5efa\u65b0\u7a7a\u95f4\uff1a<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">[root@localhost ~]# parted \/dev\/sdb\r\nGNU Parted 3.1\r\n\u4f7f\u7528 \/dev\/sdb\r\nWelcome to GNU Parted! Type 'help' to view a list of commands.\r\n(parted) help                                                             \r\n  align-check TYPE N                        check partition N for TYPE(min|opt) alignment\r\n  help [COMMAND]                           print general help, or help on COMMAND\r\n  mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)\r\n  mkpart PART-TYPE [FS-TYPE] START END     make a partition\r\n  name NUMBER NAME                         name partition NUMBER as NAME\r\n  print [devices|free|list,all|NUMBER]     display the partition table, available devices, free space, all found partitions, or a particular partition\r\n  quit                                     exit program\r\n  rescue START END                         rescue a lost partition near START and END\r\n  \r\n  resizepart NUMBER END                    resize partition NUMBER\r\n  rm NUMBER                                delete partition NUMBER\r\n  select DEVICE                            choose the device to edit\r\n  disk_set FLAG STATE                      change the FLAG on selected device\r\n  disk_toggle [FLAG]                       toggle the state of FLAG on selected device\r\n  set NUMBER FLAG STATE                    change the FLAG on partition NUMBER\r\n  toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER\r\n  unit UNIT                                set the default unit to UNIT\r\n  version                                  display the version number and copyright information of GNU Parted\r\n(parted) mklabel                                                          \r\n\u65b0\u7684\u78c1\u76d8\u6807\u7b7e\u7c7b\u578b\uff1f                                                        \r\naix    amiga  bsd    dvh    gpt    loop   mac    msdos  pc98   sun    \r\n\u65b0\u7684\u78c1\u76d8\u6807\u7b7e\u7c7b\u578b\uff1f gpt\r\n\u8b66\u544a: The existing disk label on \/dev\/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?\r\n\u662f\/Yes\/\u5426\/No? yes                                                         \r\n(parted) print                                                            \r\nModel: VMware, VMware Virtual S (scsi)\r\nDisk \/dev\/sdb: 10.7GB\r\nSector size (logical\/physical): 512B\/512B\r\nPartition Table: gpt\r\nDisk Flags: \r\n\r\nNumber  Start  End  Size  File system  Name  \u6807\u5fd7\r\n\r\n(parted) mkpart\r\n\u5206\u533a\u540d\u79f0\uff1f  []? disk2\r\n\u6587\u4ef6\u7cfb\u7edf\u7c7b\u578b\uff1f  [ext2]? xfs                                               \r\n\u8d77\u59cb\u70b9\uff1f 0%                                                               \r\n\u7ed3\u675f\u70b9\uff1f 100%                                                             \r\n(parted) print                                                            \r\nModel: VMware, VMware Virtual S (scsi)\r\nDisk \/dev\/sdb: 10.7GB\r\nSector size (logical\/physical): 512B\/512B\r\nPartition Table: gpt\r\nDisk Flags: \r\n\r\nNumber  Start   End     Size    File system  Name   \u6807\u5fd7\r\n 1      1049kB  10.7GB  10.7GB               disk2\r\n\r\n(parted) quit                                                             \r\n\u4fe1\u606f: You may need to update \/etc\/fstab.\r\n\r\n[root@localhost ~]#<\/pre>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">tips\uff1a\u8d77\u59cb\u70b9\u548c\u7ed3\u675f\u70b9\uff0c\u53ef\u4ee5\u7528\u5bb9\u91cf\u5355\u4f4d\uff08K\u3001M\u3001G\u3001T\uff09\u548c\u767e\u5206\u6bd4\uff08%\uff09\u3002<\/span><\/p>\n<h1><span style=\"font-family: 'comic sans ms', sans-serif;\">4.\u91cd\u65b0\u683c\u5f0f\u5316\u78c1\u76d8\uff1a<\/span><\/h1>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">\u867d\u7136\u4e0a\u8ff0\u5de5\u5177\u5df2\u7ecf\u5e2e\u5fd9\u683c\u5f0f\u5316\u5b8c\u6210\u4e86\u78c1\u76d8\uff0c\u4f46\u662f\u4f7f\u7528blkid\u67e5\u770b\u65f6\u4f1a\u548c\u9ed8\u8ba4\u7684\u78c1\u76d8\u683c\u5f0f\u4e0d\u592a\u4e00\u6837\uff0c\u6240\u4ee5\u8fd9\u91cc\u6211\u518d\u7528mkfs.xfs\u547d\u4ee4\u683c\u5f0f\u5316\u4e00\u6b21\u5c31\u4e00\u6837\u4e86\u3002<\/span><\/p>\n<ul>\n<li><span style=\"font-family: 'comic sans ms', sans-serif;\">mkfs.xfs\uff08\u6587\u4ef6\u7cfb\u7edf\u683c\u5f0f\uff09<\/span><\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">[root@localhost ~]# mkfs &lt;Tab&gt;&lt;Tab&gt;\r\nmkfs         mkfs.btrfs   mkfs.cramfs  mkfs.ext2    mkfs.ext3    mkfs.ext4    mkfs.fat     mkfs.minix   mkfs.msdos   mkfs.vfat    mkfs.xfs\r\n[root@localhost ~]# mkfs.xfs \/dev\/sdb1\r\nmeta-data=\/dev\/sdb1              isize=512    agcount=4, agsize=655232 blks\r\n         =                       sectsz=512   attr=2, projid32bit=1\r\n         =                       crc=1        finobt=0, sparse=0\r\ndata     =                       bsize=4096   blocks=2620928, imaxpct=25\r\n         =                       sunit=0      swidth=0 blks\r\nnaming   =version 2              bsize=4096   ascii-ci=0 ftype=1\r\nlog      =internal log           bsize=4096   blocks=2560, version=2\r\n         =                       sectsz=512   sunit=0 blks, lazy-count=1\r\nrealtime =none                   extsz=4096   blocks=0, rtextents=0\r\n[root@localhost ~]#<\/pre>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">tips\uff1a\u4f7f\u7528&lt;Tab&gt;\u6309\u952e\u53ef\u4ee5\u663e\u793a\u53ef\u9009\u9879\u5e76\u8865\u9f50\u547d\u4ee4\uff0c\u6839\u636e\u9700\u8981\u9009\u62e9\u5373\u53ef\u3002<\/span><\/p>\n<h1><span style=\"font-family: 'comic sans ms', sans-serif;\">5.\u4e34\u65f6\u6302\u8f7d<\/span><\/h1>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">\u8fd9\u91cc\u6211\u4f7f\u7528UUID\u8fdb\u884c\u6302\u8f7d\uff0c\u8fd9\u6837\u6700\u7a33\u59a5\u3002<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">[root@localhost ~]# mkdir \/home\/mydisk2\r\n[root@localhost ~]# mount UUID=\"52419cb5-1bc4-45d8-b831-16eef52b20d1\" \/home\/mydisk2\r\n[root@localhost ~]# df -h\r\n\u6587\u4ef6\u7cfb\u7edf                 \u5bb9\u91cf  \u5df2\u7528  \u53ef\u7528 \u5df2\u7528% \u6302\u8f7d\u70b9\r\ndevtmpfs                 979M     0  979M    0% \/dev\r\ntmpfs                    990M     0  990M    0% \/dev\/shm\r\ntmpfs                    990M  9.6M  981M    1% \/run\r\ntmpfs                    990M     0  990M    0% \/sys\/fs\/cgroup\r\n\/dev\/mapper\/centos-root   17G  1.3G   16G    8% \/\r\n\/dev\/sda2               1014M  130M  885M   13% \/boot\r\n\/dev\/sda1                200M   12M  189M    6% \/boot\/efi\r\ntmpfs                    198M     0  198M    0% \/run\/user\/0\r\n\/dev\/sdb1                 10G   33M   10G    1% \/home\/mydisk2\r\n[root@localhost ~]#<\/pre>\n<h1><span style=\"font-family: 'comic sans ms', sans-serif;\">6.\u6c38\u4e45\u6302\u8f7d<\/span><\/h1>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">#\u7f16\u8f91 \/etc\/fstab \u6587\u4ef6\r\nvi \/etc\/fstab\r\n#\u5728\u6587\u672c\u6700\u540e\u4e00\u884c\u6dfb\u52a0\u5982\u4e0b\u547d\u4ee4\u5373\u53ef\r\nUUID=\"52419cb5-1bc4-45d8-b831-16eef52b20d1\" \/home\/mydisk2 xfs defaults 0 0\r\n#\u4fdd\u5b58\u5e76\u9000\u51fa\r\n#\u68c0\u67e5\u547d\u4ee4\u662f\u5426\u6b63\u786e\uff0c\u65e0\u62a5\u9519\u5219\u6b63\u5e38\u3002\r\n#mount -a<\/pre>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">\u91cd\u542f\u6d4b\u8bd5\u662f\u5426\u6302\u8f7d\u6210\u529f\u5373\u53ef\u3002<\/span><\/p>\n<hr \/>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">XFS\u6269\u5bb9\u5237\u65b0\u547d\u4ee4\uff1a<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">xfs_growfs \/dev\/centos\/root<\/pre>\n<p><span style=\"font-family: 'comic sans ms', sans-serif;\">end&#8230;<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7075\u6d3b\u5bf9centos7\u7cfb\u7edf\u8fdb\u884c\u5206\u533a\uff0c\u4ee5\u7075\u6d3b\u5e94\u5bf9\u4e0d\u540c\u9700\u6c42\u3002 \u4e3b\u8981\u6d41\u7a0b\u4e3a\uff1a\u67e5\u770b\u76ee\u524d\u7cfb\u7edf\u78c1\u76d8\u72b6\u6001&#8211;&gt;\u521b\u5efa\u5e76\u6dfb\u52a0\u5206\u533a\u8868\u7c7b\u578b\uff08MBR\/GPT\uff09&#8211;&gt;\u81ea\u5b9a\u4e49\u5206\u533a\u5927\u5c0f&#8211;&gt;\u683c\u5f0f\u5316\u5206\u533a\u5e76\u9009\u62e9\u6587\u4ef6\u7cfb\u7edf\u7c7b\u578b\uff08xfs\uff09&#8211;&gt;\u6302\u8f7d\u78c1\u76d8&#8211;&gt;\u8bbe\u7f6e\u6c38\u4e45\u6302\u8f7d 1.\u51c6\u5907\u73af &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"\u3010\u7cfb\u7edf\u64cd\u4f5c\u3011centos7 \u5206\u533a\u7ba1\u7406\" class=\"read-more button\" href=\"https:\/\/blog.kingsbestone.com\/?p=2205#more-2205\" aria-label=\"\u66f4\u591a \u3010\u7cfb\u7edf\u64cd\u4f5c\u3011centos7 \u5206\u533a\u7ba1\u7406\">\u67e5\u770b\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":212,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[59,4],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=\/wp\/v2\/posts\/2205"}],"collection":[{"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2205"}],"version-history":[{"count":10,"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=\/wp\/v2\/posts\/2205\/revisions"}],"predecessor-version":[{"id":2531,"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=\/wp\/v2\/posts\/2205\/revisions\/2531"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=\/wp\/v2\/media\/212"}],"wp:attachment":[{"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kingsbestone.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}