Linux下的三种快照实现方法


1.使用LVM2工具对逻辑卷进行快照管理(最先选择的快照方式)

优点:独立快照,对数据的保护性最好,各快照间没有牵制关系

缺点:需要对每个快照分配空间,对系统空间浪费大,老的快照很可能由于超过可容修改内容而出错

*该方法只需要升级LVM2到最新,若需要进行快照还原的话,Linux内核保证2.6.33以上


2.使用device-mapper层进行multisnap快照管理(比较底层的快照方式)

优点:关联快照,节省空间

缺点:各快照间具有关联性,只可以删除最老的快照,管理型差,不能进行快照合并(只可以通过dd等方式还原快照内容)

*该方法需要对linux内核打补丁,并重新编译


3.使用LVM2管理device-mapper层的multisnap快照(对用户友好、对底层告诉节省空间)

*该方法需要对2.6.33以上Linux内核打补丁,重新编译,对LVM2工具打补丁重新编译


==========================================================================================================================

通过介绍第三种快照方式来统一

命令使用:

[root@localhost ~]# lvcreate -s --sharedstore mikulas -L 512M -c 64K /dev/vg02/lv01
Logical volume "lv01-shared" created

命令相当简单,但是你在一台普通的LINUX上是不能成功的

环境:

1.       2.6.33及以上内核的LINUX

2.       对该内核进行multisnap补丁

3.       对LVM2工具进行multisnap补丁

具体操作步骤:

1.下载Linux内核,我实现版本内核为2.6.34  www.kernel.com

2.下载 multisnap补丁(我使用的是r18)http://people.redhat.com/mpatocka/patches/kernel/new-snapshots/

3.下载 lvm2 源码(我使用的是lvm2.02.60)

4.下载 lvm2 补丁(使用的是2.02.60的补丁) http://people.redhat.com/mpatocka/patches/userspace/new-snapshots


一.首先对Linux打补丁

1)将patch文件放在Linux内核的根部录下,以以下方式打补丁
patch -p1 < dm-bufio.patch //将所有的文件dapatch
具体顺序:
# new snapshots
dm-multisnap-common.patch
dm-bufio.patch
dm-multisnap-mikulas-headers.patch
dm-multisnap-mikulas-alloc.patch
dm-multisnap-mikulas-blocks.patch
dm-multisnap-mikulas-btree.patch
dm-multisnap-mikulas-commit.patch
dm-multisnap-mikulas-delete.patch
dm-multisnap-mikulas-freelist.patch
dm-multisnap-mikulas-io.patch
dm-multisnap-mikulas-snaps.patch
dm-multisnap-mikulas-common.patch
dm-multisnap-mikulas-config.patch
dm-multisnap-daniel.patch

3)修改一下
Linux下的三种快照实现方法_第1张图片

4)注意将LANG=C,然后开始编译内核
make menuconfig;
make all ;
make modules_install ;
make install ;
reboot

内核编译完成

