How to extend size of LVM

While i am using VMWARE, i use thin mode for harddisk. But as i only allocate 40G for each VM, soon i find the disk is short of size.

Do i need to rebuilt VM or have some easy way to go?

First, i tried to add space to VM. But soon i find failed. As the size can only be recognized as a new space in the disk, i need to add the spare space to one partion.

Luckly i find the partion i want to add with new space is LVM.

Below is steps for this:

1. Create partion for new space

[[email protected] ~]# fdisk /dev/sda

Command (m for help): n 
First cylinder (1160-1305, default 1160):1160 
Last cylinder or +size or +sizeM or +sizeK(1160-1305, default 1305): 1305

Command (m for help): p 
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 395 3068415 8e Linux LVM
/dev/sda3 396 777 3068415 8e Linux LVM
/dev/sda4 778 1305 4241160 5 Extended
/dev/sda5 778 1159 3068383+ 8e Linux LVM
/dev/sda6 1160 1305 1172713+ 83 Linux \\the new partion

Command (m for help): t \\change partion to LVM
Partition number (1-6): 6 
Hex code (type L to list codes): 8e 
Changed system type of partition 6 to 8e(Linux LVM)

Command (m for help): w 
The partition table has been altered!

OK here i find needs to reboot the linux, otherwise the pvcreate may failed. Is there any good solution for this? I do not know

[[email protected] ~]# pvcreate /dev/sda6 \\create new PV
Physical volume "/dev/sda6" successfully created
[[email protected] ~]# pvscan
PV/dev/sda2 VG rootvg lvm2 [2.93 GB / 0 free]
PV/dev/sda3 VG rootvg lvm2 [2.93 GB / 0 free]
PV/dev/sda5 VG rootvg lvm2 [2.93 GB / 0 free]
PV /dev/sda6 lvm2[1.12 GB] \\newed pv
Total: 4 [9.90 GB] / in use: 3 [8.78 GB] / in no VG: 1 [1.12 GB]
3、Add pv to vg
[[email protected] ~]# vgextend rootvg/dev/sda6
Volume group "rootvg" successfully extended

[[email protected] ~]# pvscan
PV/dev/sda2 VG rootvg lvm2 [2.93 GB / 0 free]
PV/dev/sda3 VG rootvg lvm2 [2.93 GB / 0 free]
PV/dev/sda5 VG rootvg lvm2 [2.93 GB / 0 free]
PV /dev/sda6 VG rootvg lvm2 [1.12 GB / 1.12 GB free] 
Total: 4 [9.89 GB] / in use: 4 [9.89 GB] / in no VG: 0 [0 ]

4、LV extend
[[email protected] ~]# lvextend -L +100M/dev/rootvg/homelv
Extending logical volume homelv to 612.00 MB
Logical volume homelv successfully resized

5、using resize2fs
[[email protected] ~]# resize2fs/dev/rootvg/homelv
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/rootvg/homelv is mountedon /home; on-line resizing required
Performing an on-line resize of/dev/rootvg/homelv to 626688 (1k) blocks.
The filesystem on /dev/rootvg/homelv is now626688 blocks long.

