{"id":1014,"date":"2014-08-13T00:21:59","date_gmt":"2014-08-12T16:21:59","guid":{"rendered":"https:\/\/cowman-chiang.no-ip.org\/wordpress\/?p=1014"},"modified":"2019-06-20T10:24:41","modified_gmt":"2019-06-20T02:24:41","slug":"resize-virtual-disk-vmware-esxi-4-1-centos-5-5-x86","status":"publish","type":"post","link":"https:\/\/cowmanchiang.me\/wp\/?p=1014","title":{"rendered":"Resize Virtual Disk &#8211; VMware ESXi 4.1 &#038; CentOS 5.5 x86"},"content":{"rendered":"<ol>\n<li>\n<p>\u4f7f\u7528vSphere Client\u767b\u5165\u8abf\u6574\u786c\u9ad4\u7684\u8a2d\u5b9a\uff0c\u5c07\u786c\u789f\u7a7a\u9593\u589e\u5927 (\u753120G -> 80G)<br \/>\n<a href=\"wp-content\/uploads\/2014\/08\/20140813.png\"><img loading=\"lazy\" decoding=\"async\" src=\"wp-content\/uploads\/2014\/08\/20140813.png\" alt=\"20140813\" width=\"690\" height=\"615\" class=\"aligncenter size-full wp-image-1015\" srcset=\"https:\/\/cowmanchiang.me\/wp\/wp-content\/uploads\/2014\/08\/20140813.png 690w, https:\/\/cowmanchiang.me\/wp\/wp-content\/uploads\/2014\/08\/20140813-300x267.png 300w\" sizes=\"auto, (max-width: 690px) 100vw, 690px\" \/><\/a><\/p>\n<\/li>\n<li>\n<p>\u5c07VM Guest\u91cd\u958b\u6a5f<\/p>\n<\/li>\n<li>\n<p>\u4ee5ssh\u767b\u5165VM Guest<\/p>\n<\/li>\n<li>\n<p>\u8f38\u5165fdisk -l\u53d6\u5f97\u76ee\u524d\u78c1\u789f\u8cc7\u8a0a<\/p>\n<\/li>\n<\/ol>\n<pre lang=\"bash\">[root@localhost ~]# fdisk -l\n\nDisk \/dev\/sda: 85.8 GB, 85899345920 bytes\n255 heads, 63 sectors\/track, 10443 cylinders\nUnits = cylinders of 16065 * 512 = 8225280 bytes\n\n   Device Boot      Start         End      Blocks   Id  System\n\/dev\/sda1   *           1          13      104391   83  Linux\n\/dev\/sda2              14        2610    20860402+  8e  Linux LVM<\/pre>\n<ol>\n<li>\u6839\u64da4\u56de\u50b3\u7684\u8cc7\u8a0a\uff0c\u8f38\u5165fdisk \/dev\/sda<\/li>\n<\/ol>\n<pre lang=\"bash\">[root@localhost ~]# fdisk \/dev\/sda\n\nThe number of cylinders for this disk is set to 10443.\nThere is nothing wrong with that, but this is larger than 1024,\nand could in certain setups cause problems with:\n1) software that runs at boot time (e.g., old versions of LILO)\n2) booting and partitioning software from other OSs\n   (e.g., DOS FDISK, OS\/2 FDISK)\n\nCommand (m for help):<\/pre>\n<p>[\u5099\u8a3b]<br \/>\nCommand action<br \/>\n   a   toggle a bootable flag<br \/>\n   b   edit bsd disklabel<br \/>\n   c   toggle the dos compatibility flag<br \/>\n   d   delete a partition<br \/>\n   l   list known partition types<br \/>\n   m   print this menu<br \/>\n   n   add a new partition<br \/>\n   o   create a new empty DOS partition table<br \/>\n   p   print the partition table<br \/>\n   q   quit without saving changes<br \/>\n   s   create a new empty Sun disklabel<br \/>\n   t   change a partition&#8217;s system id<br \/>\n   u   change display\/entry units<br \/>\n   v   verify the partition table<br \/>\n   w   write table to disk and exit<br \/>\n   x   extra functionality (experts only)<\/p>\n<ol>\n<li>\u8f38\u5165 p \u53d6\u5f97\u76ee\u524d\u7684\u8cc7\u8a0a<\/li>\n<\/ol>\n<pre lang=\"bash\">Command (m for help): p\n\nDisk \/dev\/sda: 85.8 GB, 85899345920 bytes\n255 heads, 63 sectors\/track, 10443 cylinders\nUnits = cylinders of 16065 * 512 = 8225280 bytes\n\n   Device Boot      Start         End      Blocks   Id  System\n\/dev\/sda1   *           1          13      104391   83  Linux\n\/dev\/sda2              14        2610    20860402+  8e  Linux LVM<\/pre>\n<ol>\n<li>\u8f38\u5165 n \u5275\u5efa\u65b0\u7684partition\uff0c\u63a5\u8457\u6309\u5169\u4e0bEnter\uff0c\u4ee5\u4f7f\u7528\u6700\u5c0f\u53ca\u6700\u5927\u7684\u6578\u503c (\u4f7f\u7528\u5b8c\u6574\u7684free\u7a7a\u9593)<\/li>\n<\/ol>\n<pre lang=\"bash\">Command (m for help): n\nCommand action\n   e   extended\n   p   primary partition (1-4)\np\nPartition number (1-4): 3\nFirst cylinder (2611-10443, default 2611): \nUsing default value 2611\nLast cylinder or +size or +sizeM or +sizeK (2611-10443, default 10443): \nUsing default value 10443 <\/pre>\n<ol>\n<li>\u8f38\u5165 t \u66f4\u6539\u7cfb\u7d71ID\uff0c\u9078\u64c7\u7b2c3\u500bpartition\uff0c\u76f4\u63a5\u8f38\u51658e<\/li>\n<\/ol>\n<pre lang=\"bash\">Command (m for help): t\nPartition number (1-4): 3\nHex code (type L to list codes): 8e\nChanged system type of partition 3 to 8e (Linux LVM)<\/pre>\n<ol>\n<li>\u8f38\u5165 w \u5c07\u8a2d\u5b9a\u5beb\u5165\u786c\u789f<\/li>\n<\/ol>\n<pre lang=\"bash\">Command (m for help): w\nThe partition table has been altered!\n\nCalling ioctl() to re-read partition table.\n\nWARNING: Re-reading the partition table failed with error 16: \u88dd\u7f6e\u6216\u7cfb\u7d71\u8cc7\u6e90\u5fd9\u788c\u4e2d.\nThe kernel still uses the old table.\nThe new table will be used at the next reboot.\nSyncing disks.<\/pre>\n<ol>\n<li>\n<p>\u5c07 VM Guest \u91cd\u65b0\u958b\u6a5f<\/p>\n<\/li>\n<li>\n<p>\u8f38\u5165 fdisk -l \u53ef\u4ee5\u770b\u5230\u525b\u525b\u65b0\u589e\u7684sda3<br \/>\n&lt;\/pre lang=&#8221;bash&#8221;>[root@localhost ~]# fdisk -l<\/p>\n<\/li>\n<\/ol>\n<p>Disk \/dev\/sda: 85.8 GB, 85899345920 bytes<br \/>\n255 heads, 63 sectors\/track, 10443 cylinders<br \/>\nUnits = cylinders of 16065 * 512 = 8225280 bytes<\/p>\n<p>Device Boot      Start         End      Blocks   Id  System<br \/>\n\/dev\/sda1   *           1          13      104391   83  Linux<br \/>\n\/dev\/sda2              14        2610    20860402+  8e  Linux LVM<br \/>\n\/dev\/sda3            2611       10443    62918572+  8e  Linux LVM<\/p>\n<ol>\n<li>\u4f7f\u7528 pvcreate \u5275\u5efa volume<\/li>\n<\/ol>\n<pre lang=\"bash\">[root@localhost ~]# pvcreate \/dev\/sda3 \n  dev_is_mpath: failed to get device for 8:3\n  Writing physical volume data to disk \"\/dev\/sda3\"\n  Physical volume \"\/dev\/sda3\" successfully created<\/pre>\n<ol>\n<li>\u4f7f\u7528 vgextend \u5c07 sda3 \u52a0\u5165 VolGroup00<\/li>\n<\/ol>\n<pre lang=\"bash\">[root@localhost ~]# vgextend VolGroup00 \/dev\/sda3 \n  Volume group \"VolGroup00\" successfully extended<\/pre>\n<ol>\n<li>\u4f7f\u7528 vgdisplay \u67e5\u8a62 VolGroup00 \u672a\u4f7f\u7528\u7684\u7a7a\u9593\u70ba 60G<\/li>\n<\/ol>\n<pre lang=\"bash\">[root@localhost ~]# vgdisplay VolGroup00 | grep \"Free\"\n  Free  PE \/ Size       1920 \/ 60.00 GB<\/pre>\n<ol>\n<li>\u4f7f\u7528 lvextend \u589e\u52a0\u7a7a\u9593 (\u5f9e14\u53ef\u4ee5\u5f97\u77e5\u70ba60G)<\/li>\n<\/ol>\n<pre lang=\"bash\">[root@localhost ~]# lvextend -L+60G \/dev\/VolGroup00\/LogVol00\n  Extending logical volume LogVol00 to 77.88 GB\n  Logical volume LogVol00 successfully resized<\/pre>\n<ol>\n<li>\u4f7f\u7528 resize2fs \u4fee\u6539\u5206\u5272\u5340\u5927\u5c0f<\/li>\n<\/ol>\n<pre lang=\"bash\">[root@localhost ~]# resize2fs \/dev\/VolGroup00\/LogVol00\nresize2fs 1.39 (29-May-2006)\nFilesystem at \/dev\/VolGroup00\/LogVol00 is mounted on \/; on-line resizing required\nPerforming an on-line resize of \/dev\/VolGroup00\/LogVol00 to 20414464 (4k) blocks.\n\nThe filesystem on \/dev\/VolGroup00\/LogVol00 is now 20414464 blocks long.<\/pre>\n<ol>\n<li>\u8f38\u5165 df -h \u9a57\u8b49\u6709\u6c92\u6709\u6210\u529f<\/li>\n<\/ol>\n<pre lang=\"bash\">[root@localhost ~]# df -h\n\u6a94\u6848\u7cfb\u7d71              \u5bb9\u91cf  \u5df2\u7528 \u53ef\u7528 \u5df2\u7528% \u639b\u8f09\u9ede\n\/dev\/mapper\/VolGroup00-LogVol00\n                       76G   14G   58G  20% \/\n\/dev\/sda1              99M   13M   82M  14% \/boot\ntmpfs                 506M     0  506M   0% \/dev\/shm<\/pre>\n<p><a href=\"http:\/\/kb.vmware.com\/selfservice\/search.do?cmd=displayKC&#038;docType=kc&#038;docTypeID=DT_KB_1_1&#038;externalId=1006371\" title=\"Extending a logical volume in a virtual machine running Red Hat or Cent OS (1006371)\">\u53c3\u8003\u8cc7\u8a0a: Extending a logical volume in a virtual machine running Red Hat or Cent OS (1006371)<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528vSphere Client\u767b\u5165\u8abf\u6574\u786c\u9ad4\u7684\u8a2d\u5b9a\uff0c\u5c07\u786c\u789f\u7a7a\u9593\u589e\u5927 (\u753120G -> 80G) \u5c07VM Guest\u91cd\u958b\u6a5f \u4ee5ssh\u767b\u5165VM Guest \u8f38\u5165fdisk -l\u53d6\u5f97\u76ee\u524d\u78c1\u789f\u8cc7\u8a0a [root@localhost ~]# fdisk -l Disk \/dev\/sda: 85.8 GB, 85899345920 bytes 255 heads, 63 sectors\/track, 10443 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start &hellip; <a href=\"https:\/\/cowmanchiang.me\/wp\/?p=1014\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[93,14],"tags":[],"class_list":["post-1014","post","type-post","status-publish","format-standard","hentry","category-centos","category-vmware"],"_links":{"self":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1014","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1014"}],"version-history":[{"count":1,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1014\/revisions"}],"predecessor-version":[{"id":2033,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1014\/revisions\/2033"}],"wp:attachment":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}