8000 GitHub - ihavec/snapshot: kernel module for taking block-level snapshots of Linux block devices, implemented with reference to https://github.com/datto/dattobd
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

kernel module for taking block-level snapshots of Linux block devices, implemented with reference to https://github.com/datto/dattobd

Notifications You must be signed in to change notification settings

ihavec/snapshot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

这是一个不需要重启就可以给整块硬盘或分区做快照的Linux内核模块,工作在通用块设备层,可以支持大多数常见的文件系统和各种文件系统块大小。

blsnapshot.c是内核模块,基于3.10版本内核,用centos7安装好相关的编译环境后,直接make就可以编译

snapshot.c是blsnapshot.c模块的用户空间控制程序,用法是: snapshot /dev/vdb /mnt/b/cow 30
"/dev/vdb" 表示对该磁盘做快照
"/mnt/b/cow" 文件用于存储被覆盖的原始旧数据
"30" 表示预分配30兆磁盘空间给 "/mnt/b/cow" 文件

执行完成后会生成一个新的块设备用来表示原磁盘的快照,路径是/dev/snapshot0,mount此块设备就可以查看快照

实现逻辑是通过替换原块设备的make_request_fn函数拦截写入的bio,
根据此bio把将被覆盖的数据读取出来并写入到cow文件,再执行此bio。

About

kernel module for taking block-level snapshots of Linux block devices, implemented with reference to https://github.com/datto/dattobd

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0