[[email protected] ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/rootvg-rootlv
7.6G 2.0G 5.2G 28% /
/dev/sda1 99M 11M 83M 12% /boot
tmpfs 125M 0 125M 0% /dev/shm
/dev/mapper/rootvg-homelv
593M 19M 544M 4% /home

时间: 2024-08-01 10:42:55

How to extend size of LVM的相关文章

【转载】Linux磁盘管理:LVM逻辑卷管理

Linux学习之CentOS(二十五)--Linux磁盘管理:LVM逻辑卷基本概念及LVM的工作原理 这篇随笔将详细讲解Linux磁盘管理机制中的LVM逻辑卷的基本概念以及LVM的工作原理!!! 一.传统的磁盘管理 其实在Linux操作系统中,我们的磁盘管理机制和windows上的差不多,绝大多数都是使用MBR(Master Boot Recorder)都是通过先对一个硬盘进行分区,然后再将该分区进行文件系统的格式化,在Linux系统中如果要使用该分区就将其挂载上去即可,windows的话其实底

LVM逻辑卷的管理--创建LVM、扩容,快照实战

如果对于生产环境下的服务器来说,如果存储数据的分区磁盘空间不够了怎么办? 因为如果要把一个分区的内容都拷贝到另一个分区上去,势必要首先卸载掉之前的那个分区,然后*对整个分区进行拷贝,如果服务器上运行着一个重要的服务,比如说WWW或者FTP,其要求是 7*24 小时运行正常的,那么卸载掉分区这是不可想象的,同时如果该分区保存的内容非常非常的多,那么在对分区进行转移时时间可能会耗费很久,所以,这个时候我们就会受到传统磁盘管理的限制,因为其不能够进行动态的磁盘管理.因此,为了解决这个问题,LVM技术就

1-16-1 LVM管理和ssm存储管理器使用&磁盘配额

大纲: 1-1- LVM逻辑卷的管理 1-2- SSM管理工具的使用 1-3- 磁盘配额技巧 ====================================== 问题描述: 当我们需要在一个100G的磁盘中存储120G的数据时,空间不够用,这时我们应该怎么办? 一般方法时,重新分区或者是在购买一个大点磁盘 但是,在服务器中,这是不现实的,如果该磁盘上运行着非常重要的服务呢?! 传统磁盘管理的限制,因为其不能够进行动态的磁盘管理. 这时就用到了我们的LVM逻辑卷 LVM(Logical

linux磁盘管理:LVM的基本概念与创建、扩展、缩减、删除

编辑于2015--08--29 二.LVM的磁盘管理 LVM(Logical volume Manager)是逻辑卷管理的简称.它是Linux环境下对磁盘分区进行管理的一种机制. LVM的工作原理其实很简单,它就是通过将底层的物理硬盘抽象的封装起来,然后以逻辑卷的方式呈现给上层应用.在传统的磁盘管理机制中,我们的上层应用是直接访问文件系统,从而对底层的物理硬盘进行读取,而在LVM中,其通过对底层的硬盘进行封装,当我们对底层的物理硬盘进行操作时,其不再是针对于分区进行操作,而是通过一个叫做逻辑卷的

LVM逻辑卷基本概念及LVM的工作原理

这篇随笔将详细讲解Linux磁盘管理机制中的LVM逻辑卷的基本概念以及LVM的工作原理!!! 一.传统的磁盘管理 其实在Linux操作系统中,我们的磁盘管理机制和windows上的差不多,绝大多数都是使用MBR(Master Boot Recorder)都是通过先对一个硬盘进行分区,然后再将该分区进行文件系统的格式化,在Linux系统中如果要使用该分区就将其挂载上去即可,windows的话其实底层也就是自动将所有的分区挂载好,然后我们就可以对该分区进行使用了. 但是这种传统的磁盘管理经常会带来很

Creating LVM Logical Volumes

Creating LVM logical volumes involves creating the three layers in the LVM architecture. You first have to take care of the physical volume (PV), then you need to create the volume group (VG) and assign physical volumes to it. As the last step, the l

Shell脚本一键扩展LVM新分区

最近接到经理要求对RHEL7的LVM新分区扩容自动化,因为使用的是虚拟化平台,故采用添加新磁盘的方式来做: #!/bin/bash ##在线扫描新磁盘##Step1: Recognize New Hard Disk##Logdir=~/disk_log if [ ! -d $Logdir ];then mkdir -p $Logdirfi SCSIHost=`ls -l /sys/class/scsi_host/ | grep "host" | tr -s " "

Windows2003磁盘扩容

云主机的硬盘很多由于磁盘空间不足需要扩容的,但是由于某些原因,需要在原盘上进行扩容,linux系统里的lvm逻辑卷可以做到,windows下也可以无需下载工具进行扩容.下面已windows2003为例,具体做法如下: 我现在需要把C盘从60G扩到160G: 1.先把需要扩容的磁盘卷格式化,不用新建分区: 2.使用cmd命令打开命令行界面 3.输入diskpart命令,打开diskpart界面: 4.使用list volume 命令查看当前的volume卷情况: 5.使用select volume

打印机故障转移集群之二:目标存储服务器的搭建与配置

目标存储服务器的搭建与配置: 下载StarWind软件http://download.csdn.net/detail/kk185800961/8806409 登录到磁盘集群服务器 打开磁盘管理器,转换到动态磁盘,并创建 简单卷并格式化,如下图: 格式化后,硬盘正常使用,在该盘创建一个文件夹 DiskImage,稍后使用: 防火墙设置:下面我们需要对防火墙进行简单设置,以允许节点服务器访问目标服务器.所用到的端口有3260和3261. 打开 StarWind 软件,进入管理中心,选择本地"连接&q