{"id":36428,"date":"2024-11-26T13:32:44","date_gmt":"2024-11-26T05:32:44","guid":{"rendered":"https:\/\/fwq.ai\/blog\/36428\/"},"modified":"2024-11-26T13:32:44","modified_gmt":"2024-11-26T05:32:44","slug":"%e8%af%a6%e8%a7%a3%ef%bc%9ahyper-v%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e6%95%b0%e6%8d%ae%e7%a3%81%e7%9b%98%e6%89%a9%e5%ae%b9","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/36428\/","title":{"rendered":"\u8be6\u89e3\uff1aHyper-V\u865a\u62df\u4e3b\u673a\u6570\u636e\u78c1\u76d8\u6269\u5bb9"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/887\/227\/172682139195893.jpg\" class=\"aligncenter\" title=\"\u8be6\u89e3\uff1aHyper-V\u865a\u62df\u4e3b\u673a\u6570\u636e\u78c1\u76d8\u6269\u5bb9\u63d2\u56fe\" alt=\"\u8be6\u89e3\uff1aHyper-V\u865a\u62df\u4e3b\u673a\u6570\u636e\u78c1\u76d8\u6269\u5bb9\u63d2\u56fe\" \/><\/p>\n<p>\u4e00\u76f4\u4ee5\u6765\u5bf9Hyper-V Linux\u865a\u62df\u4e3b\u673a\u7684\u78c1\u76d8\u6269\u5bb9\u56f0\u6270\uff0c\u4eca\u5929\u5c06\u4ecb\u7ecd\u5982\u4f55\u5229\u7528 fdisk \u548c resize2fs \u8fdb\u884c\u6570\u636e\u78c1\u76d8\u6269\u5bb9\u3002<\/p>\n<p>\u60c5\u51b5\u8bf4\u660e\uff1a<\/p>\n<p>\u5bbf\u4e3b\u673a\u7cfb\u7edf\uff1aWindwos Server 2012 R2 Hyper-V<\/p>\n<p>\u865a\u62df\u4e3b\u673a\uff1aCentOS Linux release 7.4.1708 (Core)<\/p>\n<p>\u5e73\u65f6\u63a5\u89e6Hyper-V\u8f83\u591a\uff0c\u6240\u4ee5\u5bf9\u78c1\u76d8\u6269\u5bb9\u90a3\u662f\u5e38\u6709\u7684\u4e8b\u3002Windwos\u78c1\u76d8\u6269\u5bb9\u6700\u7b80\u5355\uff0c\u672c\u6587\u5c31\u4e0d\u591a\u4ecb\u7ecd\u4e86\u3002<\/p>\n<p>\u4eca\u5929\u6211\u5c06\u4ee5Centos\u865a\u62df\u4e3b\u673a\u8fdb\u884c\u6f14\u793a\uff0c\u8be5\u5c0f\u673a\u5206\u4e3a\u4e24\u5757\u78c1\u76d8\uff08\u90fd\u662f\u72ec\u7acb\u78c1\u76d8\uff09\uff0c\u4e00\u5757\u662f\u7cfb\u7edf\u76d8\/dev\/sda\uff0c\u53e6\u4e00\u5757\u662f\u6570\u636e\u5e93\u76d8\/dev\/sdb\uff0c\u73b0\u5728\u7684\u9700\u6c42\u662fsdb\u9700\u8981\u5728\u4e0d\u5f71\u54cd\u6570\u636e\u7684\u60c5\u51b5\u4e0b\u4ece\u539f\u6765\u768430GB\u6269\u5bb9\u4e3a100GB\u3002<\/p>\n<p><span style=\"color:#1E1E1E;letter-spacing: 2px;border-left:#FF3030 3px solid;border-right:#FF3030 3px solid;padding-left: 8px;padding-right:8px;font-size: 12pt\"><strong>\u6269\u5bb9\u524d\u5148\u67e5\u770b\u78c1\u76d8\u5206\u533a\u53ca\u6302\u8f7d\u60c5\u51b5<\/strong><\/span>   <\/p>\n<pre>\n[root@renwole-com ~]# fdisk -l\n\nDisk \/dev\/sdb: 32.2 GB, 32212254720 bytes, 62914560 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 4096 bytes\nI\/O size (minimum\/optimal): 4096 bytes \/ 4096 bytes\nDisk label type: dos\nDisk identifier: 0x5f149419\n\n   Device Boot      Start         End      Blocks   Id  System\n\/dev\/sdb1            2048    62914559    31456256   83  Linux\n\nDisk \/dev\/sda: 10.7 GB, 10737418240 bytes, 20971520 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 4096 bytes\nI\/O size (minimum\/optimal): 4096 bytes \/ 4096 bytes\nDisk label type: dos\nDisk identifier: 0x00043041\n\n   Device Boot      Start         End      Blocks   Id  System\n\/dev\/sda1   *        2048     2099199     1048576   83  Linux\n\/dev\/sda2         2099200    20971519     9436160   8e  Linux LVM\n\nDisk \/dev\/mapper\/cl-root: 8585 MB, 8585740288 bytes, 16769024 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 4096 bytes\nI\/O size (minimum\/optimal): 4096 bytes \/ 4096 bytes\n\n\nDisk \/dev\/mapper\/cl-swap: 1073 MB, 1073741824 bytes, 2097152 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 4096 bytes\nI\/O size (minimum\/optimal): 4096 bytes \/ 4096 bytes\n\n[root@renwole-com ~]# df -hT\nFilesystem          Type      Size  Used Avail Use% Mounted on\n\/dev\/mapper\/cl-root xfs       8.0G  950M  7.1G  12% \/\ndevtmpfs            devtmpfs  1.9G     0  1.9G   0% \/dev\ntmpfs               tmpfs     1.9G     0  1.9G   0% \/dev\/shm\ntmpfs               tmpfs     1.9G  8.3M  1.9G   1% \/run\ntmpfs               tmpfs     1.9G     0  1.9G   0% \/sys\/fs\/cgroup\n\/dev\/sda1           xfs      1014M  138M  877M  14% \/boot\ntmpfs               tmpfs     379M     0  379M   0% \/run\/user\/0\n\/dev\/sdb1           ext4       30G   60M   28G   1% \/apps\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u6ce8\u610f\uff1a\u6a59\u8272\u90e8\u5206 \/dev\/sdb1 \u5206\u533a\u5927\u5c0f\u662f30GB\uff0c\u6302\u8f7d\u7684\u4e5f\u662f30GB\u3002<\/p>\n<p><span style=\"color:#1E1E1E;letter-spacing: 2px;border-left:#FF3030 3px solid;border-right:#FF3030 3px solid;padding-left: 8px;padding-right:8px;font-size: 12pt\"><strong>\u5378\u8f7d\u6302\u8f7d<\/strong><\/span>  <\/p>\n<p>\u5220\u9664 \/etc\/fstab \u6587\u4ef6\u4e2d\u4ee5\u4e0b\u5f00\u673a\u78c1\u76d8\u81ea\u52a8\u6302\u8f7d\u4fe1\u606f\uff1a<\/p>\n<pre>\n\/dev\/sdb1 \/apps ext4 defaults 0 0\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236<br \/>\n<span style=\"color:#1E1E1E;letter-spacing: 2px;border-left:#FF3030 3px solid;border-right:#FF3030 3px solid;padding-left: 8px;padding-right:8px;font-size: 12pt\"><strong>\u5f00\u59cb\u865a\u62df\u4e3b\u673a\u78c1\u76d8\u6269\u5bb9<\/strong><\/span>  <\/p>\n<p>Hyper-V\u865a\u673a\u64cd\u4f5c\uff1a<\/p>\n<p>\u6253\u5f00Hyper-V \u7ba1\u7406\u5668\uff0c\u627e\u5230\u9700\u8981\u6269\u5bb9\u7684\u5c0f\u673a\u5e76\u5173\u673a\uff0c\u7136\u540e\u53f3\u51fb\u8bbe\u7f6e\uff0c\u70b9\u51fb\u9700\u8981\u6269\u5bb9\u7684\u78c1\u76d8\uff0c\uff08\u4e00\u822c\u662f\u6570\u636e\u76d8\uff09\u7f16\u8f91 \u2013 \u9ed8\u8ba4\u4e0b\u4e00\u6b65 \u2013 \u9009\u62e9\u6269\u5c55\u4e0b\u4e00\u6b65\uff0c\u8fd9\u4e00\u6b65\u9aa4\u9700\u8981\u6ce8\u610f\uff0c\u5047\u8bbe\u4f60\u539f\u6709\u78c1\u76d8\u4e3a30G\uff0c\u90a3\u4e48\u4f60\u60f3\u6269\u5c55\u5230100G\uff0c\u8bf7\u586b\u5199100\u5373\u53ef\uff0c\u70b9\u51fb\u4e0b\u4e00\u6b65\u5b8c\u6210\u3002\u7136\u540e\u542f\u52a8\u865a\u62df\u4e3b\u673a\u3002<\/p>\n<p>\u67e5\u770b\u6269\u5bb9\u540e\u7684\u78c1\u76d8\u5206\u533a\u60c5\u51b5\uff1a<\/p>\n<pre>\n[root@renwole-com ~]# fdisk -l\n\nDisk \/dev\/sda: 10.7 GB, 10737418240 bytes, 20971520 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 4096 bytes\nI\/O size (minimum\/optimal): 4096 bytes \/ 4096 bytes\nDisk label type: dos\nDisk identifier: 0x00043041\n\n   Device Boot      Start         End      Blocks   Id  System\n\/dev\/sda1   *        2048     2099199     1048576   83  Linux\n\/dev\/sda2         2099200    20971519     9436160   8e  Linux LVM\n\nDisk \/dev\/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 4096 bytes\nI\/O size (minimum\/optimal): 4096 bytes \/ 4096 bytes\nDisk label type: dos\nDisk identifier: 0x5f149419\n\n   Device Boot      Start         End      Blocks   Id  System\n\/dev\/sdb1            2048    62914559    31456256   83  Linux\n\nDisk \/dev\/mapper\/cl-root: 8585 MB, 8585740288 bytes, 16769024 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 4096 bytes\nI\/O size (minimum\/optimal): 4096 bytes \/ 4096 bytes\n\n\nDisk \/dev\/mapper\/cl-swap: 1073 MB, 1073741824 bytes, 2097152 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 4096 bytes\nI\/O size (minimum\/optimal): 4096 bytes \/ 4096 bytes\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>sdb\u5206\u533a\u5927\u5c0f\u7531\u539f\u6765\u768430GB\u6269\u5c55\u5230100GB\u4e86\uff0c\u4f46\u5206\u533asdb1\u5e76\u6ca1\u6709\u4f7f\u7528\u6269\u5bb9\u768470GB\u7a7a\u95f4\uff0c\u600e\u4e48\u529e\u5462\uff1f<\/p>\n<p><span style=\"color:#1E1E1E;letter-spacing: 2px;border-left:#FF3030 3px solid;border-right:#FF3030 3px solid;padding-left: 8px;padding-right:8px;font-size: 12pt\"><strong>\u5220\u9664\u5206\u533a<\/strong><\/span>  <\/p>\n<p>\u5220\u9664\u5206\u533a\u4e0d\u540c\u7b49\u5220\u9664\u6570\u636e\uff0c\u5220\u9664\u5206\u533a\u518d\u91cd\u5efa\uff1a<\/p>\n<pre>\n[root@renwole-com ~]# fdisk \/dev\/sdb\n\nThe device presents a logical sector size that is smaller than\nthe physical sector size. Aligning to a physical sector (or optimal\nI\/O) size boundary is recommended, or performance may be impacted.\nWelcome to fdisk (util-linux 2.23.2).\n\nChanges will remain in memory only, until you decide to write them.\nBe careful before using the write command.\n\n\nCommand (m for help): d                 # \u5220\u9664sdb1\u5206\u533a\nSelected partition 1\nPartition 1 is deleted\n\nCommand (m for help): n\t\t\t# \u65b0\u5efa\u5206\u533a\nPartition type:\n   p   primary (0 primary, 0 extended, 4 free)\n   e   extended\nSelect (default p): p\nPartition number (1-4, default 1): 1\t# \u6307\u5b9a\u5206\u533a\u53f7\nFirst sector (2048-209715199, default 2048):\nUsing default value 2048\nLast sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199):\nUsing default value 209715199\nPartition 1 of type Linux and of size 100 GiB is set\n\nCommand (m for help): w                 # \u8f93\u5165w\u4fdd\u5b58\nThe partition table has been altered!\n\nCalling ioctl() to re-read partition table.\nSyncing disks.\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u518d\u6b21\u67e5\u770b\u78c1\u76d8\u5206\u533a\u60c5\u51b5<\/p>\n<pre>\n[root@renwole-com ~]# fdisk -l\n...\nDisk \/dev\/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors\nUnits = sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 4096 bytes\nI\/O size (minimum\/optimal): 4096 bytes \/ 4096 bytes\nDisk label type: dos\nDisk identifier: 0x5f149419\n\n   Device Boot      Start         End      Blocks   Id  System\n\/dev\/sdb1            2048   209715199   104856576   83  Linux\n...\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5df2\u7ecf\u4ece\u539f\u6765\u768430G\u6269\u5c55\u6210100G\u4e86\uff0c\u4f46\u73b0\u5728\u8fd8\u4e0d\u80fd\u4f7f\u7528\uff0c\u9700\u8981\u8fdb\u884c\u5982\u4e0b\u64cd\u4f5c\u624d\u7b97\u771f\u6b63\u6269\u5bb9\u6210\u529f\uff1a<\/p>\n<pre>\n[root@renwole-com ~]# resize2fs -f \/dev\/sdb1\nresize2fs 1.42.9 (28-Dec-2013)\nResizing the filesystem on \/dev\/sdb1 to 26214144 (4k) blocks.\nThe filesystem on \/dev\/sdb1 is now 26214144 blocks long.\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u6269\u5bb9\u6210\u529f\u3002<\/p>\n<p><span style=\"color:#1E1E1E;letter-spacing: 2px;border-left:#FF3030 3px solid;border-right:#FF3030 3px solid;padding-left: 8px;padding-right:8px;font-size: 12pt\"><strong>\u6302\u8f7d\u78c1\u76d8<\/strong><\/span>   <\/p>\n<pre>\n[root@renwole-com ~]# mount \/dev\/sdb1 \/apps\/\n[root@renwole-com ~]# df -hT\nFilesystem          Type      Size  Used Avail Use% Mounted on\n\/dev\/mapper\/cl-root xfs       8.0G  950M  7.1G  12% \/\ndevtmpfs            devtmpfs  1.9G     0  1.9G   0% \/dev\ntmpfs               tmpfs     1.9G     0  1.9G   0% \/dev\/shm\ntmpfs               tmpfs     1.9G  8.3M  1.9G   1% \/run\ntmpfs               tmpfs     1.9G     0  1.9G   0% \/sys\/fs\/cgroup\n\/dev\/sda1           xfs      1014M  138M  877M  14% \/boot\ntmpfs               tmpfs     379M     0  379M   0% \/run\/user\/0\n\/dev\/sdb1           ext4       99G   60M   94G   1% \/apps\n[root@renwole-com ~]# ls \/apps\/\nweb  mysql\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5982\u4e0a\u6240\u793a\uff0cLinux\u865a\u62df\u4e3b\u673a\u6570\u636e\u76d8\u5df2\u7ecf\u6210\u529f\u6269\u5bb9\uff0c\u67e5\u770b\u6570\u636e\u5e76\u65e0\u4e22\u5931\u3002<\/p>\n<p>\u53e6\u5916\u518d\u6b21\u5c06\u4f60\u7684\u78c1\u76d8\u4fe1\u606f\u5199\u5165\u5230 \/etc\/fstab \u6587\u4ef6\u4e2d\uff0c\u4e0d\u7136\u91cd\u542f\u540e\u78c1\u76d8\u8fd8\u9700\u8981\u624b\u52a8\u6302\u8f7d\u3002<\/p>\n<p>\u6ce8\u610f\uff1a\u8fd8\u662f\u90a3\u53e5\u8bdd\uff0c\u64cd\u4f5c\u4efb\u4f55\u6570\u636e\u4e4b\u524d\uff0c\u4e00\u5b9a\u8981\u5148\u5907\u4efd\uff0c\u517b\u6210\u826f\u597d\u7684\u4e60\u60ef\uff0c\u4ee5\u9632\u6b62\u6570\u636e\u4e22\u5931\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u8be6\u89e3\uff1aHyper-V\u865a\u62df\u4e3b\u673a\u6570\u636e\u78c1\u76d8\u6269\u5bb9\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u76f4\u4ee5\u6765\u5bf9Hyper-V Linux\u865a\u62df\u4e3b\u673a\u7684\u78c1\u76d8\u6269\u5bb9\u56f0\u6270\uff0c\u4eca\u5929\u5c06\u4ecb\u7ecd\u5982\u4f55\u5229\u7528 fdisk \u548c resize2fs \u8fdb\u884c\u6570\u636e\u78c1\u76d8\u6269\u5bb9\u3002 \u60c5\u51b5\u8bf4\u660e\uff1a \u5bbf\u4e3b\u673a\u7cfb\u7edf\uff1aWindwos Server 2012 R2 Hyper-V \u865a\u62df\u4e3b\u673a\uff1aCentOS Linux release 7.4.1708 (Core) \u5e73\u65f6\u63a5\u89e6Hyper-V\u8f83\u591a\uff0c\u6240\u4ee5\u5bf9\u78c1\u76d8\u6269\u5bb9\u90a3\u662f\u5e38\u6709\u7684\u4e8b\u3002Windwos\u78c1\u76d8\u6269\u5bb9\u6700\u7b80\u5355\uff0c\u672c\u6587\u5c31\u4e0d\u591a\u4ecb\u7ecd\u4e86\u3002 \u4eca\u5929\u6211\u5c06\u4ee5Centos\u865a\u62df\u4e3b\u673a\u8fdb\u884c\u6f14\u793a\uff0c\u8be5\u5c0f\u673a\u5206\u4e3a\u4e24\u5757\u78c1\u76d8\uff08\u90fd\u662f\u72ec\u7acb\u78c1\u76d8\uff09\uff0c\u4e00\u5757\u662f\u7cfb\u7edf\u76d8\/dev\/sda\uff0c\u53e6\u4e00\u5757\u662f\u6570\u636e\u5e93\u76d8\/dev\/sdb\uff0c\u73b0\u5728\u7684\u9700\u6c42\u662fsdb\u9700\u8981\u5728\u4e0d\u5f71\u54cd\u6570\u636e\u7684\u60c5\u51b5\u4e0b\u4ece\u539f\u6765\u768430GB\u6269\u5bb9\u4e3a100GB\u3002 \u6269\u5bb9\u524d\u5148\u67e5\u770b\u78c1\u76d8\u5206\u533a\u53ca\u6302\u8f7d\u60c5\u51b5 [root@renwole-com ~]# fdisk -l Disk \/dev\/sdb: 32.2 GB, 32212254720 bytes, 62914560 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical\/physical): 512 bytes \/ 4096 bytes I\/O size (minimum\/optimal): 4096 bytes [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-36428","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/36428","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=36428"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/36428\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=36428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=36428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=36428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}