Preface
 
My virtual machine was simply created by vagrant in default mode without anything about the extra disk volume configuration.The default size is about 10.5G.In order to use the web browse to configure the MySQL Enterprise Monitor,I have to install the gnome desktop environment first,but I found out it was out of free space like below:
 
 ... //Omitted.
Error Summary
-------------
Disk Requirements:
At least 1988MB more space needed on the / filesystem. [root@zlm2 :: ~]
#df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root .3G .1G .2G % / //Only 1.2G free space left.
devtmpfs 911M 911M % /dev
tmpfs 921M 921M % /dev/shm
tmpfs 921M 8.3M 912M % /run
tmpfs 921M 921M % /sys/fs/cgroup
/dev/sda1 497M 164M 334M % /boot
none 80G 27G 53G % /vagrant
tmpfs 185M 185M % /run/user/
Therefore,I need to enlarge the disk for that.It's a little bit different from that adding a disk then mount it as a directory outside the "/" position.It's the way to increase the space of "/"(the root directroy).
 
Procedure
 
  • Halt the virtual machine first,and then add a vdi disk from the original disk(vmdk) in windows cmd cli.
 C:\Users\Administrator>cd F:\Program Files\Oracle\VirtualBox

 C:\Users\Administrator>F:

 F:\Program Files\Oracle\VirtualBox>VBoxManage clonehd "G:\VirtualBox VMs\zlm2\centos-vm-disk1.vmdk" "G:\VirtualBox VMs\zlm2\centos-vm-disk1.vdi" --format vdi
%...%...%...%...%...%...%...%...%...%...%
Clone medium created in format 'vdi'. UUID: 63be4ac1-48a1-4b52-848f-71933c6c4adc F:\Program Files\Oracle\VirtualBox>VBoxManage modifyhd "G:\VirtualBox VMs\zlm2\centos-vm-disk1.vdi" --resize (default "M")
%...%...%...%...%...%...%...%...%...%...% F:\Program Files\Oracle\VirtualBox>exit
  • Restart the virtual machine and then add a new partition.
 [root@zlm2 :: ~]
