大网数据广告活动
服务器运维问答

Is it safe to create tarball while files are in use?

· 52CE 我爱测

Is it safe to create a tarball of a directory while the files in the directory are being used (read+write)? I want to create a backup of a 20GB directory without having to shut down my application server. I don't mind if the file…

问题原文

原帖链接 · Elite_Dragon1337 · CC BY-SA 3.0

Is it safe to create a tarball of a directory while the files in the directory are being used (read+write)?

I want to create a backup of a 20GB directory without having to shut down my application server.

I don't mind if the files are changed while the tar is being created, as long as every file is present in the archive, I'm fine with it.

已采纳解答

原帖链接 · Ondra Sniper Flidr · CC BY-SA 3.0

It depends. When you're making tarbal (or rsync copy) of changing data, files will be copied in state when copy of that one file started. And that is a trap. If you will have ie. 100 files in directory, all those files will be changing during backup and backup of one file will takes 1s, last copied file will be for 99s newer than first one. This can lead to useless backup if you need all data presenting same time window (ie. you cannot backup database this way).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-07-02)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。