加入收藏 | 设为首页 | 会员中心 | 我要投稿 济南站长网 (https://www.0531zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 空间 > 正文

虚拟机磁盘逻辑卷如何扩容

发布时间:2018-10-07 01:34:45 所属栏目:空间 来源:gnix
导读:副标题#e# 技术沙龙 | 邀您于8月25日与国美/AWS/转转三位专家共同探讨小程序电商实战 在esx server上安装虚拟机时,由于只分配了默认的8GB磁盘空间。空间不太够,所以在虚拟机上把分配磁盘空间扩大的20GB。在esx server上扩容磁盘空间的方法很简单,在此不
副标题[/!--empirenews.page--] 技术沙龙 | 邀您于8月25日与国美/AWS/转转三位专家共同探讨小程序电商实战

在esx server上安装虚拟机时,由于只分配了默认的8GB磁盘空间。空间不太够,所以在虚拟机上把分配磁盘空间扩大的20GB。在esx server上扩容磁盘空间的方法很简单,在此不提,下面具体说说如何把该扩容的磁盘空间在虚拟机上应用上去。

虚拟机磁盘逻辑卷如何扩容

以下是未扩容前的状态:

  1. [root@localhost ~]# fdisk -l 
  2.  
  3. Disk /dev/sda: 21.4 GB, 21474836480 bytes 
  4.  
  5. 255 heads, 63 sectors/track, 2610 cylinders 
  6.  
  7. Units = cylinders of 16065 * 512 = 8225280 bytes 
  8.  
  9.    Device Boot      Start         End      Blocks   Id  System 
  10.  
  11. /dev/sda1   *           1          13      104391   83  Linux 
  12.  
  13. /dev/sda2              14        1044     8281507+  8e  Linux LVM 
  14.  
  15.   
  16.  
  17. [root@localhost ~]# df -h 
  18.  
  19. Filesystem            Size  Used Avail Use% Mounted on 
  20.  
  21. /dev/mapper/VolGroup-LogVol00 
  22.  
  23.                       7.0G  4.8G  1.8G  73% / 
  24.  
  25. /dev/sda1              99M   12M   82M  13% /boot 
  26.  
  27. tmpfs                 187M     0  187M   0% /dev/shm 
  28.  
  29. /dev/hdc              183M  183M     0 100% /media/VMware Tools 

可以看到sda有21.4GB,但是只利用了sda1和sda2;根目录挂载在/dev/mapper/VolGroup-LogVol00,我们要做的是,把sda上剩余的空间扩容到/dev/mapper/VolGroup-LogVol00。

1)首先,通过fdisk /dev/sda命令将sda剩余空间创建一个分区:

  1. [root@localhost ~]# fdisk /dev/sda 
  2.  
  3. The number of cylinders for this disk is set to 2610. 
  4.  
  5. There is nothing wrong with that, but this is larger than 1024, 
  6.  
  7. and could in certain setups cause problems with: 
  8.  
  9. 1) software that runs at boot time (e.g., old versions of LILO) 
  10.  
  11. 2) booting and partitioning software from other OSs 
  12.  
  13.    (e.g., DOS FDISK, OS/2 FDISK) 
  14.  
  15. Command (m for help): m 
  16.  
  17. Command action 
  18.  
  19.    a   toggle a bootable flag 
  20.  
  21.    b   edit bsd disklabel 
  22.  
  23.    c   toggle the dos compatibility flag 
  24.  
  25.    d   delete a partition 
  26.  
  27.    l   list known partition types 
  28.  
  29.    m   print this menu 
  30.  
  31.    n   add a new partition 
  32.  
  33.    o   create a new empty DOS partition table 
  34.  
  35.    p   print the partition table 
  36.  
  37.    q   quit without saving changes 
  38.  
  39.    s   create a new empty Sun disklabel 
  40.  
  41.    t   change a partition's system id 
  42.  
  43.    u   change display/entry units 
  44.  
  45.    v   verify the partition table 
  46.  
  47.    w   write table to disk and exit 
  48.  
  49.    x   extra functionality (experts only) 
  50.  
  51. Command (m for help): n 
  52.  
  53. Command action 
  54.  
  55.    e   extended 
  56.  
  57.    p   primary partition (1-4) 
  58.  
  59.  
  60. Partition number (1-4): 3 
  61.  
  62. First cylinder (1045-2610, default 1045): 
  63.  
  64. Using default value 1045 
  65.  
  66. Last cylinder or +size or +sizeM or +sizeK (1045-2610, default 2610): 
  67.  
  68. Using default value 2610 
  69.  
  70. Command (m for help): w 
  71.  
  72. The partition table has been altered! 
  73.  
  74. Calling ioctl() to re-read partition table. 
  75.  
  76. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. 
  77.  
  78. The kernel still uses the old table. 
  79.  
  80. The new table will be used at the next reboot. 
  81.  
  82. Syncing disks. 
  83.  
  84. [root@localhost ~]# 

(编辑:济南站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

推荐文章
    热点阅读