zoukankan      html  css  js  c++  java
  • hyper虚拟机下对centos进行动态扩容

    在关机状态下,可增加centos的磁盘空间,但是增加的这部分空间,还需在centos完成以下操作,才能使用
     
    1.查看现有的硬盘分区(现在空间没有变大)
    #df -h
     
    2.对新增的硬盘空间做新增分区(硬盘数没有增加,增加的是空间)
    #fdisk /dev/sda
     
    The number of cylinders for this disk is set to 7832.
    There is nothing wrong with that, but this is larger than 1024,
    and could in certain setups cause problems with:
    1) software that runs at boot time (e.g., old versions of LILO)
    2) booting and partitioning software from other OSs
       (e.g., DOS FDISK, OS/2 FDISK)
     
    Command (m for help): 说明:新增分区
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition number (1-4): 说明:新增分区号(1,2默认已经用了)
    First cylinder (2611-7832, default 2611): 默认回车(最小)
    Using default value 2611
    Last cylinder or +size or +sizeM or +sizeK (2611-7832, default 7832):默认回车(最大)
    Using default value 7832
     
    Command (m for help): 说明:修改分区类型
    Partition number (1-4): 说明:修改分区类型对应的分区号
    Hex code (type L to list codes): 8e 说明:8e是lvm磁盘类型
    Changed system type of partition 3 to 8e (Linux LVM)
     
    Command (m for help): p 说明:打印分区表
     
    Disk /dev/sda: 64.4 GB, 64424509440 bytes
    255 heads, 63 sectors/track, 7832 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
     
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *           1          13      104391   83  Linux
    /dev/sda2              14        2610    20860402+  8e  Linux LVM
    /dev/sda3            2611        7832    41945715   8e  Linux LVM
     
    Command (m for help): w 说明:保存退出
    The partition table has been altered!
     
    3.重启系统
    #reboot
     
    4.查看硬盘情况(核对刚才所做的分区操作是否保存成功)
    #fdisk -l
     
    5.查看当前分区的类型
    #df -T /dev/sda1 说明:查看当前的主分区类型
     
    6.创建文件系统在新的磁盘上
    #mkfs.ext4 /dev/sda3 说明:ext4为你查看到的文件系统类型(ext2、ext3、ext4等)
     
    7.创建PV(pv组成vg,vg组成lv)
    #pvcreate /dev/sda3
    查看pv状态
    #pvdisplay
    查看vg状态
    #vgdisplay
     
    8.刚创建的PV加入相应的VG
    #vgextend vg_centos /dev/sda3 说明:vg_centos是我的服务器vg名称,请通过查看vg状态得到名称VG name
     
    9.查看LV状态,把VG加入到LV
    #lvdisplay

    10.
    lvextend -l +2559 /dev/VolGroup00/LogVol00 说明:2559为上面pvdisplay查看到的free的PE数量
     
    11.用 resize2fs 调整文件系统大小
    resize2fs /dev/mapper/VolGroup00-LogVol00
     
  • 相关阅读:
    HDU 3853 LOOPS:期望dp【网格型】
    SGU 495 Kids and Prizes:期望dp / 概率dp / 推公式
    BZOJ 1629 [Usaco2005 Nov]Cow Acrobats:贪心【局部证明】
    BZOJ 3400 [Usaco2009 Mar]Cow Frisbee Team 奶牛沙盘队:dp【和为f的倍数】
    BZOJ 1685 [Usaco2005 Oct]Allowance 津贴:贪心【给硬币问题】
    codeforces-473D Mahmoud and Ehab and another array construction task (素数筛法+贪心)
    poj1964最大子矩阵 (单调栈加枚举)
    poj3111 选取物品(二分+贪心)
    codeforces-777E Hanoi Factory (栈+贪心)
    poj3040 发工资(贪心)
  • 原文地址:https://www.cnblogs.com/theluther/p/4055593.html
Copyright © 2011-2022 走看看