挂载文件系统的LVM快照 [英] LVM snapshot of mounted filesystem

查看:108
本文介绍了挂载文件系统的LVM快照的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以编程方式制作Linux中实时文件系统的快照,最好使用LVM.我不想卸载它,因为我打开了很多文件(我最常见的情况是我的桌面很忙,里面有很多程序).

I'd like to programmatically make a snapshot of a live filesystem in Linux, preferably using LVM. I'd like not to unmount it because I've got lots of files opened (my most common scenario is that I've got a busy desktop with lots of programs).

我了解到,由于内核缓冲区和常规文件系统活动,磁盘上的数据可能处于或多或少的未定义状态.

I understand that because of kernel buffers and general filesystem activity, data on disk might be in some more-or-less undefined state.

有什么方法可以原子地"卸载FS,制作LVM快照并将其挂载回去?如果操作系统将阻止所有活动几秒钟以执行此任务,那将是可以的.还是某种原子的同步+快照"?内核调用?

Is there any way to "atomically" unmount an FS, make an LVM snapshot and mount it back? It will be ok if the OS will block all activity for few seconds to do this task. Or maybe some kind of atomic "sync+snapshot"? Kernel call?

我不知道是否有可能...

I don't know if it is even possible...

推荐答案

对于大多数Linux文件系统,您都不需要做任何事情.它应该完全不需要您的任何努力.快照命令本身使用正在快照的卷来搜寻已挂载的文件系统,并调用一个特殊的钩子,该钩子以一致的可挂载状态检查它们,并自动进行快照.

You shouldn't have to do anything for most Linux filesystems. It should just work without any effort at all on your part. The snapshot command itself hunts down mounted filesystems using the volume being snapshotted and calls a special hook that checkpoints them in a consistent, mountable state and does the snapshot atomically.

较早版本的LVM带有一组VFS锁定补丁程序,该补丁程序将修补各种文件系统,以便可以为快照检查点检查它们.但是有了新的内核,这些内核应该已经内置在大多数Linux文件系统中.

Older versions of LVM came with a set of VFS lock patches that would patch various filesystems so that they could be checkpointed for a snapshot. But with new kernels that should already be built into most Linux filesystems.

快照简介与此相同.

更多的研究表明,对于2.6系列的内核,ext系列的文件系统都应支持此功能. ReiserFS大概也可以.如果我认识btrfs的人,那大概也可以.

And a little more research reveals that for kernels in the 2.6 series the ext series of filesystems should all support this. ReiserFS probably also. And if I know the btrfs people, that one probably does as well.

这篇关于挂载文件系统的LVM快照的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