Chinaunix首页 | 论坛 | 博客
  • 博客访问: 506536
  • 博文数量: 110
  • 博客积分: 3971
  • 博客等级: 中校
  • 技术积分: 1175
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-20 23:27
文章分类

全部博文(110)

文章存档

2015年(2)

2014年(1)

2013年(1)

2011年(9)

2010年(28)

2009年(12)

2008年(13)

2007年(23)

2006年(21)

我的朋友

分类: WINDOWS

2011-05-03 18:02:43

Step 0:When the device is being prepared for use, setup the object before mounting it.

把准备使用的设备挂载上。/dev/md2是源文件在的硬盘;/dev/sdb6是COW快照。

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1306    10490413+  fd  Linux raid autodetect
/dev/sdb2            1307        2612    10490445   83  Linux
/dev/sdb3            2613        3135     4200997+  fd  Linux raid autodetect
/dev/sdb4            3136      121601   951578145    5  Extended
/dev/sdb5            3136        3658     4200966   83  Linux
/dev/sdb6            3659        5226    12594928+  83  Linux
/dev/sdb7            5227      121601   934782156   fd  Linux raid autodetect
For reference, here is the relevent RAID info:

# cat /proc/mdstat
md2 : active raid1 sdb7[0] sda7[1]
      934782080 blocks [2/2] [UU]
# echo 0 $(blockdev --getsize /dev/md2) linear /dev/md2 0 | dmsetup create md2
Also, create a duplicate device:
同时,创建一个复制的装置
# dmsetup table md2 | dmsetup create md2_dup
Mount it:
# mount /dev/mapper/md2 /mnt/md2

Step 1: Prepare COW snapshot and finally activate it.

准备COW快照,并激活它。
# dd if=/dev/zero of=/dev/sdb6 bs=512 count=32
# dmsetup suspend md2
# echo 0 $(blockdev --getsize /dev/mapper/md2_dup) snapshot /dev/mapper/md2_dup /dev/sdb6 p 32 |dmsetup create cow
# echo 0 $(blockdev --getsize /dev/mapper/md2_dup) snapshot-origin /dev/mapper/md2_dup | dmsetup create origin
# dmsetup table origin | dmsetup load md2
# dmsetup resume md2

Notes:

  • You need both a snapshot and a snapshot-origin device.
  • 你需要两个东西:一个快照和一个快照源。
  • Step 2: Mount COW Snapshot
    # mount -o nouuid -o ro /dev/mapper/cow /mnt/md2_snap

    Notes:

  • XFS will refuse to mount without the nouuid option.
  • This example uses a readonly mount for a backup. It is also possible to "fork" the filesystem if the COW is mounted read/write. I have not tested that mode.
  • Step 3: Use the backup method of your choice to perform a backup of the frozen snapshot mounted on /mnt/md2_snap. Normal file operations will continue on "live" filesystem mounted on /mnt/md2. The specific backup method is not shown here.

    Step 4: Obtain miscellaneous statistics while snapshot is in effect

    # dmsetup table md2
    0 1869564160 snapshot-origin 253:1
    # dmsetup table md2_dup
    0 1869564160 linear 9:2 0
    # dmsetup status cow
    0 1869564160 snapshot 6496/25189857 64
    

    Step 5: Tear down the snapshot and restore to initial table to device.

    拆毁快照和恢复到最初的设置。

    # dmsetup suspend md2
    # dmsetup remove origin
    # dmsetup remove cow
    # dmsetup table md2_dup | dmsetup load md2
    # dmsetup resume md2
    

    Step 6: When ready to do another snapshot backup, jump back to Step 1.

    当准备好做另一个快照备份,再跳向第1步

     

    阅读(1728) | 评论(0) | 转发(0) |
    给主人留下些什么吧!~~