虚拟机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强大的网络服务功能,也可以有效的隔离各项服务拖慢系统,影响系统的运行,对于新手来说可以 ...
随机推荐
- IOS页面自动布局 之 NSLayoutConstraint基础篇
使用AutoLayout之前需要知道以下两点: 1.必须设置 translatesAutoresizingMaskIntoConstraints为NO. 2.如果是viewControl则AutoLa ...
- UnityShader快速上手指南(四)
简介 由于其他项目中断了几天更新,继续~~ 这一篇主要是讲光照的(包含漫反射和高光以及多光源的处理) 还是先来看看具体效果(多光源后面单独展示) 有了基本的光照处理之后越来越有立体感了有不有 ╮(╯▽ ...
- PowerShell 从网站上下载文件
在cmd下 执行powershell,可能会出现禁止运行的策略, 运行如下命令: powershell set-executionpolicy remotesigned 然后运行: powershel ...
- {"集合已修改;可能无法执行枚举操作。"}
无论是向集合中添加元素还是从集合中删除元素,都会导致集合内部的变化,特别是集合遍历器的变化.例如 List<,,,,}; foreach(int x in list) { list.Remove ...
- 使用VS GDB扩充套件在VS上远端侦错Linux上的C/C++程序
在 Linux 上开发 C/C++ 程序,或许你会直接(本机或远端)登入 Linux,打开编辑器写完代码后,就用 gcc/g++ 来编译,遇到要除错(debug)的时候,则会选择使用 gdb 来进行除 ...
- 记录一款不错的插件fullpage.js
下载链接包括一些实例: http://www.dowebok.com/demo/2014/77/ 当然也可以从Github 上下载: https://github.com/alvarotrigo/fu ...
- PHP OAuth2 Server库
想找比较正宗的库,查了蛮久的.最后在 oauth官方站上,看到PHP版本的相关链接. 发现都是php 5.3版本以上的环境,基于命名空间的写法编写的. 访问下面这个页面,难得,发现文档给出了5.2版本 ...
- SQL Server SQL语句执行顺序
执行顺序: 1.FROM:对FROM子句中前两个表执行笛卡尔积生成虚拟表vt1 2.ON:对vt1表应用ON筛选器只有满足 为真的行才被插入vt2 3.OUTER(join):如果指定了 OUTER ...
- VisualStudio中解决方案
在VS中创建一个项目通常会生成一个解决方案文件(.sln)和一个隐藏的解决方案用户选项文件(.suo). 解决方案文件是一个文本文件,包含以下信息: 将被加载的所有项目以构成完整解决方案的项目清单 解 ...
- SAP debug的几种方式
1. 直接在程序中设断点 这种方式想必大家都知道了,在se38里面打上breakpoint,程序运行到该处即进入debug模式 2.background Job的debug 进入SM37 ...