因CentOS主机安装系统的时候默认产生了一个lvm卷名,非常不好操作。故需要修改一下卷名。
还有一些情况是两台主机安装时都使用的缺省命名,造成Volume group重名(系统中有两个VolGroup00)无法挂载。
需要将之前硬盘的vgname修改后才能挂载。
基于上述两类问题,解决方法如下:
第一步:信息收集
lvm # 进入lvm环境
查看物理卷
lvm> pvs -v
Scanning for physical volume names
PV VG Fmt Attr PSize PFree DevSize PV UUID
/dev/hda2 VolGroup00 lvm2 a- 59.88G 0 59.90G 0m2CBI-2Riw-aN0j-jej2-v7ix-G8MK-l8Ve0P
/dev/hdb2 VolGroup00 lvm2 a- 79.88G 0 79.90G 3SUISX-C95S-gvt9-N3Yg-wTJu-B7fh-wrHORh
# 查看卷组,有两个同名的卷组VolGroup00,分别是两个硬盘上的
lvm> vgs -v
Finding all volume groups
Finding volume group "VolGroup00"
Finding volume group "VolGroup00"
Archiving volume group "VolGroup00" metadata (seqno 3).
Archiving volume group "VolGroup00" metadata (seqno 3).
Creating volume group backup "/etc/lvm/backup/VolGroup00" (seqno 3).
VG Attr Ext #PV #LV #SN VSize VFree VG UUID
VolGroup00 wz--n- 32.00M 1 2 0 79.88G 0 2iZ9Ue-JPU0-GUa1-WOUC-LaqI-g4nB-AVqotw #注意这个vg的uuid,后面会用到
VolGroup00 wz--n- 32.00M 1 2 0 59.88G 0 VCk0AU-gshw-vCNb-8kwQ-efOq-KMBC-OdpcRc
# 只能看到第一个vg上的逻辑卷
lvm> lvs -v
Finding all logical volumes
LV VG #Seg Attr LSize Maj Min KMaj KMin Origin Snap% Move Copy% Log Convert LV UUID
LogVol00 VolGroup00 1 -wi-ao 54.16G -1 -1 253 0 FI1JkF-qEhd-f7ui-ghQS-dsLy-zTeh-u7WAEn
LogVol01 VolGroup00 1 -wi-ao 5.72G -1 -1 253 1 VZ6fDl-VwWU-x7ct-jt6c-dfe7-0aft-c3Fdoh
第二步,修改vg名称
改vgname,uuid是上面vgs -v里查到的对应vg标识
lvm> vgrename 2iZ9Ue-JPU0-GUa1-WOUC-LaqI-g4nB-AVqotw VGmaven
Volume group "VolGroup00" successfully renamed to "VGmaven"
查看修改结果
lvm> vgs -v
Finding all volume groups
Finding volume group "VGmaven"
Finding volume group "VolGroup00"
Archiving volume group "VolGroup00" metadata (seqno 3).
Creating volume group backup "/etc/lvm/backup/VolGroup00" (seqno 3).
VG Attr Ext #PV #LV #SN VSize VFree VG UUID
VGmaven wz--n- 32.00M 1 2 0 79.88G 0 2iZ9Ue-JPU0-GUa1-WOUC-LaqI-g4nB-AVqotw
VolGroup00 wz--n- 32.00M 1 2 0 59.88G 0 VCk0AU-gshw-vCNb-8kwQ-efOq-KMBC-OdpcRc
# 新改名的卷组是inactive了,2个分区LogVol00和LogVol01
lvm> lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [54.16 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [5.72 GB] inherit
inactive '/dev/VGmaven/LogVol00' [77.84 GB] inherit
inactive '/dev/VGmaven/LogVol01' [2.03 GB] inherit
# 用vgchange加载我们该名过的 VGmaven 卷组,提示active状态成功:
lvm> vgchange -ay /dev/VGmaven
2 logical volume(s) in volume group "VGmaven" now active
lvm> lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [54.16 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [5.72 GB] inherit
ACTIVE '/dev/VGmaven/LogVol00' [77.84 GB] inherit
ACTIVE '/dev/VGmaven/LogVol01' [2.03 GB] inherit
第三步:mount文件系统
ll /dev/VGmaven/
total 0
lrwxrwxrwx 1 root root 28 Jul 26 02:26 LogVol00 -> /dev/mapper/VGmaven-LogVol00
lrwxrwxrwx 1 root root 28 Jul 26 02:26 LogVol01 -> /dev/mapper/VGmaven-LogVol01
mount /dev/VGmaven/LogVol00 /mnt/maven/
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
53G 14G 37G 28% /
/dev/hda1 99M 13M 82M 14% /boot
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/mapper/VGmaven-LogVol00
然后还需要修改/etc/fstab
版权属于: 三三世界-百宝箱
本文链接: http://33f.net/linux/lvm_change_name.html
本文最后更新于2022年06月10日 ,已超过925天没有更新,若内容或图片失效,请留言反馈。
本文允许转载,但请在转载时请以超链接或其它形式标明文章出处
@Doug Shume it's ok for me , you can post here.
Saved as a favorite, I like your website!
If some one wishes to be updated with hottest technologies after that he must be visit this site and be up to date daily.
Heello would you mind sharing which blog platform you're using? I'm planning to start my own blog in the near future but I'm having a tough time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then moost blogs and I'm looking for something completely unique. P.S Apologies forr being off-topic butt I had to ask!
Thanks to my father who shared with me regarding this webpage, this website is genuinely amazing.
Hi, I have an overflow of customers that I'd like to send to you but I want to make sure you can handle more leads, let me know if you'd like me to send you more info.
zh.us.to 有效
kms.03k.org 有效
kms.chinancce.com
kms.shuax.com 有效
kms.dwhd.org 有效
kms.luody.info 有效
kms.digiboy.ir 有效
kms.lotro.cc 有效
www.zgbs.cc 有效
cy2617.jios.org 有效
@ 权限问题,试试sudo 再加命令。
你好提示Permission denied 怎么办啊