优点:独立快照,对数据的保护性最好,各快照间没有牵制关系
缺点:需要对每个快照分配空间,对系统空间浪费大,老的快照很可能由于超过可容修改内容而出错
*该方法只需要升级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打补丁
# 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
# 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
lvcreate -s --sharedstore mikulas -c 64k -L 512M /dev/vg01/lv01
lvcreate:无法识别的选项"--sharedstore"
Error during parsing of command line
解答:重新给LVM打补丁并编译LVM工具,如上问3