2. 目前可以测试device-mapper下的multisnap已经可用了,测试如下
//清空目前的逻辑卷
[root@localhost ~]# dd if=/dev/zero of=/dev/mapper/vg1-ms_base bs=4096 count=1
[root@localhost ~]# dd if=/dev/zero of=/dev/mapper/vg1-ms_snapshot bs=4096 count=1
//加载必须的模块、开机记得加载这两个模块
[root@localhost ~]# modprobe dm-store-mikulas
[root@localhost ~]# modprobe dm-multisnapshot
//准备快照卷
[root@localhost ~]# echo 0 `blockdev --getsize /dev/mapper/vg01-ms_base` multisnapshot /dev/mapper/vg01-ms_base /dev/mapper/vg01-ms_snapshot 32 0 mikulas 0|dmsetup create ms
//> multisnapshot <origin> <COW device> <chunksize><generic args> <shared COW store type><snapshot ids>
//所以32应该是chunksize | 0 应该是 通用参数
> Table line arguments:
> - <origin> : origin device
> - <COW device> : shared COW store device
> - <chunksize> : chunk size in 512b sectors
> - <# generic args> : number of generic arguments
> - <generic args> : generic arguments
> sync-snapshots --- synchronize snapshots according to the list
> preserve-on-error --- halt the origin on error in the snapshot store
> - <shared COW store type> : shared COW store type
> mikulas --- provided by the 'dm-store-mikulas' module
> daniel --- provided by the 'dm-store-daniel' module
> - <# shared COW store args> : number of arguments for shared COW store type
> - <shared COW store args> : shared COW store arguments
> cache-threshold size --- a background write is started
> cache-limit size --- a limit for metadata cache size
> If 'sync-snapshots' was specified:
> - <# snapshot ids> : number of snapshot ids
> - <snapshot ids> : snapshot ids in desired sync order
> Once this is done, you should no longer access /dev/sda and
> /dev/sdb and only use /dev/mapper/ms.
[root@localhost ~]#
[root@localhost ~]# dmsetup status /dev/mapper/ms
0 1048576 multisnapshot 5 0 - 1048576 128 128 0
//拍摄快照
[root@localhost ~]# dmsetup message /dev/mapper/ms 0 create
> DM messages:
> *) multisnapshot
> - create : creates next new snapshot id, reports created id through 'status'
> (the snapshot is created once the multisnapshot is suspended)
> - create_subsnap <snapshot id> : create subsnapshot of specified snapshot
> - delete <snapshot id> : delete the specified snapshot
[root@localhost ~]# dmsetup status /dev/mapper/ms
0 1048576 multisnapshot 5 0 0 1048576 128 128 0
> Status output:
> *) multisnapshot <# output args> <errno> <new snapid>
> <total_sectors> <sectors_allocated> <metadata_sectors>
> <# snapshot ids> <snapshot ids>
>
> Status line output arguments:
> - <# shared COW store output args> : number of output arguments before
> snapshot id list
> - <errno> : error number associated with the first error that occurred in
> the store (e.g. -EIO), 0 means the store is active with no errors
> - <new snapid> : snapshot id that will be used for next snapshot, '-' if
> no snapshot is in the process of being created
> - <total_sectors> : total size of the shared store in 512b sectors
> - <sectors_allocated> : number of sectors allocated for data and metadata
> - <metadata_sectors> : number of sectors allocated for metadata
> - <# snapshot ids> : number of snapshot ids
> - <snapshot ids> : snapshot ids for snapshots in the store
[root@localhost ms]# ll /mnt/ms0
total 16
-rw-r--r-- 1 root root 11 Aug 24 15:54 20120824155416
-rw-r--r-- 1 root root 11 Aug 24 15:54 20120824155425
-rw-r--r-- 1 root root 11 Aug 24 16:01 20120824160124
-rw-r--r-- 1 root root 11 Aug 24 16:01 20120824160125
drwx------ 2 root root 12288 Aug 24 15:49 lost+found
[root@localhost ms]# dmsetup message /dev/mapper/ms 1 create
[root@localhost ms]# dmsetup status /dev/mapper/ms
0 1048576 multisnapshot 5 0 1 1048576 416 192 1 0
//停用ms再启用ms后,才能查看快照
[root@localhost ms]# dmsetup suspend /dev/mapper/ms
[root@localhost ms]# dmsetup resume /dev/mapper/ms
//attach the snapshot(将快照附加回来,可以查看)
[root@localhost ms]# echo 0 `blockdev --getsize /dev/mapper/vg01-ms_base` multisnap-snap /dev/mapper/vg01-ms_base 1 |dmsetup create ms1
> *) multisnap-snap <origin> <snapshot id>
>
> Table line arguments:
> - <origin> : origin device
> - <snapshot id> : id of the snapshot within the shared store
> *) Delete the snapshot:
> dmsetup message /dev/mapper/ms 0 delete <snapID>
> *) Unload it:
> dmsetup remove ms
> dmsetup remove ms0
//查看快照效果
[root@localhost ms]# mkdir /mnt/ms1
[root@localhost ms]# mount /dev/mapper/ms1 /mnt/ms1
[root@localhost ms]# ll /mnt/ms1
total 18
-rw-r--r-- 1 root root 11 Aug 24 15:54 20120824155416
-rw-r--r-- 1 root root 11 Aug 24 15:54 20120824155425
-rw-r--r-- 1 root root 11 Aug 24 16:01 20120824160124
-rw-r--r-- 1 root root 11 Aug 24 16:01 20120824160125
-rw-r--r-- 1 root root 11 Aug 24 16:15 20120824161553
-rw-r--r-- 1 root root 11 Aug 24 16:15 20120824161554
drwx------ 2 root root 12288 Aug 24 15:49 lost+found
[root@localhost ms]# ll /mnt/ms0
total 16
-rw-r--r-- 1 root root 11 Aug 24 15:54 20120824155416
-rw-r--r-- 1 root root 11 Aug 24 15:54 20120824155425
-rw-r--r-- 1 root root 11 Aug 24 16:01 20120824160124
-rw-r--r-- 1 root root 11 Aug 24 16:01 20120824160125
drwx------ 2 root root 12288 Aug 24 15:49 lost+found
[root@localhost ms]# ll /mnt/ms
total 18
-rw-r--r-- 1 root root 11 Aug 24 15:54 20120824155416
-rw-r--r-- 1 root root 11 Aug 24 15:54 20120824155425
-rw-r--r-- 1 root root 11 Aug 24 16:01 20120824160124
-rw-r--r-- 1 root root 11 Aug 24 16:01 20120824160125
-rw-r--r-- 1 root root 11 Aug 24 16:15 20120824161553
-rw-r--r-- 1 root root 11 Aug 24 16:15 20120824161554
drwx------ 2 root root 12288 Aug 24 15:49 lost+found
//例子:
1.可以看到,创建时的0还不是很明确意思,但是0就可以了
2.在status时就可以看到快照数目变为3个了,目前快照号有3 0 1 2
[root@localhost ms]# dmsetup message /dev/mapper/ms 0 create
[root@localhost ms]# dmsetup status /dev/mapper/ms
0 1048576 multisnapshot 5 0 3 1048576 736 192 3 0 1 2
[root@localhost ms]# dmsetup suspend /dev/mapper/ms
[root@localhost ms]# dmsetup resume /dev/mapper/ms
[root@localhost ms]# echo 0 `blockdev --getsize /dev/mapper/vg01-ms_base` multisnap-snap /dev/mapper/vg01-ms_base 3 |dmsetup create ms3
[root@localhost ms]# mkdir /mnt/ms3
[root@localhost ms]# mount /dev/mapper/ms3 /mnt/ms3
[root@localhost ms]# ll /mnt/ms3
总计 20
-rw-r--r-- 1 root root 11 08-24 15:54 20120824155416
-rw-r--r-- 1 root root 11 08-24 15:54 20120824155425
-rw-r--r-- 1 root root 11 08-24 16:01 20120824160124
-rw-r--r-- 1 root root 11 08-24 16:01 20120824160125
-rw-r--r-- 1 root root 11 08-24 16:15 20120824161553
-rw-r--r-- 1 root root 11 08-24 16:15 20120824161554
-rw-r--r-- 1 root root 11 08-26 10:17 20120826101049
-rw-r--r-- 1 root root 11 08-26 10:17 20120826101051
drwx------ 2 root root 12288 08-24 15:49 lost+found
//重启后的测试、快照依然可用
[root@localhost ~]# lsmod | grep dm
dm_store_mikulas 40001 0
dm_multisnapshot 17332 1 dm_store_mikulas
dm_multipath 13659 0
scsi_dh 4512 1 dm_multipath
dm_snapshot 24203 3
dm_zero 1095 0
dm_mirror 11238 0
dm_region_hash 6060 1 dm_mirror
dm_log 7551 2 dm_mirror,dm_region_hash
dm_mod 51689 28 dm_store_mikulas,dm_multisnapshot,dm_multipath,dm_snapshot,dm_zero,dm_mirror,dm_log
[root@localhost ~]# echo 0 `blockdev --getsize /dev/mapper/vg01-ms_base` multisnapshot /dev/mapper/vg01-ms_base /dev/mapper/vg01-ms_snapshot 32 0 mikulas 0|dmsetup create ms
[root@localhost ~]# echo 0 `blockdev --getsize /dev/mapper/vg01-ms_base` multisnap-snap /dev/mapper/vg01-ms_base 0 |dmsetup create ms0
[root@localhost ~]# echo 0 `blockdev --getsize /dev/mapper/vg01-ms_base` multisnap-snap /dev/mapper/vg01-ms_base 1 |dmsetup create ms1
[root@localhost ~]# echo 0 `blockdev --getsize /dev/mapper/vg01-ms_base` multisnap-snap /dev/mapper/vg01-ms_base 2 |dmsetup create ms2
[root@localhost ~]# echo 0 `blockdev --getsize /dev/mapper/vg01-ms_base` multisnap-snap /dev/mapper/vg01-ms_base 3 |dmsetup create ms3
[root@localhost ~]# dmsetup ls --target multisnapshot
ms (253, 8)
[root@localhost ~]# dmsetup ls --target multisnap-snap
ms3 (253, 12)
ms2 (253, 11)
ms1 (253, 10)
ms0 (253, 9)
[root@localhost ~]# dmsetup table
ms3: 0 1048576 multisnap-snap 253:6 3
ms2: 0 1048576 multisnap-snap 253:6 2
vg01-lv01-real: 0 1048576 linear 8:17 384
ms1: 0 1048576 multisnap-snap 253:6 1
ms0: 0 1048576 multisnap-snap 253:6 0
ms: 0 1048576 multisnapshot 253:6 253:7 32 0 mikulas 0
vg01-lv01_snap1-cow: 0 24576 linear 8:17 1073536
vg01-ms_snapshot: 0 1048576 linear 8:17 2146688
VolGroup00-LogVol01: 0 4128768 linear 8:2 37552512
vg01-ms_base: 0 1048576 linear 8:17 1098112
VolGroup00-LogVol00: 0 37552128 linear 8:2 384
vg01-lv01: 0 1048576 snapshot-origin 253:2
vg01-lv01_snap1: 0 1048576 snapshot 253:2 253:4 P 8
//快照删除
[root@localhost ~]# dmsetup message /dev/mapper/ms 0 delete 0
[root@localhost ~]# umount /dev/mapper/ms0
[root@localhost ~]# dmsetup remove ms0
[root@localhost ~]# dmsetup message /dev/mapper/ms 0 delete 3
[root@localhost ~]# umount /dev/mapper/ms3
[root@localhost ~]# dmsetup remove ms3
[root@localhost ~]# dmsetup status /dev/mapper/ms
0 1048576 multisnapshot 5 0 - 1048576 512 192 2 1 2
[root@localhost ~]# dmsetup ls --target multisnap-snap
ms2 (253, 11)
ms1 (253, 10)
经测试发现可以删除任何版本的快照
但是重启后,无法将快照原卷和快照卷组合为ms,但是换个名字可以。。。了!!
猜测在重启前将ms关闭,大概就不会出类似问题了
//如何进行快照还原



 3.重新编译LVM2先对LVM2打补丁,方式还是和给LINUX打补丁类似 
   
  
