虚拟机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强大的网络服务功能,也可以有效的隔离各项服务拖慢系统,影响系统的运行,对于新手来说可以 ...
随机推荐
- Web 前端性能优化准则
准则01:尽量减少http请求 “只有10%-20%的最终用户响应时间花在接收请求的HTML文档上,剩下的80%-90%时间花在HTML文档所引用的所有组件(图片,script,css,flash等等 ...
- SQL年月日方面的查询信息
这是计算一个月第一天的SQL 脚本: SELECT DATEADD(mm, DATEDIFF(mm,0,getdate()), 0) --当月的第一天 SELECT DATEADD(mm, DAT ...
- ADO.NET基础01
数据库中数据的导入导出 在使用一些数据库时,很多时候都要将文件导入导出到指定的文件夹中: 数据的导入导出就必须用到stream函数,这就必须用到Using System.IO的命名空间: **在数 ...
- 2016C#模拟谷歌Google登陆Gmail&Youtube小案例
之所以写这个,是因为本来想写一个Youtube刷评论的工具,把登录做出来了,后面就没继续做下去. 涉及到基本的HttpWatch的应用以及Fiddler的应用(Fd主要用来排查问题,通过对比 浏览器和 ...
- 调试报“The source file is different from when the module was built.”问题的解决
It is related to the checksums which is used to ensure that you are stepping in matching source. You ...
- ThreadLocal的基本原理与实现
一.概念 首先,ThreadLocal并不是一个Thread,这个类提供了线程局部变量,这些变量不同于它们的普通对应物,因为访问某个变量的每个线程都有自己的局部变量,它独立于变量的初始化副本. 二.基 ...
- 从零开始学习Linux(cp 命令)
功能: 复制文件或目录说明: cp指令用于复制文件或目录,如同时指定两个以上的文件或目录,且最后的目的地是一个已经存在的目录,则它会把前面指定的所有文件或目录复制到此目录中.若同时指定多个文件或目录, ...
- [iOS] 使用xib做为应用程序入口 with Code
[iOS] 使用xib做为应用程序入口 with Code 前言 开发iOS APP的时候,使用storyboard能够快速并且直觉的建立用户界面.但在多人团队开发的情景中,因为storyboard是 ...
- 自己写的表格插件autotable
自己写的表格插件autotable 作者:田想兵,个人网址:http://www.lovewebgames.com 这个表格插件所完成的功能是:ajax请求数据,然后动态绑定到指定表格下,格式化,分页 ...
- 使用WebMatrix发布网站
使用WebMatrix发布网站 WebMatrix 简介: Microsoft WebMatrix 是微软最新的 Web 开发工具,它包含了构建网站所需要的一切元素.您可以从开源 Web 项目或者内置 ...