博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
How to extend size of LVM
阅读量:6637 次
发布时间:2019-06-25

本文共 2925 字,大约阅读时间需要 9 分钟。

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

[root@localhost ~]# 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

[root@localhost ~]# pvcreate /dev/sda6 \\create new PV

Physical volume "/dev/sda6" successfully created
[root@localhost ~]# 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
[root@localhost ~]# vgextend rootvg/dev/sda6
Volume group "rootvg" successfully extended
[root@localhost ~]# 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
[root@localhost ~]# lvextend -L +100M/dev/rootvg/homelv
Extending logical volume homelv to 612.00 MB
Logical volume homelv successfully resized
5、using resize2fs
[root@localhost ~]# 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.
[root@localhost ~]# 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

转载于:https://www.cnblogs.com/leon-zhu/p/4285617.html

你可能感兴趣的文章
终于解决了一个Win7 下 VS 编译的问题,困扰了我好几个月
查看>>
企业级nginx基础、负载、读写分离技术(续一)
查看>>
利用DBMS_ADVISOR.TUNE_MVIEW包生成物化视图创建语句
查看>>
系统安装EMC多路径软件
查看>>
Web前端——Head区域代码规范
查看>>
我认为的android入门学习策略
查看>>
【基本功】CS core 回炉计划与进展
查看>>
ssh服务配置
查看>>
Windows 8 异步编程
查看>>
XenDesktop项目的规划
查看>>
Microsoft Dynamics CRM 官网 销售经理 角色 在线 TestDrive的试用
查看>>
RDS Best Practices — Fast and Stable Migration to RDS
查看>>
C# 进程间通信(共享内存)
查看>>
jvm(13)-线程安全与锁优化(转)
查看>>
thinkphp学习笔记4—眼花缭乱的配置
查看>>
ibwebrtc-audio-processing-devel
查看>>
密码复杂度检查的正则表达式
查看>>
设置 CxImage 的 Alpha 透明度
查看>>
中国社会科学院吕政:把缩小制造业与发达国家的差距作为新增长点
查看>>
“先体检,再治病“ 迪普科技为某金融企业量身定制安全方案
查看>>