查看新挂载的lvm磁盘1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34[root@tomcat-node5 /]# fdisk -l
Disk /dev/xvda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00078f9c
Device Boot Start End Blocks Id System
/dev/xvda1 * 1 5222 41940992 83 Linux
Disk /dev/xvdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/jhjhome1-lv_home: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
.....
Disk /dev/xvdc: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/xvdc是新挂载上去磁盘
直接挂着目录报错1
2[root@jhjapp-tomcat-node5 ~]# mount /dev/xvdc /mnt
mount: unknown filesystem type 'LVM2_member'
挂载/dev/xvdc
pvscan
vgscan
lvscna1
2
3
4[root@jhjapp-tomcat-node5 ~]# pvscan
[root@jhjapp-tomcat-node5 ~]# pvscan
PV /dev/xvdc VG jhjhome lvm2 [100.00 GiB / 1020.00 MiB free]
PV /dev/xvdb VG jhjhome1 lvm2 [100.00 GiB / 1020.00 MiB free]
改变vg名称 //因为之前Vg名称相同lvscan只能识别一个1
2
3
4
5
6
7
8
9
10[root@jhjapp-tomcat-node5 ~]# vgs -v
Finding all volume groups
Finding volume group "jhjhome"
Finding volume group "jhjhome1"
VG Attr Ext #PV #LV #SN VSize VFree VG UUID VProfile
jhjhome wz--n- 4.00m 1 5 0 100.00g 1020.00m UF6SKw-o3vb-TLdm-pA3S-TWWl-5Rw3-xyOcdD
jhjhome1 wz--n- 4.00m 1 5 0 100.00g 1020.00m WX0eQq-3BUy-q0TL-2HiU-VhgM-5dCc-6Q9Shv
-----------------------------------------------
[root@jhjapp-tomcat-node5 ~]# vgrename UF6SKw-o3vb-TLdm-pA3S-TWWl-5Rw3-xyOcdD jhj2
Volume group "jhjhome" successfully renamed to "jhj2"
vgscan1
2
3
4[root@jhjapp-tomcat-node5 ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "jhj2" using metadata type lvm2
Found volume group "jhjhome1" using metadata type lvm2
lvscna未激活1
2
3
4
5
6
7
8
9
10
11
12[root@jhjapp-tomcat-node5 ~]# lvscan
inactive '/dev/jhj2/lv_home' [30.00 GiB] inherit
inactive '/dev/jhj2/lv_usr' [43.00 GiB] inherit
inactive '/dev/jhj2/lv_var' [20.00 GiB] inherit
inactive '/dev/jhj2/lv_tmp' [2.00 GiB] inherit
inactive '/dev/jhj2/lv_swap' [4.00 GiB] inherit
ACTIVE '/dev/jhjhome1/lv_home' [30.00 GiB] inherit
ACTIVE '/dev/jhjhome1/lv_usr' [43.00 GiB] inherit
ACTIVE '/dev/jhjhome1/lv_var' [20.00 GiB] inherit
ACTIVE '/dev/jhjhome1/lv_tmp' [2.00 GiB] inherit
ACTIVE '/dev/jhjhome1/lv_swap' [4.00 GiB] inherit
`
先激活vg1
2[root@jhjapp-tomcat-node5 ~]# vgchange -ay jhj2
5 logical volume(s) in volume group "jhj2" now active
再查看lv状态,发现已经活动的lv1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34[root@jhjapp-tomcat-node5 ~]# lvscan
ACTIVE '/dev/jhj2/lv_home' [30.00 GiB] inherit
ACTIVE '/dev/jhj2/lv_usr' [43.00 GiB] inherit
ACTIVE '/dev/jhj2/lv_var' [20.00 GiB] inherit
ACTIVE '/dev/jhj2/lv_tmp' [2.00 GiB] inherit
ACTIVE '/dev/jhj2/lv_swap' [4.00 GiB] inherit
ACTIVE '/dev/jhjhome1/lv_home' [30.00 GiB] inherit
ACTIVE '/dev/jhjhome1/lv_usr' [43.00 GiB] inherit
ACTIVE '/dev/jhjhome1/lv_var' [20.00 GiB] inherit
ACTIVE '/dev/jhjhome1/lv_tmp' [2.00 GiB] inherit
ACTIVE '/dev/jhjhome1/lv_swap' [4.00 GiB] inherit
-------------------------------
[root@jhjapp-tomcat-node5 ~]# lvdisplay
--- Logical volume ---
LV Path /dev/jhj2/lv_home
LV Name lv_home
VG Name jhj2
LV UUID qI3DV4-dkAW-jNdy-SmUL-CZEV-rA04-6TfXLn
LV Write Access read/write
LV Creation host, time iZ25aocjopuZ, 2016-08-04 10:15:38 +0800
LV Status available
open 0
LV Size 30.00 GiB
Current LE 7680
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:5
--- Logical volume ---
LV Path /dev/jhj2/lv_usr
LV Name lv_usr
..............
mount这个lv就可以访问了
1 | [root@jhjapp-tomcat-node5 ~]# mount /dev/jhj2/lv_home /mnt |
如果vg名称不相同不需要改vg名称那个步骤 直接激活挂载