由于在装软件,原来的20G空间不够使用,需要扩容操作。

1.关闭虚拟机

2.点击编辑虚拟机设置

选中硬盘,添加,硬盘,推荐,确定大小,完成。

2.启动虚拟机

查看磁盘使用情况:

[root@master ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 18G .0G 14G % /
tmpfs 931M 80K 931M % /dev/shm
/dev/sda1 291M 39M 238M % /boot
/dev/sr0 .6G .6G % /media/RHEL_6. x86_64 Disc

查看我们新的磁盘

对新加的硬盘进行分区,格式化,因为我的磁盘名称是/dev/sdb,所以输入 fdisk /dev/sdb命令:

[root@master ~]#  fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xc2e1095b.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-652, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652):
Using default value 652

Command (m for help): p

Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc2e1095b

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         652     5237158+  83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

下一步,查看

格式化:

另一种格式化:mkfs -t ext3 /dev/sdb1

[root@master ~]# cd /
[root@master /]# ls
bin dev home lib64 media opt root selinux sys usr
boot etc lib lost+found mnt proc sbin srv tmp var
[root@master /]# mkdir exapp
[root@master /]# mount /dev/sdb1 /exapp/
[root@master /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 18G .0G 14G % /
tmpfs 931M 72K 931M % /dev/shm
/dev/sda1 291M 39M 238M % /boot
/dev/sdb1 5.0G 139M 4.6G 3% /exapp

这个是挂载上了

开机自动挂载,则修改 /etc/fstab 文件,在这个文件里面添加一行: 
/dev/sdb1      /exapp       ext3    defaults        0      0

然而:我想扩大 / 下的空间 ,关闭虚拟机,重新给虚拟机分配2G的空间,启动

对磁盘进行分区

[root@master master]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x1b0e6bd8.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): n     
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4):
First cylinder (1-261, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-261, default 261):
Using default value 261

Command (m for help): p

Disk /dev/sdc: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x1b0e6bd8

Device Boot      Start         End      Blocks   Id  System
/dev/sdc4               1         261     2096451   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

[root@master dev]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        18G  3.0G   14G  18% /
tmpfs           931M   72K  931M   1% /dev/shm
/dev/sda1       291M   39M  238M  14% /boot
/dev/sdb1       5.0G  139M  4.6G   3% /exapp

[root@master master]# pvcreate /dev/sdc4            --  //创建物理卷
  dev_is_mpath: failed to get device for 8:36
  Physical volume "/dev/sdc4" successfully created

查看新建的物理卷和大小,使用pvdisplay命令。

为啥我的根目录下没有卷组?

根目录下有卷组的话,vgextend ubuntu14-vg /dev/sdc4

vgdisplay 会显示一个卷组信息

lvresize -L +120G /dev/mapper/ubuntu14--vg-root

resize2fs  /dev/mapper/ubuntu14--vg-root

df -h

应该会添加成功。

