虚拟机LVM扩容
1.先在Vmware上,把虚拟机硬盘做扩展,如果有快照存在,磁盘可能是不可编辑状态,先删除快照后再扩展。
2.现在打开虚拟机发现系统的磁盘空间已经扩了,但是硬盘分区可用空间没变,还是原来的30G
[root@localhost ~]# fdisk -l Disk /dev/sda: 53.6 GB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes Device Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 + 8e Linux LVM
3.使用 fdisk 新建分区,为lvm扩容做准备
[root@localhost ~]# fdisk /dev/sda The number of cylinders for this disk is set to .
There is nothing wrong with that, but this is larger than ,
and could in certain setups cause problems with:
) software that runs at boot time (e.g., old versions of LILO)
) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/ FDISK) Command (m for help): p Disk /dev/sda: 53.6 GB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes Device Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 + 8e Linux LVM Command (m for help): n
Command action
e extended
p primary partition (-)
p
Partition number (-):
First cylinder (-, default ):
Using default value
Last cylinder or +size or +sizeM or +sizeK (-, default ):
Using default value Command (m for help): p Disk /dev/sda: 53.6 GB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes Device Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 + 8e Linux LVM
/dev/sda3 + Linux
调整磁盘分区/dev/sda3为LVM格式,防止重装系统是不能识别(感觉不调整格式也能用)
Command (m for help): t
Partition number (-):
Hex code (type L to list codes): 8e
Changed system type of partition to 8e (Linux LVM) Command (m for help): p Disk /dev/sda: 53.6 GB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes Device Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 + 8e Linux LVM
/dev/sda3 + 8e 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.
Syncing disks.
[root@localhost ~]# reboot Broadcast message from root (pts/) (Wed Mar :: ): The system is going down for reboot NOW!
如果Re-reading the partition table 失败,可能分区还未识别,重启下再看。
4.建立 pv
[root@localhost ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
[root@localhost ~]# pvdisplay
/dev/cdrom: open failed: No medium found
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup00
PV Size 29.90 GB / not usable 24.06 MB
Allocatable yes
PE Size (KByte)
Total PE
Free PE
Allocated PE
PV UUID o9H0fA-136u-HmOM-Ga3O-7R0i-VRAS-F1mNxZ --- NEW Physical volume ---
PV Name /dev/sda3
VG Name
PV Size 20.00 GB
Allocatable NO
PE Size (KByte)
Total PE
Free PE
Allocated PE
PV UUID Qib59l-uCF5-5fo0-6oqH-5Url-yuSA-Y6N0E0
5.扩展 vg
[root@localhost ~]# vgextend VolGroup00 /dev/sda3
Volume group "VolGroup00" successfully extended
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas
Metadata Sequence No
VG Access read/write
VG Status resizable
MAX LV
Cur LV
Open LV
Max PV
Cur PV
Act PV
VG Size 49.88 GB
PE Size 32.00 MB
Total PE
Alloc PE / Size / 29.81 GB
Free PE / Size / 20.06 GB
VG UUID 8D7xnq-UPBK-LW2U-OCmc-Dl23-cpP1-qLLSHn
6.扩展lv
输入扩展单元,这里就是上面的Free PE 的大小。
[root@localhost ~]# lvextend -l + /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 47.94 GB
Logical volume LogVol00 successfully resized
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID QDtSfz-1SlB-xl3P-mRZp-H3dx-erAx-mAwrt2
LV Write Access read/write
LV Status available
# open
LV Size 47.94 GB
Current LE
Segments
Allocation inherit
Read ahead sectors
Block device : --- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID 6nv9PJ-ho10-LPkA-0GBg-TBZt-z1Tf-F6S2Hu
LV Write Access read/write
LV Status available
# open
LV Size 1.94 GB
Current LE
Segments
Allocation inherit
Read ahead sectors
Block device :
7.调整文件系统
[root@localhost ~]# resize2fs /dev/mapper/VolGroup00-LogVol00
resize2fs 1.35 (-Feb-)
/dev/mapper/VolGroup00-LogVol00 is mounted; can't resize a mounted filesystem!
不能调整,使用 ext2online,我这边文件系统估计有点不对,所有会有些inode调整,忽略。
[root@localhost ~]# ext2online -v /dev/mapper/VolGroup00-LogVol00
ext2online v1.1.18 - // for EXT2FS .5b
new filesystem size
group inode table has offset , not
group inode table has offset , not
...
using reserved group descriptor blocks
creating group with blocks (rsvd = , newgd = ) cache direct hits: , indirect hits: , misses:
注意,对于新的CentOS系统,可能是使用 xfs 格式的分区,需要用别的命令调整
[root@vt-c7 ~]# resize2fs /dev/mapper/centos-root
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.
检查是xfs格式并使用 xfs_growfs 命令来扩展
[root@vt-c7 ~]# cat /etc/fstab #
# /etc/fstab
# Created by anaconda on Sun Apr ::
#
# 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=7c27bad9-295a--afc8-b1f721ba5a5d /boot xfs defaults
/dev/mapper/centos-swap swap swap defaults
[root@vt-c7 ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize= agcount=, agsize= blks
= sectsz= attr=, projid32bit=
= crc= finobt= spinodes=
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
[root@vt-c7 ~]#
8.打完收工
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
48G 27G 19G % /
/dev/sda1 99M 13M 81M % /boot
none 772M 772M % /dev/shm
虚拟机LVM扩容的更多相关文章
- lvm 扩容
总体思路: 逻辑卷要扩容,先扩容对应卷组, 扩容卷组的方式: 添加新的物理卷(磁盘已有分区,扩容后新建分区:或者新加了一块硬盘创建了新的物理卷),vgextend myvg /dev/vdb 扩容,/ ...
- [转载]Linux LVM硬盘管理及LVM扩容
最近项目中一直在用Linux,其中涉及到了Linux的LVM,本来想自己写一篇关于LVM的文章,搜了一下,发现了一篇更好的,转载过来,也感谢作者gaojun 原文Linux LVM硬盘管理及LVM扩容 ...
- 003.LVM扩容
一 LVM扩容步骤 创建分区 创建PV 扩容VG 扩容LV 载大小 二 创建分区 使用分区工具(如fdisk等)创建LVM分区,却将分区标识为LVM的分区类型8e. [root@kauai ~]# f ...
- Vmware Linux虚拟机磁盘扩容方法
我的LINUX版本是ubuntu12.04 32bit.今天在下载android源代码的时候发现自己最初给这个虚拟机分配的磁盘空间不足了(只有20G).所以就需要给磁盘扩容.网上大致搜索了一下,主要有 ...
- 记一次阿里云LVM扩容与 LVM 相关知识学习
一.lvm 扩容 问题: 我们阿里云服务器有一个磁盘容量为 1T ,但是最近由于业务的扩增,磁盘容量已经不够了,需要增大磁盘的容量.磁盘挂载在 /home,使用的是 LVM.我们现在需要对磁盘进行扩容 ...
- Centos7 LVM扩容实例
Centos7 lvm 扩容与以往版本有所不同 1.插入硬盘,我是在虚拟机上做的测试 直接添加一块5G的硬盘 2.系统读取硬盘信息 # echo "- - -" ...
- Kali虚拟机的扩容经历
Kali虚拟机的扩容经历 0x01 起因 更新了一下软件包,竟然提示我空间不足. 升级了 687 个软件包,新安装了 82 个软件包,要卸载 0 个软件包,有 8 个软件包未被升级. 需要下载 1,5 ...
- PVE 下的虚拟机磁盘扩容
扩容背景:一台测试机磁盘不足,需要扩容: /dev/mapper/centos-root 40G 40G 20K 100% / 先到PVE网页上对需要扩容的机器扩容,这里新建20G示例: 另外之前也分 ...
- VirtualBox虚拟机增加CentOS根目录容量 LVM扩容
对于目前的网络开发者来说,比较好的搭档就是Win7+VirtualBox+CentOS的组合,既可以发挥Linux强大的网络服务功能,也可以有效的隔离各项服务拖慢系统,影响系统的运行,对于新手来说可以 ...
随机推荐
- 【Win10】使用 ValidationAttribute 实现数据验证
WPF 中数据验证的方式多种多样,这里就不说了.但是,在 Windows Phone 8.1 Runtime 中,要实现数据验证,只能靠最基础的手动编写条件判断代码来实现.如果用过 ASP.NET M ...
- 创建Google网站地图Sitemap.xml
Sitemap.xml是google搞出来的,也就是网站地图,不过这个网站地图是用xml写的,而且要按google的标准来写,并且要将写出来的这个文件sitemap.xml上传到自己的服务器空间中去. ...
- IIS 503日志文件在哪
概述 503:“服务不可用”错误是一个非自定义的错误,该错误表示服务器当前无法处理该请求. 可能原因:1.管理员可能关闭应用程序池以执行维护.2.当请求到达时应用程序池队列已满.3.应用程序池标识没 ...
- iostat命令
http://www.orczhou.com/index.php/2010/03/iostat-detail/ Linux系统出现了性能问题,一般我们可以通过top.iostat.free.vmsta ...
- 【学习整理】NOIP涉及的数论 [updating]
扩展欧几里得 求二元一次不定式方程 的一组解. int exgcd(int a,int b,int &x,int &y) { int t; ;y=;return a;} t=exgcd ...
- Scala underscore的用途
_ 的用途 // import all import scala.io._ // import all, but hide Codec import scala.io.{Codec => _, ...
- js注入,黑客之路必备!
最近刚出了新闻,阿里四名网络安全部门员工利用网页漏洞写js脚本抢月饼,于是兴致来了,想了解一下这个js脚本到底怎么写,各种刷单各种抢枪抢又是怎么实现的. 什么是javascript注入攻击? 1.每当 ...
- Maven的安装使用以及 Maven+Spring hello world example
关于Maven Maven是一个用于项目构建的工具,通过它便捷的管理项目的生命周期.即项目的jar包依赖,开发,测试,发布打包. 做过.NET的人应该会联想到Nuget,是的Maven其实就是java ...
- mysql内存消耗分析
最近有些生产服务器老是mysql内存不停得往上涨,开发人员和维护反馈,用了不少的临时表,问题时常线上发生,测试又一直比较难重现. 经观察mysql内存的os占用趋势,发现从8:40开始,mysql内存 ...
- 我所了解的WEB开发 (1)
开始接触网站开发的时候,概念里就对静态网站和动态网站有了简单的区分,静态网站仅仅是纯粹的HTML网页,动态网站是需要采用asp 连接数据库(比如access).那个时候听说高手都是使用 Notepad ...