分类: 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 md2Notes:
Step 2: Mount COW Snapshot
# mount -o nouuid -o ro /dev/mapper/cow /mnt/md2_snap
Notes:
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步