Linux 虚拟机扩容的更多相关文章

  1. [linux]vmware中linux虚拟机扩容 标签: vmware虚拟机linux 2016-09-05 08:03 315人阅读 评

    扩容原因 现阶段,虚拟机的标配都是1G内存和20G硬盘,大部分时候是够用的,但是也会出现虚拟机里面东西放多了硬盘不够用的情况,这种情况下,除了清理垃圾,另外就只能给虚拟机扩容了.因为window扩容相 ...

  2. Linux虚拟机扩容根分区CentOs6.9 VMware14

    1.首先关闭虚拟机点击编辑虚拟机设置 2.点击想要扩容的硬盘点击扩容 3.增加容量 输入想增加的容量,因为我本身是30G写到35G是加了5G不是增加30G.(此处为了演示只增加5G) 4.开启虚拟机 ...

  3. (转)vmware下给linux虚拟机扩容

    “Well, here’s another fine mess you’ve gotten me into” Let us pretend that you have an Ubuntu Server ...

  4. Linux Centos虚拟机扩容

    Linux Centos虚拟机扩容(/dev/mapper/centos-root) 1:.首先查看我们的根分区大小是多少 df -h 文件系统 类型 容量 已用 可用 已用% 挂载点``/dev/m ...

  5. Linux系统盘扩容-物理机非虚拟机

    # Linux系统盘扩容 ## 了解磁盘分区情况 - `blkid` 查看分区情况- `fdisk -l` 分区表 ## 系统挂载分区 - `/etc/fstab` 启动挂载分区情况 ## 双系统下分 ...

  6. VMware虚拟机扩容

    作者:金良(golden1314521@gmail.com) csdn博客:http://blog.csdn.net/u012176591 用了一段Linux虚拟机.发现安装虚拟机时分配的空间不够用, ...

  7. Linux分区扩容

    lz在MAC上面使用Linux虚拟机,开始只建了一个分区,挂载在”/”目录下.现在硬盘空间不够了,所以lz就来给这个分区扩容. 首先,当然是要给虚拟机分配更多的硬盘空间喽(lz用的是VMware Fu ...

  8. 为Xen虚拟机扩容根文件系统(LVM)

    ===== 为Xen虚拟机扩容根文件系统(LVM) ===== 1. 增加1个4G的映像文件 # dd if=/dev/zero of=data.img bs=4k seek=1024k count= ...

  9. linux 系统扩容 VMware Centos---VMware ESXi

    用到的命令 df  fdisk  pvcreate   pvdisplay    vgdisplay    vgextend    lvdisplay    lvextend  resize2fs 0 ...

随机推荐

  1. 阶段5 3.微服务项目【学成在线】_day04 页面静态化_22-页面静态化-静态化测试-静态化程序测试

    测试service内些的静态化的方法 先新建一个测试类 模板的id 放到下拉的静态数据里面 这样这条数据 就是用用的轮播图005这个模板 把这条数据静态化 进入到断点里面.先获取数据模型 获取模板时 ...

  2. matllab 按照文件夹处理文件

    folders=dir('文件夹地址'); folders={folders.name}; folders=setdiff(folders,{'.','..'})'; num=length(folde ...

  3. python封装和解构

    封装 将多个值使用逗号分割,组合在一起 本质上,返回一个元组,只是省略了小括号 python的特有的语法,被很多语言学习借鉴 t1 = (1,2) #定义元组 t2 = 1,2 #将1和2封装成元组 ...

  4. Security命名空间配置

    http://www.mossle.com/docs/springsecurity3/html/ns-config.html Security命名空间配置 2.1. 介绍 从Spring-2.0开始可 ...

  5. Golang sync.WaitGroup的用法

    0x01 介绍 经常会看到以下了代码: 12345678910111213 package main import ( "fmt" "time") func m ...

  6. Flutter Window环境运行(VSCode + 单独运行Android 虚拟机)

    官网以及很多网上文章的开发都是基于Android ,因为它能创建不同类型移动设备虚拟机.但个人始终觉得它太庞大,启动慢耗资源,但我们使用Flutter又离不开虚拟机. 经过实践,现在能成功的单独启动移 ...

  7. ES6 javascript 实用开发方法技巧分享

    定义变量/常量 ES6 中新增加了 let 和 const 两个命令,let 用于定义变量,const 用于定义常量 两个命令与原有的 var 命令所不同的地方在于,let, const 都是块级作用 ...

  8. python3 正则表达式 re模块之辣眼睛 计算器

    额...学到几个常用模块了,也要其中考试了,每天晚上敲一点,敲得脑壳疼,不过又想到好一点的办法了,有时间再改吧. 此非吾所欲也,实属无奈也....复习之路漫漫,吾将到书上求索,在此不多逗留,我挥一挥衣 ...

  9. ZUI(BootStrap)使用vue动态插入HTMl所创建的data-toggle事件初始化方法

    用ZUI的图片浏览:lightbox 写静态html的时候是有预览效果的,使用了vue动态加载就没有效果了, 网上的说法是动态生成的没有激活事件:ZUI(BootStrap)动态插入HTMl所创建的d ...

  10. SQLSever语句(增、删、改、查)一、增:有4种方法1.使用insert插入单行数据

    SQL语句(增.删.改.查) 一.增:有4种方法 1.使用insert插入单行数据: 语法:insert [into] <表名> [列名] values <列值> 例:inse ...