#fdisk -l Disk /dev/sda: 31.5 GB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk label type: dos
Disk identifier: 0x0000ca5e Device Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 8e Linux LVM Disk /dev/mapper/centos-root: MB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes Disk /dev/mapper/centos-swap: MB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes [root@zlm2 :: ~]
#fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.). Changes will remain in memory only, until you decide to write them.
Be careful before using the write command. Command (m for help): p Disk /dev/sda: 31.5 GB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk label type: dos
Disk identifier: 0x0000ca5e Device Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 8e Linux LVM Command (m for help): n
Partition type:
p primary ( primary, extended, free)
e extended
Select (default p): p
Partition number (,, default ):
First sector (-, default ):
Using default value
Last sector, +sectors or +size{K,M,G} (-, default ):
Using default value
Partition of type Linux and of size 19.5 GiB is set Command (m for help): t
Partition number (-, default ):
Hex code (type L to list all codes): L Empty NEC DOS Minix / old Lin bf Solaris
FAT12 Hidden NTFS Win Linux swap / So c1 DRDOS/sec (FAT-
XENIX root Plan Linux c4 DRDOS/sec (FAT-
XENIX usr 3c PartitionMagic OS/ hidden C: c6 DRDOS/sec (FAT-
FAT16 <32M Venix Linux extended c7 Syrinx
Extended PPC PReP Boot NTFS volume set da Non-FS data
FAT16 SFS NTFS volume set db CP/M / CTOS / .
HPFS/NTFS/exFAT 4d QNX4.x Linux plaintext de Dell Utility
AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
AIX bootable 4f QNX4.x 3rd part Amoeba e1 DOS access
a OS/ Boot Manag OnTrack DM Amoeba BBT e3 DOS R/O
b W95 FAT32 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) CP/M a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) OnTrack DM6 Aux a5 FreeBSD ee GPT
f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/
OPUS EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b
Hidden FAT12 Golden Bow a8 Darwin UFS f1 SpeedStor
Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor
Hidden FAT16 < SpeedStor ab Darwin boot f2 DOS secondary
Hidden FAT16 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS
Hidden HPFS/NTF Novell Netware b7 BSDI fs fc VMware VMKCORE
AST SmartSleep Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 PC/IX be Solaris boot ff BBT
1e Hidden W95 FAT1 Old Minix
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM' Command (m for help): w
The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error : Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe() or kpartx()
Syncing disks. [root@zlm2 :: ~]
#partprobe [root@zlm2 :: ~]
#fdisk -l Disk /dev/sda: 31.5 GB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk label type: dos
Disk identifier: 0x0000ca5e Device Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 8e Linux LVM
/dev/sda3 8e Linux LVM Disk /dev/mapper/centos-root: MB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes Disk /dev/mapper/centos-swap: MB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
  • Create a new PV,add to the original VG and then extend the VG.
 [root@zlm2 :: ~]
#pvdisplay | grep "VG Name"
VG Name centos [root@zlm2 :: ~]
#pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created [root@zlm2 :: ~]
#pvdisplay | grep "VG Name"
VG Name centos
VG Name [root@zlm2 :: ~]
#vgextend centos /dev/sda3
Volume group "centos" successfully extended
  • Check the information logical partition.
 [root@zlm2 :: ~]
#cat /etc/fstab #
# /etc/fstab
# Created by anaconda on Wed Jan ::
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(), findfs(), mount() and/or blkid() for more info
#
/dev/mapper/centos-root / xfs defaults
UUID=461cd9c0-513e-48db-bb08-d07a8f6ef260 /boot xfs defaults
/dev/mapper/centos-swap swap swap defaults
  • Extend the new PV into the original logical partition and expand it.
 [root@zlm2 :: ~]
#lvextend /dev/mapper/centos-root /dev/sda3
Size of logical volume centos/root changed from 8.26 GiB ( extents) to 27.79 GiB ( extents).
Logical volume root successfully resized. [root@zlm2 :: ~]
#resize2fs /dev/mapper/centos-root //Resizes only for ext2/ext3/ext4 filesystem.
resize2fs 1.42. (-Dec-)
resize2fs: Bad magic number in super-block while trying to open /dev/mapper/centos-root
Couldn't find valid filesystem superblock. [root@zlm2 :: ~]
#xfs_growfs /dev/mapper/centos-root //Expands an existing XFS filesystem.
meta-data=/dev/mapper/centos-root isize= agcount=, agsize= blks
= sectsz= attr=, projid32bit=
= crc= finobt=
data = bsize= blocks=, imaxpct=
= sunit= swidth= blks
naming =version bsize= ascii-ci= ftype=
log =internal bsize= blocks=, version=
= sectsz= sunit= blks, lazy-count=
realtime =none extsz= blocks=, rtextents=
data blocks changed from to
  • Check the diskspace again with "df -h" again.
 [root@zlm2 :: ~]
#df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 28G .5G 21G % /
devtmpfs 911M 911M % /dev
tmpfs 921M 921M % /dev/shm
tmpfs 921M 8.4M 912M % /run
tmpfs 921M 921M % /sys/fs/cgroup
/dev/sda1 497M 164M 334M % /boot
none 80G 29G 51G % /vagrant
tmpfs 185M 185M % /run/user/
Okay,now I've got the enough disk space to install the gnome desktop environment.That's awesome!

vbox虚拟机扩容(CentOS 7.2)的更多相关文章

  1. Linux Centos虚拟机扩容

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

  2. 主机通过host-only虚拟网卡连接VBOX虚拟机

    主机通过host-only虚拟网卡连接VBOX虚拟机 How to set up host-only virtual machines that host can access it... 问题 因为 ...

  3. vbox 虚拟机共享文件夹 debian

    主机64位windows7 虚拟机Debian 8 64位 注意:在网络更新时,可能需要修改 etc/apt/sources.list 文件,把前几条从CD更新删除掉,这样就会从网络更新 1.vbox ...

  4. Mac系统下使用VirtualBox虚拟机安装win7--第一步 安装vbox虚拟机

    Mac系统下使用VirtualBox虚拟机安装win7操作步骤: 第一步 安装vbox虚拟机 1.先下载vbox,下载地址:: https://www.virtualbox.org/wiki/Down ...

  5. VMware虚拟机的CentOS无法上网的解决方法

    前言:由于Linux下很多软件安装必须网络环境下进行,因此,对于如何在VMware下进行上网,我折腾了至少三天,今天上午,也即五一劳动节,终于搜到一遍技术文章,经过自己实践,VMware下Linux的 ...

  6. VMware虚拟机扩容

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

  7. 虚拟机环境Centos如何上网

    虚拟机环境Centos如何上网----------by ruffianfish.痞子鱼 因为我是用的虚拟机的环境,所以一切操作角度从虚拟机出发. 虚拟机环境的优点: 适合新手学习linux 永远不要怕 ...

  8. VM虚拟机安装centos,同网段,局域网能访问

    VM虚拟机安装centos,同网段,局域网能访问. 首先下载虚拟机镜像文件,自行下载 安装,网络模式为桥接,设置dhcp为主机同网段 保持VM服务开启 开机就是同网段了

  9. 虚拟机搭建CentOS主机win10通过xshell连接

    目标:主机是win10系统,虚拟机搭建CentOS,在主机上通过XShell连接操作. 第一步 主机上安装虚拟机 第二步 下载CentOS 下载地址http://101.110.118.69/isor ...

随机推荐

  1. 9、Web Service-IDEA-jaxrs 服务端客户端的实现

    关于RestFul编程可以参考:https://www.cnblogs.com/wang-yaz/p/9237981.html 关于jaxrs的实现需要有restful的理解. 话不多说直接上代码!! ...

  2. pyenv 配置python虚拟环境

    安装pyenv环境 yum -y install git yum install gcc make patch gdbm-devel openssl-devel sqlite-devel readli ...

  3. 转:日志组件logback的介绍及配置使用方法

    转自:http://blog.csdn.net/zgmzyr/article/details/8267072 一.logback的介绍 Logback是由log4j创始人设计的又一个开源日志组件.lo ...

  4. linux 相关命令

    Linux 不同用户环境变量 修改所有用户的环境变量:/etc/profile文件 只修改root用户的环境变量:~/.bashrc文件 只修改某个非root用户的环境变量:/home/非root用户 ...

  5. Mac安装软件时提示已损坏的解决方法

    问题描述 最近安装从网上下载的软件,安装完之后打开提示xxx已损坏,打不开,软件无法打开. 其实,这是新系统(macOS Sierra 10.12.X)新安全机制的锅,它默认不允许用户自行下载安装应用 ...

  6. 算法——(4)哈希、hashmap、hashtable

    1. Hash 把任意长度的输入通过散列算法,变换成固定长度的输出,该输出就是散列值.拥有四个特性: 1. 拥有无限的输入域和固定大小的输出域 2. 如果输入值相同,返回值一样 3. 如果输入值不相同 ...

  7. sql连接查询INNER JOIN,LEFT JOIN,RIGHT JOIN区别

    测试表 课程表cource 教师表teacher 查询老师教的课程 1.inner join内链接 ,只显示完全匹配的查询结果 SELECT  cource.cname,teacher.tname f ...

  8. [SCOI2005]互不侵犯(状压DP)

    嗝~算是状压DP的经典题了~ #\(\mathcal{\color{red}{Description}}\) 在\(N×N\)的棋盘里面放\(K\)个国王,使他们互不攻击,共有多少种摆放方案.国王能攻 ...

  9. FLV封装格式分析

    FLV官方文档:https://github.com/jiayayao/DataSheet/tree/master/media%20format/flv 一.FLV格式 FLV包括文件头(FLV he ...

  10. angular路由传参和获取路由参数的方法

    1.首先是需要导入的模块 import { Router } from "@angular/router";//路由传参用到 import{ActivatedRoute,Param ...