vsphere 虚拟机 centos7 扩容/目录
env: vsphere6 虚拟机centos7(2C+2G+30G)
目标:centos7(2C+2G+60G)
1. 在vSphere Client上直接扩大虚拟机的硬盘空间或者挂载一块新硬盘。
2. 查看当前文件系统信息
[root@big ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 27G 4.0G 23G 15% /
devtmpfs 908M 0 908M 0% /dev
tmpfs 920M 0 920M 0% /dev/shm
tmpfs 920M 8.9M 911M 1% /run
tmpfs 920M 0 920M 0% /sys/fs/cgroup
/dev/sda1 1014M 142M 873M 14% /boot
tmpfs 184M 0 184M 0% /run/user/0
[root@big ~]#
3. 查看磁盘分区信息
[root@big ~]# fdisk -lDisk /dev/sda: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b7e05Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 62914559 30407680 8e Linux LVMDisk /dev/mapper/centos-root: 29.0 GB, 28982640640 bytes, 56606720 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
4.创建新分区、设置分区类型
[root@big ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.Command (m for help): m
Command actiona toggle a bootable flagb edit bsd disklabelc toggle the dos compatibility flagd delete a partitiong create a new empty GPT partition tableG create an IRIX (SGI) partition tablel list known partition typesm print this menun add a new partitiono create a new empty DOS partition tablep print the partition tableq quit without saving changess create a new empty Sun disklabelt change a partition's system idu change display/entry unitsv verify the partition tablew write table to disk and exitx extra functionality (experts only)Command (m for help): n
Partition type:p primary (2 primary, 0 extended, 2 free)e extended
Select (default p): p
Partition number (3,4, default 3): 3
First sector (62914560-125829119, default 62914560):
Using default value 62914560
Last sector, +sectors or +size{K,M,G} (62914560-125829119, default 125829119):
Using default value 125829119
Partition 3 of type Linux and of size 30 GiB is setCommand (m for help): pDisk /dev/sda: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b7e05Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 62914559 30407680 8e Linux LVM
/dev/sda3 62914560 125829119 31457280 83 Linux
Command (m for help): t
Partition number (1-3, default 3): 3
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'Command (m for help): pDisk /dev/sda: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b7e05Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 62914559 30407680 8e Linux LVM
/dev/sda3 62914560 125829119 31457280 8e Linux LVMCommand (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 16: 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(8) or kpartx(8)
Syncing disks.
5. 创建pv
[root@big ~]# pvcreate /dev/sda3
WARNING: dos signature detected on /dev/sda3 at offset 510. Wipe it? [y/n]: yWiping dos signature on /dev/sda3.Physical volume "/dev/sda3" successfully created.
6. 添加lv
[root@big ~]# lvm
lvm> vgdisplay--- Volume group ---VG Name centosSystem ID Format lvm2Metadata Areas 1Metadata Sequence No 3VG Access read/writeVG Status resizableMAX LV 0Cur LV 2Open LV 2Max PV 0Cur PV 1Act PV 1VG Size <29.00 GiBPE Size 4.00 MiBTotal PE 7423Alloc PE / Size 7422 / 28.99 GiBFree PE / Size 1 / 4.00 MiBVG UUID Mr8HtH-GMqf-GRGs-Vo8i-K5xT-RtrZ-uLns02lvm> vgextend /dev/centos /dev/sda3Volume group "centos" successfully extended
lvm> vgdisplay--- Volume group ---VG Name centosSystem ID Format lvm2Metadata Areas 2Metadata Sequence No 4VG Access read/writeVG Status resizableMAX LV 0Cur LV 2Open LV 2Max PV 0Cur PV 2Act PV 2VG Size 58.99 GiBPE Size 4.00 MiBTotal PE 15102Alloc PE / Size 7422 / 28.99 GiBFree PE / Size 7680 / 30.00 GiBVG UUID Mr8HtH-GMqf-GRGs-Vo8i-K5xT-RtrZ-uLns02lvm> lvextend -l +100%FREE /dev/centos/rootSize of logical volume centos/root changed from 26.99 GiB (6910 extents) to 56.99 GiB (14590 extents).Logical volume centos/root successfully resized.
lvm> quitExiting.
7. 查看lv
[root@big ~]# lvdisplay--- Logical volume ---LV Path /dev/centos/swapLV Name swapVG Name centosLV UUID evqLg6-TKlf-Chxi-jWCv-1K1U-OV0e-rYbiWcLV Write Access read/writeLV Creation host, time localhost.localdomain, 2018-06-26 17:04:27 +0800LV Status available# open 2LV Size 2.00 GiBCurrent LE 512Segments 1Allocation inheritRead ahead sectors auto- currently set to 8192Block device 253:1--- Logical volume ---LV Path /dev/centos/rootLV Name rootVG Name centosLV UUID yHJ6iS-plGc-YyuT-4xUe-TJIG-yuFB-ZFZPprLV Write Access read/writeLV Creation host, time localhost.localdomain, 2018-06-26 17:04:27 +0800LV Status available# open 1LV Size 56.99 GiBCurrent LE 14590Segments 2Allocation inheritRead ahead sectors auto- currently set to 8192Block device 253:0
8. 修改文件系统实现扩容
[root@big ~]# xfs_growfs /dev/centos/root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=1768960 blks= sectsz=512 attr=2, projid32bit=1= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=7075840, imaxpct=25= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=3455, version=2= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 7075840 to 14940160
9. 验证
[root@big ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 57G 1.2G 56G 2% /
devtmpfs 2.9G 0 2.9G 0% /dev
tmpfs 2.9G 0 2.9G 0% /dev/shm
tmpfs 2.9G 8.8M 2.9G 1% /run
tmpfs 2.9G 0 2.9G 0% /sys/fs/cgroup
/dev/sda1 1014M 142M 873M 14% /boot
tmpfs 581M 0 581M 0% /run/user/0
tips:
[root@big ~]# resize2fs -p /dev/centos/root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/centos/root
Couldn't find valid filesystem superblock.
solution:
xfs_growfs /dev/centos/root
vsphere 虚拟机 centos7 扩容/目录相关推荐
- CentOS7 扩容 / 目录
最近给Mini CentOS 装 GNome 桌面,空间不够用了,折腾半天GNome还是登陆不了郁闷,但是解决了扩容问题 1.虚拟机硬盘扩容 从开始--程序--附件 中打开命令提示符窗口,并切换到Vi ...
- VMWare ESXi系统中给虚拟机硬盘扩容记录(CentOS7)
文章目录 背景 操作步骤 1.在VMWare ESXi中给虚拟机扩容 2.进入虚拟机查看系统分区情况(检查容量是否增加) 3.新建分区 4.格式化新建的分区 5.合并分区 6.再次确认 问题处理 背景 ...
- virtualbox给CentOS7虚拟机磁盘扩容
virtualbox给CentOS7虚拟机磁盘扩容 问题 生产背景 扩容问题 扩容 virtualbox设置扩容 centos7里新建磁盘分区 centos7里使用新分区 问题 生产背景 我们项目还在 ...
- VMWare ESXI 给虚拟机硬盘扩容记录(CentOS7)
虚拟机硬盘扩容记录 一.首次正常扩容 1. 进入虚拟机查看系统分区情况(检查容量是否增加) 2. 新建分区 3. 格式化新建的分区 4. 合并分区 5. 再次确认 问题:无法对 /dev/sda4 进 ...
- VirtualBox虚拟机如何扩容
应用背景:使用VirtualBox安装了Linux虚拟机以后,使用过程中发现其原始分配的容量已不够用,磁盘空间不足,那么这个这个时候在原物理机磁盘空间剩余容量满足的情况下,我们可以考虑采用下述方法给虚 ...
- 虚拟机CentOS7设置远程连接
虚拟机CentOS7设置远程连接 文章目录 虚拟机CentOS7设置远程连接 前言 详细流程 修改网络适配器 查看网络外围信息 查看网络IP信息 设置静态IP地址 测试环境 参考文章 前言 虽然 VM ...
- Ubuntu虚拟机磁盘扩容+VM虚拟机开机多出1分30秒的解决方案(终极教程)
详细步骤,请参考我电脑上的Word:[在用] Word:Ubuntu虚拟机磁盘扩容+VM虚拟机开机多出1分30秒的解决方案(终极教程) 扩容简单总结: 参考1:https://www.cnblogs. ...
- 阿里云发布vSphere虚拟机备份服务 ,网络带宽有限条件下依然能有效保护数据
在6月上旬举行的云栖大会上海峰会上,阿里云发布了vSphere虚拟机备份上云服务(HBR for vSphere),并已经在7月份开始邀测.利用混合云备份服务可以将虚拟机镜像备份上云,避免了传统备份方 ...
- 虚拟机centos7 桥接模式
虚拟机centos7中连通外网的配置 一.首先设置虚拟机连接方式为桥接 打开虚拟机,点击"编辑"-"虚拟网络编辑器" 点击"更改设置"就可以 ...
最新文章
- 多进程对 MySQL update的影响
- OMG!又一个频繁FullGC的案例
- nodeJS 开发微信公众号
- centos7 安装MyCli MySQL 客户端
- 最急救助(【CCF】NOI Online能力测试3 入门组)
- 如何使用Airdrop将视频从Mac发送到iPhone?
- 趣学python编程教孩子学编程_趣学Python——教孩子学编程
- 【转载】Attention Mechanism in Deep Learning
- [linux]scp与服务器互传文件
- 深圳海伊视讯布控球成功对接海康萤石云平台安装调式
- 电脑无鼠标修复计算机怎么办,电脑屏幕只有鼠标箭头怎么解决_电脑开机后只显示鼠标修复方法...
- 视图的创建(第十次作业)
- channel的解析和配置方法
- 观察者(observer)模式(二) —— 实现线程安全的监听器
- linux ks脚本,Linux ks.cfg 详解
- Java的设计模式:
- 微信小游戏egret.getDefinitionByName不能获取类的实例
- 在visual studio 2019中使用msvc2015
- 重型卡车、拖车和客车未来发展之路
- git-crypt 在 windows中解密过程步骤