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.pswp.cn/news/375729.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/375729.shtml
英文地址,請注明出處:http://en.pswp.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…