patch -p1 < dm-bufio.patch
补丁顺序
# Tested to apply (and work) on: lvm2.git v2_02_64

lvm-merge-log-print.patch

# Shared snapshots
lvm-refactor-exception-type.patch
lvm-shared-lvcreate.patch
lvm-shared-add-argument-to-vg_add_snapshot.patch
lvm-shared-new-segment-type.patch
lvm-shared-fixed-name.patch
lvm-shared-snapshot-flag.patch
device-mapper-shared-target.patch
lvm-shared-make-pointer-from-origin-to-shared-snapshot.patch
lvm-shared-activate.patch
lvm-shared-handle-activation-error.patch

lvm-shared-snapshot-segment-type.patch
lvm-shared-allow-no-size.patch
lvm-shared-test-free-space-after-setting-segtype.patch
lvm-shared-dev-manager.patch
lvm-shared-create-snapshot.patch
lvm-shared-no-snapshot-of-snapshot.patch
lvm-shared-delete-message.patch
lvm-shared-dont-deactivate-origin-when-deactivating-snapshot.patch
lvm-shared-deactivate-snapshots-with-origin.patch
lvm-shared-remove-snapshots-with-origin.patch
lvm-shared-activate-shared-origin-with-the-snapshot.patch
lvm-shared-dont-shrink-shared-volume.patch
lvm-shared-noexplicit-segment.patch
lvm-dont-merge-shared-store.patch
lvm-last-seg.patch
lvm-shared-resize-virtual-snapshot.patch
lvm-shared-cleanup-on-activate.patch
lvm-shared-status.patch
lvm-shared-status-percent.patch
lvm-shared-snapshot-of-snapshot.patch

