Linux LVM学习总结——扩展卷组VG

Linux服务器由于应用变更或需求的缘故,有可能出现分区空间不足的情况,此时往往需要进行扩容(要增加分区的空间),而采用LVM的好处就是可以在不需停机的情况下可以方便地调整各个分区大小。如下所示,分区/u05由于备份集保留的时间调整,RMAN备份时出现空间不足的情况,如下所示,

[root@getlnx01 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       97G   37G   55G  41% /
/dev/mapper/VolGroup01-LogVol00
                       79G   33G   43G  44% /u01
/dev/mapper/VolGroup02-LogVol00
                      197G  168G   19G  90% /u02
/dev/mapper/VolGroup03-LogVol00
                      197G  127G   60G  68% /u03
/dev/mapper/VolGroup04-LogVol00
                      138G  126G  5.6G  96% /u04
/dev/mapper/VolGroup05-LogVol00
                      178G  104G   65G  62% /u05
/dev/sda1              99M   23M   71M  25% /boot
tmpfs                  12G     0   12G   0% /dev/shm
[root@getlnx01 ~]# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "VolGroup05" using metadata type lvm2
  Found volume group "VolGroup04" using metadata type lvm2
  Found volume group "VolGroup03" using metadata type lvm2
  Found volume group "VolGroup02" using metadata type lvm2
  Found volume group "VolGroup01" using metadata type lvm2
  Found volume group "VolGroup00" using metadata type lvm2
[root@getlnx01 ~]# 

我在添加了一块虚拟磁盘后(虚拟机),此时使用fdisk -l查不到刚刚添加的新磁盘,此时需要运行命令echo "- - -" > /sys/class/scsi_host/host0/scan重新扫描该接口下的SCSI磁盘设备。

关于该命令它是通过/sys下的属性设置运行SCSI扫描。echo "- - -" > scan "- - -"代表channel,target和LUN编号。以上命令会导致hba4下所有channel,target以及可见LUN被扫描。

 
[root@getlnx01 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@getlnx01 ~]# fdisk -l
 
Disk /dev/sda: 55.8 GB, 55834574848 bytes
255 heads, 63 sectors/track, 6788 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        6788    54420187+  8e  Linux LVM
 
Disk /dev/sdb: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       10443    83883366    5  Extended
/dev/sdb5               1       10443    83883334+  83  Linux
 
Disk /dev/sdd: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1       26108   209712478+   5  Extended
/dev/sdd5               1       26108   209712447   83  Linux
 
Disk /dev/sdc: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       26108   209712478+   5  Extended
/dev/sdc5               1       26108   209712447   83  Linux
 
Disk /dev/sdf: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1        7832    62910508+   5  Extended
/dev/sdf5               1        7832    62910477   83  Linux
 
Disk /dev/sde: 150.3 GB, 150323855360 bytes
255 heads, 63 sectors/track, 18275 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1       18275   146793906    5  Extended
/dev/sde5               1       18275   146793874+  83  Linux
 
Disk /dev/sdg: 193.2 GB, 193273528320 bytes
255 heads, 63 sectors/track, 23497 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdg1               1       23497   188739621    5  Extended
/dev/sdg5               1       23497   188739589+  83  Linux
 
Disk /dev/dm-0: 107.2 GB, 107206410240 bytes
255 heads, 63 sectors/track, 13033 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/dm-0 doesn't contain a valid partition table
 
Disk /dev/dm-1: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/dm-1 doesn't contain a valid partition table
 
Disk /dev/sdh: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdh doesn't contain a valid partition table

 

1:格式化分区

格式化磁盘设备/dev/sdh, 下面是采用逻辑扩展分区。关于格式分区时是否一定要修改分区类型为8e(LVM格式),我查了一些资料,这个不是必须的。鸟哥的Linux私房菜里面的原话为:“那个8e的出现会导致system变成Linux LMV! 其实没有设定为8e也没有关系,不过某些LMV的侦测指令可能会侦测不到该partition就是了”

[root@getlnx01 ~]# fdisk /dev/sdh
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
 
 
The number of cylinders for this disk is set to 10443.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
 
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
e
Partition number (1-4): 1
First cylinder (1-10443, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-10443, default 10443): 
Using default value 10443
 
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.
[root@getlnx01 ~]# fdisk /dev/sdh
 
The number of cylinders for this disk is set to 10443.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
 
Command (m for help): p
 
Disk /dev/sdh: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdh1               1       10443    83883366    5  Extended
 
Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (1-10443, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-10443, default 10443): 
Using default value 10443
 
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.
[root@getlnx01 ~]# 
 

 

2:新建物理卷(PV)

[root@getlnx01 ~]# pvcreate /dev/sdh5
  Physical volume "/dev/sdh5" successfully created
[root@getlnx01 ~]# pvdisplay /dev/sdh5
  "/dev/sdh5" is a new physical volume of "80.00 GB"
  --- NEW Physical volume ---
  PV Name               /dev/sdh5
  VG Name               
  PV Size               80.00 GB
  Allocatable           NO
  PE Size (KByte)       0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               LgKUuj-UddY-AHHO-ewqX-1iF1-6HYN-N5EITM

3:扩展卷组(VG)

首先查看VG的详细信息,然后扩展VG

[root@getlnx01 ~]# vgdisplay VolGroup05
  --- Volume group ---
  VG Name               VolGroup05
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               179.97 GB
  PE Size               32.00 MB
  Total PE              5759
  Alloc PE / Size       5759 / 179.97 GB
  Free  PE / Size       0 / 0   
  VG UUID               UNFxZH-lAGM-vqF3-jtNK-yuKT-enUX-WwL7FQ
   
 
   
[root@getlnx01 ~]# vgextend VolGroup05 /dev/sdh5
  Volume group "VolGroup05" successfully extended
[root@getlnx01 ~]# vgdisplay VolGroup05
  --- Volume group ---
  VG Name               VolGroup05
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               259.94 GB
  PE Size               32.00 MB
  Total PE              8318
  Alloc PE / Size       5759 / 179.97 GB
  Free  PE / Size       2559 / 79.97 GB
  VG UUID               UNFxZH-lAGM-vqF3-jtNK-yuKT-enUX-WwL7FQ
   
[root@getlnx01 ~]# 

4:处理文件系统

VG扩展后,/u05分区还不能实时增加空间,还需要使用resize2fs –p命令激活新增加的空间

 
[root@getlnx01 ~]# resize2fs -p  /dev/VolGroup05/LogVol00 
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup05/LogVol00 is mounted on /u05; on-line resizing required
Performing an on-line resize of /dev/VolGroup05/LogVol00 to 68141056 (4k) blocks.
 
The filesystem on /dev/VolGroup05/LogVol00 is now 68141056 blocks long.
 
[root@getlnx01 ~]# 
[root@getlnx01 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       97G   37G   55G  41% /
/dev/mapper/VolGroup01-LogVol00
                       79G   33G   43G  44% /u01
/dev/mapper/VolGroup02-LogVol00
                      197G  168G   19G  90% /u02
/dev/mapper/VolGroup03-LogVol00
                      197G  127G   60G  68% /u03
/dev/mapper/VolGroup04-LogVol00
                      138G  126G  5.6G  96% /u04
/dev/mapper/VolGroup05-LogVol00
                      256G  104G  140G  43% /u05
/dev/sda1              99M   23M   71M  25% /boot
tmpfs                  12G     0   12G   0% /dev/shm
[root@getlnx01 ~]# 

 

Linux LVM学习总结——创建卷组VG

Linux LVM学习总结——删除卷组VG

Linux LVM学习总结——扩展卷组VG

转载于:https://www.cnblogs.com/kerrycode/p/4651126.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/375729.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【液晶模块系列基础视频】1.3.iM_TFT30模块简介

【液晶模块系列基础视频】1.3.iM_TFT30模块介绍 技术论坛:http://www.eeschool.org 博客地址:http://xiaomagee.cnblogs.com 官方网店:http://i-board.taobao.com 银杏科技 GINGKO TECH. 保留权利,转载请注明出处 本次教学视频介…

C++控制向文件中写入浮点数的格式

有时会遇到向文件中写入一定格式的浮点数&#xff0c;为了对齐美观&#xff0c;常常采用控制小数点后的位数并用0补齐缺少的位数的方法。 #include <iostream> #include <iomanip> #include <fstream> using namespace std;int main(){double pi3.14;ofstre…

项目管理工具到底应该为谁服务?

项目管理工具到底应该为谁服务&#xff1f;为管理者&#xff0c;还是为了团队&#xff1b;为了管理报表&#xff0c;还是为了协作需求&#xff0c;这些是在项目管理工具选择或开发时需要面对和思考的一个问题。 传统项目管理工具在团队内部臭名昭著 项目管理工具当初都是为了项…

二叉树的递归定义及存储

定义 最多有两棵子树的有序树&#xff0c;称为二叉树。二叉树是一种特殊的树。 递归定义&#xff1a;二叉树是n(n>0)个有限结点构成的集合。N0称为空二叉树&#xff1b;n>0的二叉树由一个根结点和两互不相交的&#xff0c;分别称为左子树和右子树的二叉树构成。 二叉树中…

C++统计微妙级时间消耗(chrono)

有时我们需要统计某段程序运行所消耗的时间&#xff0c;通过C的chrono库&#xff0c;我们可以轻松实现这一需求&#xff0c;例如&#xff0c;我们求斐波那契数列消耗的时间。 #include <iostream> #include <chrono> #include <iomanip> using namespace st…

content-length与Transfer-Encoding: chunked的问题释疑

content-length与Transfer-Encoding: chunked的问题释疑 http返回头中content-length与Transfer-Encoding: chunked的问题释疑 先说说问题出现的背景&#xff1a; 公司服务器与手机客户端交互&#xff0c;客户端请求一个动态生成的XML文件&#xff0c;在用firebug查看http响应头…

基于RSA的加密/解密示例C#代码

在C#程序中&#xff0c;大家可能比较熟悉的方式是md5加密解密方式&#xff0c;对RSA可能并不是很熟悉&#xff0c; 下面就说一下RSA加密和解密的算法&#xff1a;using System;using System.Security.Cryptography;using System.Text;class RSACSPSample{static void Main(){tr…

iOS GorupBy

转自&#xff1a; IOS 数组分组 Grouped NSArray 12345678NSMutableSet *set[NSMutableSet set];[_list enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {[set addObject:obj["MeasureType"]];//利用set不重复的特性,得到有多少组,根据数组中的…

android通过adb shell播放音乐

am start -n com.android.music/com.android.music.MediaPlaybackActivity -d /sdcard/timian.mp3拓展阅读 input keyevent 24 #增加音量 input keyevent 25 #降低音量 input keyevent 85 #暂停/播放 input keyevent 126 #恢复播放 input keyevent 127 #停止播放关闭音乐播放器…

NetBpm 安装篇(1)

尊重别人劳动成果 转载注明出处&#xff1a;http://www.cnblogs.com/anbylau2130/p/3875718.html 官方主页 http://www.netbpm.org/docs/install.html 文件目录 Netbpm的两种服务器配置 1&#xff0c;CassiniWebServer CassiniWebServer.exe是轻量级的web服务器&#xff0c;相…

python将文本中的数据处理成图像(matplotlib)

使用Python的matplotlib模块可以很方便的将数据处理成图表&#xff0c;使数据更加形象、直观。 #!/usr/bin/env pythonimport matplotlib.pyplot as plt import numpy as np from mpl_toolkits.axes_grid.anchored_artists import AnchoredTexty1np.loadtxt(ReadDataCostTime.…

string 中的 length函数 和size函数 返回值问题

string 中的 length函数 和 size函数 的返回值 ( 还有 char [ ] 中 测量字符串的 strlen 函数 ) 应该是 unsigned int 类型的 不可以 和 -1 比较。 应尽量避免 unsigned int 类型 和 int类型 数据 的比较 。当unsigned int 类型 和 int类型 数据 比较 时 &#xff0c;会 把…

交叉编译android版htop

编这个东西贼烦人。 话不多说&#xff0c;直接上教程 源代码版本&#xff1a;htop-2.2.0、ncurses-6.1 编译之前要确认自己有ndk&#xff0c;从【官网】直接下载&#xff0c;下载下来解压一下就能用。 先编ncurses 编译过程 ./configure CCarm-linux-androideabi-gcc-4.9 \-…

今天的一点点收获

今天怎么说呢&#xff0c;还是有点收获的&#xff0c;上午写了一上午的前端&#xff0c;然后就是下午又是一下午的c#&#xff0c;好特么酸爽啊&#xff0c;但是有一件特别蛋疼的事情发生了&#xff0c;我 天天叫的学长竟然不是学长而是学校的而老师&#xff0c;但是他们都不叫他…

jquery动态添加删除div--事件绑定,对象克隆

我想做一个可以动态添加删除div的功能。中间遇到一个问题&#xff0c;最后在manong123.com开发文摘 版主的热心帮助下解答了(答案在最后) 使用到的jquery方法和思想就是&#xff1a;事件的绑定和销毁(unbind)&#xff0c;另外还可以使用clone,通过克隆可以很好的解决这个问…

编程知识大杂烩

以下资料完全是随手记录&#xff0c;没有任何顺序或关联&#xff0c;需要用直接^F找就行了。 1. ps aux指令详解 http://blog.csdn.net/hanner_cheung/article/details/6081440 2. Linux下配置Apache php http://lelong.iteye.com/blog/904125 3. shell定义变量 http://see.xid…

最长公共前缀

2、最长公共前缀 编写一个函数来查找字符串数组中的最长公共前缀。 如果不存在公共前缀&#xff0c;返回空字符串 “”。 示例1 输入: ["flower","flow","flight"] 输出: "fl"示例2 输入: ["dog","racecar",…

devexpress中gridcontrol头部添加垂直线(右边框)

winform开发&#xff0c;用devexpress中的gridcontrol控件&#xff0c;头部默认是3D样式&#xff0c;当客户希望像内容一样扁平化显示且需要添加垂直线(右边框)时恶梦开始了。。经过一阵摸索发现可以这样解决&#xff1a; 1.设置GridControl的GridView控件的PaintStyleName属性…

UITableView知识梳理须知—(一)

1、UITableView掌握 1> 设置UITableView的dataSource、delegate 2> UITableView多组数据和单组数据的展示 3> UITableViewCell的常见属性 4> UITableView的性能优化&#xff08;cell的循环利用&#xff09; 5> 自定义Cell 2、什么是UITableView 在i…