码迷,mamicode.com
首页 > 其他好文 > 详细

vgexport 功能体验

时间:2014-07-10 18:05:42      阅读:266      评论:0      收藏:0      [点我收藏+]

标签:vgexport


 

两台主机dg1 dg2 其中/dev/sdc 是他们共同认到的一块盘,在dg1节点创建pvvglv 然后格式化,挂载到/mnt,存个小文件进去,卸载,导出vg,在另外节点导入,仍然能看到这个文件。

 

上次用到类似这种功能是Oracle数据迁移碰见的。由于两个库数据比较大,两个节点共同连接同一个存储,创建大vg,老库备份数据到vg上。然后卸载vg挂载到新机器上恢复。

 

下面通过Linux来模拟这个场景:

 

1  查看共享磁盘

[root@dg1 ~]# fdisk -l

 

Disk /dev/sda: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 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       2610   20860402+  8e  Linux LVM

 

Disk /dev/sdb: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start        End     Blocks   Id  System

/dev/sdb1              1        2610    20964793+  83 Linux

 

Disk /dev/sdc: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 130 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Disk /dev/sdc doesn‘t contain a valid partition table

 

 

[root@dg2 ~]# fdisk -l

 

Disk /dev/sda: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 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       2610   20860402+  8e  Linux LVM

 

Disk /dev/sdb: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start        End     Blocks   Id  System

/dev/sdb1              1        2610    20964793+  83 Linux

 

Disk /dev/sdc: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 130 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Disk /dev/sdc doesn‘t contain a valid partition table

 

2  在节点1创建pvvglv,并且格式化

[root@dg1 ~]# pvcreate /dev/sdc

  Writing physical volume data to disk "/dev/sdc"

  Physical volume "/dev/sdc" successfully created

 

[root@dg1 ~]# vgcreate -s 16M vg01 /dev/sdc

  Volume group "vg01" successfully created

 

[root@dg1 ~]# lvcreate -n lvtest -l 10 vg02

  Logical volume "lvtest" created

 

[root@dg1 ~]# mkfs.ext3 /dev/vg02/lvtest

mke2fs 1.39 (29-May-2006)

Filesystem label=

OS type: Linux

Block size=1024 (log=0)

Fragment size=1024 (log=0)

40960 inodes, 163840 blocks

8192 blocks (5.00%) reserved for the super user

First data block=1

Maximum filesystem blocks=67371008

20 block groups

8192 blocks per group, 8192 fragments per group

2048 inodes per group

Superblock backups stored on blocks:

       8193, 24577, 40961, 57345, 73729

 

Writing inode tables: done                           

Creating journal (4096 blocks): done

Writing superblocks and filesystem accounting information: done

 

This filesystem will be automatically checked every 33 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

 

3  挂载存入小文件,卸载,导出vg

[root@dg1 ~]# mount /dev/vg02/lvtest /mnt

[root@dg1 ~]# cp /etc/services /mnt

[root@dg1 ~]# umount /mnt

[root@dg1 ~]# vgchange -an /dev/vg02

  0 logical volume(s) in volume group "vg02" now active

[root@dg1 ~]# vgexport /dev/vg02

  Volume group "vg02" successfully exported

 

4  导入vg,挂载lv,查看文件

[root@dg2 ~]# vgimport /dev/vg02

  Volume group "vg02" successfully imported

 

[root@dg2 ~]# vgchange -aly vg02

  1 logical volume(s) in volume group "vg02" now active

 

[root@dg2 ~]# mount /dev/vg02/lvtest /mnt

[root@dg2 ~]# ls /mnt

lost+found  services

本文出自 “名字长一点会好记” 博客,请务必保留此出处http://xiaoyiyi.blog.51cto.com/1351449/1436555

vgexport 功能体验,布布扣,bubuko.com

vgexport 功能体验

标签:vgexport

原文地址:http://xiaoyiyi.blog.51cto.com/1351449/1436555

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!