# Patches by [email protected]:
lvm-shared-additional-wrappers.patch
lvm-shared-eliminate-shared_snapshot-in-lv.patch
lvm-shared-vorigin-segv-fix.patch
lvm-shared-add-ACCESS_HIDDEN_LV-flag.patch

# by Mikulas
lvm-refactor-chunksize-validation.patch
lvm-shared-big-chunksize.patch
lvm-merge-function-onactivate.patch

lvm-shared-merge.patch
lvm-shared-merge-dont-delete.patch

编译LVM2
aclocal
autoconf
./configure
make
make install
[root@localhost bin]# ll /sbin/lvcreate //此处为刚安装的lvcreate
lrwxrwxrwx 1 root root 3 08-27 00:29 /sbin/lvcreate -> lvm
由于还有一个在/usr/sbin/下,系统本来装的
将/sbin下的占到/usr/sbin下,将原lvm作为lvm_old
4.尝试LVM2管理multisnap
//创建快照卷
[root@localhost ~]# lvcreate -s --sharedstore mikulas -L 512M -c 64K /dev/vg02/lv01
Logical volume "lv01-shared" created
//创建快照
[root@localhost ~]# lvcreate -s -n snap_$(date -d "today" +"%Y%m%s%H%I%S") /dev/vg02/lv01
Logical volume "snap_2012081346132205130145" created
//查看目前卷情况,可以看到加了快照以后,快照卷被占用了0.07%
[root@localhost ~]# lvs
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
LogVol00 VolGroup00 -wi-ao 17.91G
LogVol01 VolGroup00 -wi-ao 1.97G
lv01 vg02 owi-a- 512.00M
lv01-shared vg02 swi--- 512.00M lv01 0.07
snap_2012081346132205130145 vg02 swi-a- 512.00M lv01
[root@localhost ~]# mkfs.ext3 /dev/vg02/lv01
[root@localhost ~]# mkdir /mnt/lv01_2012081346132205130145
//第一个快照是没有文件系统的,所以无法挂载
[root@localhost ~]# mount /dev/vg02/snap_2012081346132205130145 /mnt/lv01_2012081346132205130145
mount: you must specify the filesystem type
[root@localhost ~]# lvcreate -s -n snap_$(date -d "today" +"%Y%m%s%H%I%S") /dev/vg02/lv01
Logical volume "snap_2012081346132657130117" created
[root@localhost ~]# mkdir /mnt/snap_2012081346132657130117
//第二个快照是在创建文件系统后拍摄的,所以可以挂载,但内容为空
[root@localhost lv01]# ll /mnt/snap_2012081346132657130117/
总计 12
drwx------ 2 root root 12288 08-28 13:37 lost+found
[root@localhost ~]# mount /dev/vg02/snap_2012081346132657130117 /mnt/snap_2012081346132657130117
[root@localhost ~]# cd /mnt/lv01
[root@localhost lv01]# touch $(date -d "today" +"%Y%m%s%H%I%S")
[root@localhost lv01]# touch $(date -d "today" +"%Y%m%s%H%I%S")
//第三个快照是创建了一些数据后拍摄的,所以可以挂载且有内容
[root@localhost lv01]#lvcreate -s -n snap_$(date -d "today" +"%Y%m%s%H%I%S") /dev/vg02/lv01
Logical volume "snap_2012081346132744130144" created
[root@localhost lv01]# mkdir /mnt/snap_2012081346132744130144
[root@localhost lv01]# mount /dev/vg02/snap_2012081346132744130144 /mnt/snap_2012081346132744130144
[root@localhost lv01]# ll /mnt/snap_2012081346132744130144
总计 12
-rw-r--r-- 1 root root 0 08-28 13:45 2012081346132730130130
-rw-r--r-- 1 root root 0 08-28 13:45 2012081346132731130131
drwx------ 2 root root 12288 08-28 13:37 lost+found
[root@localhost lv01]# touch $(date -d "today" +"%Y%m%s%H%I%S")
[root@localhost lv01]# touch $(date -d "today" +"%Y%m%s%H%I%S")
//目前原卷情况
[root@localhost lv01]# ll
总计 12
-rw-r--r-- 1 root root 0 08-28 13:45 2012081346132730130130
-rw-r--r-- 1 root root 0 08-28 13:45 2012081346132731130131
-rw-r--r-- 1 root root 0 08-28 13:46 2012081346132801130141
-rw-r--r-- 1 root root 0 08-28 13:46 2012081346132802130142
drwx------ 2 root root 12288 08-28 13:37 lost+found
[root@localhost lv01]# lvs
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
LogVol00 VolGroup00 -wi-ao 17.91G
LogVol01 VolGroup00 -wi-ao 1.97G
lv01 vg02 owi-ao 512.00M
lv01-shared vg02 swi--- 512.00M lv01 7.36
snap_2012081346132205130145 vg02 swi-a- 512.00M lv01
snap_2012081346132657130117 vg02 swi-ao 512.00M lv01
snap_2012081346132744130144 vg02 swi-ao 512.00M lv01
snap_2012081346133323130123 vg02 swi-a- 512.00M lv01
[root@localhost lv01]#
//删除快照测试
1.删除最老的快照 snap_2012081346132205130145,【在未重启原卷情况下,其他快照均正常
[root@localhost lv01]# lvremove /dev/vg02/snap_2012081346132205130145
Do you really want to remove active logical volume snap_2012081346132205130145? [y/n]: y
Logical volume "snap_2012081346132205130145" successfully removed
[root@localhost lv01]# lvs
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
LogVol00 VolGroup00 -wi-ao 17.91G
LogVol01 VolGroup00 -wi-ao 1.97G
lv01 vg02 owi-ao 512.00M
lv01-shared vg02 swi--- 512.00M lv01 0.18
snap_2012081346132657130117 vg02 swi-ao 512.00M lv01
snap_2012081346132744130144 vg02 swi-ao 512.00M lv01
snap_2012081346133323130123 vg02 swi-a- 512.00M lv01
[root@localhost lv01]# ll /mnt/snap_2012081346132657130117
总计 12
drwx------ 2 root root 12288 08-28 13:37 lost+found
[root@localhost lv01]# ll /mnt/snap_2012081346132744130144
总计 12
-rw-r--r-- 1 root root 0 08-28 13:45 2012081346132730130130
-rw-r--r-- 1 root root 0 08-28 13:45 2012081346132731130131
drwx------ 2 root root 12288 08-28 13:37 lost+found
[root@localhost lv01]# ll
总计 12
-rw-r--r-- 1 root root 0 08-28 13:45 2012081346132730130130
-rw-r--r-- 1 root root 0 08-28 13:45 2012081346132731130131
-rw-r--r-- 1 root root 0 08-28 13:46 2012081346132801130141
-rw-r--r-- 1 root root 0 08-28 13:46 2012081346132802130142
drwx------ 2 root root 12288 08-28 13:37 lost+found
[root@localhost lv01]#
//重启原卷,发现所有逻辑卷均失效,但可能因为前两个有挂载,再试一次
[root@localhost lv01]# fuser -m /dev/vg02/lv01
/dev/vg02/lv01: 3878c
[root@localhost lv01]# kill -9 3878
[root@localhost ~]# umount /dev/vg02/lv01
[root@localhost ~]# lvchange -an /dev/vg02/lv01
[root@localhost ~]# lvchange -ay /dev/vg02/lv01
/dev/mapper/vg02-snap_2012081346132657130117: read failed after 0 of 2048 at 0: 输入/输出错误
/dev/mapper/vg02-snap_2012081346132744130144: read failed after 0 of 2048 at 0: 输入/输出错误
[root@localhost ~]#
[root@localhost ~]# lvs
/dev/mapper/vg02-snap_2012081346132657130117: read failed after 0 of 2048 at 0: 输入/输出错误
/dev/mapper/vg02-snap_2012081346132744130144: read failed after 0 of 2048 at 0: 输入/输出错误
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
LogVol00 VolGroup00 -wi-ao 17.91G
LogVol01 VolGroup00 -wi-ao 1.97G
lv01 vg02 owi-a- 512.00M
lv01-shared vg02 swi--- 512.00M lv010.18
snap_2012081346132657130117 vg02 swi-ao 512.00M lv01
snap_2012081346132744130144 vg02 swi-ao 512.00M lv01
snap_2012081346133323130123 vg02 swi--- 512.00M lv01


===========================================================================================================================================
可能的错误

lvcreate -s --sharedstore mikulas -c 64k -L 512M /dev/vg01/lv01

lvcreate:无法识别的选项"--sharedstore"

Error during parsing of command line

解答:重新给LVM打补丁并编译LVM工具,如上问3


[root@localhost LVM2. 2. 02. 73] # lvcreate -s --sharedstore mikulas -c 64k -L 512M /dev/vg02/lv01
WARNING : Unrecognised segment type multisnapshot
Cannot update volume group vg02 with unknown segments in it !
解答:打完LVM补丁后,为进行aclocal和autoconf对makefile进行整理


[root@localhost LVM2. 2. 02. 73] # lvcreate -s --sharedstore mikulas -L 512M -c 64K /dev/vg02/lv01
lvcreate : relocation error : lvcreate : symbol dm_tree_node_add_snapshot_shared_target, version Base not defined in file libdevmapper.so. 1. 02 with link time reference

解答:如果是64位的机器,需要将编译完的lvm同时不知道lib64下, 系统使用的是 /lib64/下的libdevmapper.so.1.02 ,那里并没被更新,从 /lib/拷过来就行了


你可能感兴趣的:(Linux下的三种快照实现方法)