VG信息的导出导入
1、umount已经挂载的LV
[root@racdb2 ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda1 18G 14G 2.6G 85% /
tmpfs 1.5G 154M 1.4G 11% /dev/shm
/dev/mapper/myvg-db_bak
5.0G 148M 4.6G 4% /db_bak
[root@racdb2 ~]# cd
[root@racdb2 ~]# umount /dev/mapper/myvg-db_bak
[root@racdb2 ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda1 18G 14G 2.6G 85% /
tmpfs 1.5G 154M 1.4G 11% /dev/shm
2、将VG inactive:
[root@racdb2 ~]# lvscan
ACTIVE '/dev/myvg/tnms_his01' [20.00 MB] inherit
ACTIVE '/dev/myvg/tnms_his02' [20.00 MB] inherit
ACTIVE '/dev/myvg/tnms_his03' [20.00 MB] inherit
ACTIVE '/dev/myvg/tnms_his04' [20.00 MB] inherit
ACTIVE '/dev/myvg/tnms_his05' [20.00 MB] inherit
ACTIVE '/dev/myvg/db_bak' [5.00 GB] inherit
ACTIVE '/dev/myvg/remainder' [20.00 MB] inherit
ACTIVE '/dev/myvg/tnms_his06' [20.00 MB] inherit
[root@racdb2 ~]# vgchange -an myvg
0 logical volume(s) in volume group "myvg" now active
[root@racdb2 ~]# lvscan
inactive '/dev/myvg/tnms_his01' [20.00 MB] inherit
inactive '/dev/myvg/tnms_his02' [20.00 MB] inherit
inactive '/dev/myvg/tnms_his03' [20.00 MB] inherit
inactive '/dev/myvg/tnms_his04' [20.00 MB] inherit
inactive '/dev/myvg/tnms_his05' [20.00 MB] inherit
inactive '/dev/myvg/db_bak' [5.00 GB] inherit
inactive '/dev/myvg/remainder' [20.00 MB] inherit
inactive '/dev/myvg/tnms_his06' [20.00 MB] inherit
[root@racdb2 ~]# vgexport -v myvg
Using volume group(s) on command line
Finding volume group "myvg"
Archiving volume group "myvg" metadata (seqno 36).
Creating volume group backup "/etc/lvm/backup/myvg" (seqno 37).
Volume group "myvg" successfully exported
[root@racdb2 ~]# lvscan
Volume group myvg is exported
---将本机的VG导出之后发现本机的LV全部不见了,之后又将导出的VG导回本机,LV出现了,这里没搞明白,为啥导出了本机的LV就不见了,
郁闷啊。。。。。。。无奈,只好又把导出的VG导回去,就又看到之前的LV了。
[root@racdb2 ~]# vgimport -v myvg
Using volume group(s) on command line
Finding volume group "myvg"
Archiving volume group "myvg" metadata (seqno 39).
Creating volume group backup "/etc/lvm/backup/myvg" (seqno 40).
Volume group "myvg" successfully imported
[root@racdb2 ~]# lvscan
inactive '/dev/myvg/tnms_his01' [20.00 MB] inherit
inactive '/dev/myvg/tnms_his02' [20.00 MB] inherit
inactive '/dev/myvg/tnms_his03' [20.00 MB] inherit
inactive '/dev/myvg/tnms_his04' [20.00 MB] inherit
inactive '/dev/myvg/tnms_his05' [20.00 MB] inherit
inactive '/dev/myvg/db_bak' [5.00 GB] inherit
inactive '/dev/myvg/remainder' [20.00 MB] inherit
inactive '/dev/myvg/tnms_his06' [20.00 MB] inherit
[root@racdb2 ~]# vgchange -ay myvg
8 logical volume(s) in volume group "myvg" now active
[root@racdb2 ~]# lvscan
ACTIVE '/dev/myvg/tnms_his01' [20.00 MB] inherit
ACTIVE '/dev/myvg/tnms_his02' [20.00 MB] inherit
ACTIVE '/dev/myvg/tnms_his03' [20.00 MB] inherit
ACTIVE '/dev/myvg/tnms_his04' [20.00 MB] inherit
ACTIVE '/dev/myvg/tnms_his05' [20.00 MB] inherit
ACTIVE '/dev/myvg/db_bak' [5.00 GB] inherit
ACTIVE '/dev/myvg/remainder' [20.00 MB] inherit
ACTIVE '/dev/myvg/tnms_his06' [20.00 MB] inherit
[root@racdb2 mapper]# mount /dev/myvg/db_bak /db_bak
[root@racdb2 mapper]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda1 18G 14G 2.6G 85% /
tmpfs 1.5G 154M 1.4G 11% /dev/shm
/dev/mapper/myvg-db_bak
5.0G 148M 4.6G 4% /db_bak
将备份好的/etc/lvm/backup/myvg放到备机上进行导入,过程如上;