[编辑:
回答我自己的问题。
使用unison
和一些hacky后处理
(
复制粘贴unison的日志输出,
在我的文本编辑器中通过多选编辑对其进行调整,
然后对其进行一些shell脚本处理(fishshell)
)
((我还有很多灾难恢复的事情要处理,所以我想我已经完成了这目前...))
]
因此,我有一个 SSD,它曾经位于另一台计算机中,
我将其放入其中一个小型 SATA 转 USB 外壳/适配器外壳中,
将其安装为外部数据驱动器,
并用于rsync -aAX
将启动分区复制到此计算机上的一个目录,用于备份。
但后来,在发生了一些其他事件之后大概没有改变原来启动分区的内容,
我做了第二次备份。
所以现在我在这台计算机上有两个目录,
我认为是大概完全相同的备份的两个副本,
但我想确定一下。
所以我的问题是:
比较/区分这两个大备份目录的最佳方法是什么?
我考虑过/尝试过但遇到问题或不确定的事情摘要:
diff
本身rsync
“空跑”技巧unison
[(只是想到了,但由于备份太大,而且我的旧硬件速度慢,所以还没有运行完。)]
其中之一本质上是一个不错的选择吗?
如果是这样,我应该如何使用它的细节有什么更正吗?
或者我应该了解任何单独的附加选项吗?
我的尝试和结果/问题的详细信息:
diff
这样做的明显方法是“普通的“目录就像:
$ diff -r dir_A dir_B
(
或者可能 $ diff -r --no-dereference dir_A dir_B
?
我不知道;老实说,我没有正确理解它的功能--no-dereference
——这只是我发现的东西,它可以让我得到我想要的结果依稀过去有类似的情况。
)
然而,使用的问题diff
是这些目录当然非常大,
并且充满了可引导系统中的“奇怪”文件
(例如“字符特殊文件”和“块特殊文件”等)。
rsync
因此,我想到rsync
在它们之间再次使用,
进行“试运行”,看看它是否报告了它会做出的任何更改。
喜欢:
$sudo rsyncy -n -aAX dir_A dir_B --log-file=log_file
然而,后来我突然想到
- “如果有怎么办新的文件在 dir_B 中吗?”
- “rsyncy 一定会报告这一点吗?”
所以我猜你必须同时检查:
$sudo rsyncy -n -aAX --delete dir_A dir_B --log-file='log_file[A-to-B]'
和
$ sudo rsyncy -n -aAX --delete dir_B dir_A --log-file='log_file[B-to-A]'
,这开始让人感觉有点可疑,也许这毕竟不是真正适合这项工作的工具......?
我读到的日志文件:
A-to-B
#=>
2023/07/21 01:43:04 [26686] building file list
2023/07/21 02:12:24 [26686] sent 80.58M bytes received 292.46K bytes 45.93K bytes/sec
2023/07/21 02:12:24 [26686] total size is 229.29G speedup is 2,835.29 (DRY RUN)
B-to-A
2023/07/21 01:41:58 [26406] building file list
2023/07/21 02:12:15 [26406] sent 80.58M bytes received 292.50K bytes 44.49K bytes/sec
2023/07/21 02:12:15 [26406] total size is 229.29G speedup is 2,835.29 (DRY RUN)
令人烦恼的是(忽略时间戳和速度信息)几乎完全相同:
两者
sent 80.58M bytes
但微小的收到的不同:
received 292.46K bytes
vs
received 292.50K bytes
所以,是的,我再次怀疑这个rsync
技巧是否真的是适合这项工作的工具......?
也许真的是正确答案是就像:
“
只要耐心等待,让diff
运行很长时间来处理两个巨大的目录。
(您可以忽略所有有关special file
等的错误消息)
”
?
unison
[尚未确定?]
答案1
unison
这最终对我有用。
这是一致的输出数据,
加上我最后使用鱼壳对其进行的一些手动检查。
一致数据
$unison dir_A dir_B
报告了一堆unknown file type
来自可启动系统的奇怪内容的错误“”
,但总结如下:
0 items will be synced, 326 skipped
0 B to be synced from dir_A to dir_B
0 B to be synced from dir_B to dir_A
No updates to propagate
Synchronization complete at 07:40:11 (0 items transferred, 326 skipped, 0 failed)
然后是一个类似的列表
(
弹性选项卡空间对齐,
调整顺序,
并删除一堆重复行以适应堆栈交换限制
(“ Body is limited to 30000 characters; you entered 56882.
”)
):
#
skipped: dev/console (path dir_A/dev/console has unknown file type)
skipped: dev/core (path dir_A/dev/core has unknown file type)
skipped: dev/full (path dir_A/dev/full has unknown file type)
skipped: dev/hda (path dir_A/dev/hda has unknown file type)
skipped: dev/hda1 (path dir_A/dev/hda1 has unknown file type)
skipped: dev/hda10 (path dir_A/dev/hda10 has unknown file type)
skipped: dev/hda11 (path dir_A/dev/hda11 has unknown file type)
skipped: dev/hda12 (path dir_A/dev/hda12 has unknown file type)
skipped: dev/hda13 (path dir_A/dev/hda13 has unknown file type)
skipped: dev/hda14 (path dir_A/dev/hda14 has unknown file type)
skipped: dev/hda15 (path dir_A/dev/hda15 has unknown file type)
skipped: dev/hda16 (path dir_A/dev/hda16 has unknown file type)
skipped: dev/hda17 (path dir_A/dev/hda17 has unknown file type)
skipped: dev/hda18 (path dir_A/dev/hda18 has unknown file type)
skipped: dev/hda19 (path dir_A/dev/hda19 has unknown file type)
skipped: dev/hda2 (path dir_A/dev/hda2 has unknown file type)
skipped: dev/input/event0 (path dir_A/dev/input/event0 has unknown file type)
skipped: dev/input/event1 (path dir_A/dev/input/event1 has unknown file type)
skipped: dev/input/event10 (path dir_A/dev/input/event10 has unknown file type)
skipped: dev/input/event11 (path dir_A/dev/input/event11 has unknown file type)
skipped: dev/input/event12 (path dir_A/dev/input/event12 has unknown file type)
skipped: dev/input/event13 (path dir_A/dev/input/event13 has unknown file type)
skipped: dev/input/event14 (path dir_A/dev/input/event14 has unknown file type)
skipped: dev/input/event15 (path dir_A/dev/input/event15 has unknown file type)
skipped: dev/input/event16 (path dir_A/dev/input/event16 has unknown file type)
skipped: dev/input/event17 (path dir_A/dev/input/event17 has unknown file type)
skipped: dev/input/event18 (path dir_A/dev/input/event18 has unknown file type)
skipped: dev/input/event19 (path dir_A/dev/input/event19 has unknown file type)
skipped: dev/input/js0 (path dir_A/dev/input/js0 has unknown file type)
skipped: dev/input/js1 (path dir_A/dev/input/js1 has unknown file type)
skipped: dev/input/js10 (path dir_A/dev/input/js10 has unknown file type)
skipped: dev/input/js11 (path dir_A/dev/input/js11 has unknown file type)
skipped: dev/input/js12 (path dir_A/dev/input/js12 has unknown file type)
skipped: dev/input/js13 (path dir_A/dev/input/js13 has unknown file type)
skipped: dev/input/js14 (path dir_A/dev/input/js14 has unknown file type)
skipped: dev/input/js15 (path dir_A/dev/input/js15 has unknown file type)
skipped: dev/input/js16 (path dir_A/dev/input/js16 has unknown file type)
skipped: dev/input/js17 (path dir_A/dev/input/js17 has unknown file type)
skipped: dev/input/js18 (path dir_A/dev/input/js18 has unknown file type)
skipped: dev/input/js19 (path dir_A/dev/input/js19 has unknown file type)
skipped: dev/input/keyboard (path dir_A/dev/input/keyboard has unknown file type)
skipped: dev/input/mice (path dir_A/dev/input/mice has unknown file type)
skipped: dev/input/mouse (path dir_A/dev/input/mouse has unknown file type)
skipped: dev/input/mouse0 (path dir_A/dev/input/mouse0 has unknown file type)
skipped: dev/input/mouse1 (path dir_A/dev/input/mouse1 has unknown file type)
skipped: dev/input/mouse10 (path dir_A/dev/input/mouse10 has unknown file type)
skipped: dev/input/mouse11 (path dir_A/dev/input/mouse11 has unknown file type)
skipped: dev/input/mouse12 (path dir_A/dev/input/mouse12 has unknown file type)
skipped: dev/input/mouse13 (path dir_A/dev/input/mouse13 has unknown file type)
skipped: dev/input/mouse14 (path dir_A/dev/input/mouse14 has unknown file type)
skipped: dev/input/mouse15 (path dir_A/dev/input/mouse15 has unknown file type)
skipped: dev/input/mouse16 (path dir_A/dev/input/mouse16 has unknown file type)
skipped: dev/input/mouse17 (path dir_A/dev/input/mouse17 has unknown file type)
skipped: dev/input/mouse18 (path dir_A/dev/input/mouse18 has unknown file type)
skipped: dev/input/mouse19 (path dir_A/dev/input/mouse19 has unknown file type)
skipped: dev/input/uinput (path dir_A/dev/input/uinput has unknown file type)
skipped: dev/mem (path dir_A/dev/mem has unknown file type)
skipped: dev/null (path dir_A/dev/null has unknown file type)
skipped: dev/port (path dir_A/dev/port has unknown file type)
skipped: dev/ptmx (path dir_A/dev/ptmx has unknown file type)
skipped: dev/random (path dir_A/dev/random has unknown file type)
skipped: dev/sda (path dir_A/dev/sda has unknown file type)
skipped: dev/sda1 (path dir_A/dev/sda1 has unknown file type)
skipped: dev/sda10 (path dir_A/dev/sda10 has unknown file type)
skipped: dev/sda11 (path dir_A/dev/sda11 has unknown file type)
skipped: dev/sda12 (path dir_A/dev/sda12 has unknown file type)
skipped: dev/sda13 (path dir_A/dev/sda13 has unknown file type)
skipped: dev/sda14 (path dir_A/dev/sda14 has unknown file type)
skipped: dev/sda15 (path dir_A/dev/sda15 has unknown file type)
skipped: dev/tty (path dir_A/dev/tty has unknown file type)
skipped: dev/tty0 (path dir_A/dev/tty0 has unknown file type)
skipped: dev/tty1 (path dir_A/dev/tty1 has unknown file type)
skipped: dev/tty10 (path dir_A/dev/tty10 has unknown file type)
skipped: dev/tty11 (path dir_A/dev/tty11 has unknown file type)
skipped: dev/tty12 (path dir_A/dev/tty12 has unknown file type)
skipped: dev/tty13 (path dir_A/dev/tty13 has unknown file type)
skipped: dev/tty14 (path dir_A/dev/tty14 has unknown file type)
skipped: dev/tty15 (path dir_A/dev/tty15 has unknown file type)
skipped: dev/tty16 (path dir_A/dev/tty16 has unknown file type)
skipped: dev/tty17 (path dir_A/dev/tty17 has unknown file type)
skipped: dev/tty18 (path dir_A/dev/tty18 has unknown file type)
skipped: dev/tty19 (path dir_A/dev/tty19 has unknown file type)
skipped: dev/urandom (path dir_A/dev/urandom has unknown file type)
skipped: dev/zero (path dir_A/dev/zero has unknown file type)
#
skipped: tmp/runtime-username/pulse/native (path dir_A/tmp/runtime-username/pulse/native has unknown file type)
skipped: var/guix/daemon-socket/socket (path dir_A/var/guix/daemon-socket/socket has unknown file type)
skipped: var/spool/postfix/private/anvil (path dir_A/var/spool/postfix/private/anvil has unknown file type)
skipped: var/spool/postfix/private/bounce (path dir_A/var/spool/postfix/private/bounce has unknown file type)
skipped: var/spool/postfix/private/defer (path dir_A/var/spool/postfix/private/defer has unknown file type)
skipped: var/spool/postfix/private/discard (path dir_A/var/spool/postfix/private/discard has unknown file type)
skipped: var/spool/postfix/private/error (path dir_A/var/spool/postfix/private/error has unknown file type)
skipped: var/spool/postfix/private/lmtp (path dir_A/var/spool/postfix/private/lmtp has unknown file type)
skipped: var/spool/postfix/private/local (path dir_A/var/spool/postfix/private/local has unknown file type)
skipped: var/spool/postfix/private/proxymap (path dir_A/var/spool/postfix/private/proxymap has unknown file type)
skipped: var/spool/postfix/private/proxywrite (path dir_A/var/spool/postfix/private/proxywrite has unknown file type)
skipped: var/spool/postfix/private/relay (path dir_A/var/spool/postfix/private/relay has unknown file type)
skipped: var/spool/postfix/private/retry (path dir_A/var/spool/postfix/private/retry has unknown file type)
skipped: var/spool/postfix/private/rewrite (path dir_A/var/spool/postfix/private/rewrite has unknown file type)
skipped: var/spool/postfix/private/scache (path dir_A/var/spool/postfix/private/scache has unknown file type)
skipped: var/spool/postfix/private/smtp (path dir_A/var/spool/postfix/private/smtp has unknown file type)
skipped: var/spool/postfix/private/tlsmgr (path dir_A/var/spool/postfix/private/tlsmgr has unknown file type)
skipped: var/spool/postfix/private/trace (path dir_A/var/spool/postfix/private/trace has unknown file type)
skipped: var/spool/postfix/private/verify (path dir_A/var/spool/postfix/private/verify has unknown file type)
skipped: var/spool/postfix/private/virtual (path dir_A/var/spool/postfix/private/virtual has unknown file type)
skipped: var/spool/postfix/public/cleanup (path dir_A/var/spool/postfix/public/cleanup has unknown file type)
skipped: var/spool/postfix/public/flush (path dir_A/var/spool/postfix/public/flush has unknown file type)
skipped: var/spool/postfix/public/pickup (path dir_A/var/spool/postfix/public/pickup has unknown file type)
skipped: var/spool/postfix/public/postlog (path dir_A/var/spool/postfix/public/postlog has unknown file type)
skipped: var/spool/postfix/public/qmgr (path dir_A/var/spool/postfix/public/qmgr has unknown file type)
skipped: var/spool/postfix/public/showq (path dir_A/var/spool/postfix/public/showq has unknown file type)
skipped: var/tmp/audacity-username/.audacity.sock (path dir_A/var/tmp/audacity-username/.audacity.sock has unknown file type)
加上 home 下的一些东西,例如:
#
#
#
skipped: home/username/.cache/fontforge/python-socket (path dir_A/home/username/.cache/fontforge/python-socket has unknown file type)
skipped: home/username/.cache/keyring-70EDPZ/control (path dir_A/home/username/.cache/keyring-70EDPZ/control has unknown file type)
#
skipped: home/username/.copy/copyagent-overlay.socket (path dir_A/home/username/.copy/copyagent-overlay.socket has unknown file type)
#
skipped: home/username/.dropbox/command_socket (path dir_A/home/username/.dropbox/command_socket has unknown file type)
skipped: home/username/.dropbox/iface_socket (path dir_A/home/username/.dropbox/iface_socket has unknown file type)
#
#
skipped: home/username/.local/share/parcellite/fifo_c (path dir_A/home/username/.local/share/parcellite/fifo_c has unknown file type)
skipped: home/username/.local/share/parcellite/fifo_cmd (path dir_A/home/username/.local/share/parcellite/fifo_cmd has unknown file type)
skipped: home/username/.local/share/parcellite/fifo_p (path dir_A/home/username/.local/share/parcellite/fifo_p has unknown file type)
#
skipped: home/username/.steam/steam.pipe (path dir_A/home/username/.steam/steam.pipe has unknown file type)
#
skipped: home/username/Dropbox/.emacs.d/packages/gnupg/S.gpg-agent (path dir_A/home/username/Dropbox/.emacs.d/packages/gnupg/S.gpg-agent has unknown file type)
#
skipped: home/username/ax/bups/hostname/dropbox/0rolling/Dropbox/.emacs.d/packages/gnupg/S.gpg-agent (path dir_A/home/username/ax/bups/hostname/dropbox/0rolling/Dropbox/.emacs.d/packages/gnupg/S.gpg-agent has unknown file type)
我用fishshell手动检查
我在文本编辑器中使用多重选择来提取如下位:
“ (path [this bit] has unknown file type)
”
(确保转义'
路径中的任何字符),
这样我就可以像这样迭代它们(从包含and
的目录中):dir_A
dir_B
# personal functions used
# bbl
function bbl --description 'big block lines'
set -l bb $argv
if test "$bb"
for l in (string trim $bb)
string trim $l
end
else
while read -l l
set l (string trim $l)
test "$l"
and echo $l
end
end
end
# p (pretty print feedback thing)
function p
if test -n "$argv"
echo -n (set color $fish_color_comment) '#$ ' (set_color normal)
string escape --style script -- $argv |string join " " | fish_indent --ansi -i
else
while read -l x
echo -n (set color $fish_color_comment) '#$ ' (set_color normal)
string escape --style script -- $x |string join " " | fish_indent --ansi -i
end
end
end
# actually doing it
for path in (
bbl '
dir_A/dev/console
dir_A/dev/core
dir_A/dev/full
dir_A/dev/hda
dir_A/dev/hda1
dir_A/dev/hda10
dir_A/dev/hda11
dir_A/dev/hda12
dir_A/dev/hda13
dir_A/dev/hda14
dir_A/dev/hda15
dir_A/dev/hda16
dir_A/dev/hda17
dir_A/dev/hda18
dir_A/dev/hda19
dir_A/dev/hda2
dir_A/dev/input/event0
dir_A/dev/input/event1
dir_A/dev/input/event10
dir_A/dev/input/event11
dir_A/dev/input/event12
dir_A/dev/input/event13
dir_A/dev/input/event14
dir_A/dev/input/event15
dir_A/dev/input/event16
dir_A/dev/input/event17
dir_A/dev/input/event18
dir_A/dev/input/event19
dir_A/dev/input/js0
dir_A/dev/input/js1
dir_A/dev/input/js10
dir_A/dev/input/js11
dir_A/dev/input/js12
dir_A/dev/input/js13
dir_A/dev/input/js14
dir_A/dev/input/js15
dir_A/dev/input/js16
dir_A/dev/input/js17
dir_A/dev/input/js18
dir_A/dev/input/js19
dir_A/dev/input/keyboard
dir_A/dev/input/mice
dir_A/dev/input/mouse
dir_A/dev/input/mouse0
dir_A/dev/input/mouse1
dir_A/dev/input/mouse10
dir_A/dev/input/mouse11
dir_A/dev/input/mouse12
dir_A/dev/input/mouse13
dir_A/dev/input/mouse14
dir_A/dev/input/mouse15
dir_A/dev/input/mouse16
dir_A/dev/input/mouse17
dir_A/dev/input/mouse18
dir_A/dev/input/mouse19
dir_A/dev/input/uinput
dir_A/dev/mem
dir_A/dev/null
dir_A/dev/port
dir_A/dev/ptmx
dir_A/dev/random
dir_A/dev/sda
dir_A/dev/sda1
dir_A/dev/sda10
dir_A/dev/sda11
dir_A/dev/sda12
dir_A/dev/sda13
dir_A/dev/sda14
dir_A/dev/sda15
dir_A/dev/tty
dir_A/dev/tty0
dir_A/dev/tty1
dir_A/dev/tty10
dir_A/dev/tty11
dir_A/dev/tty12
dir_A/dev/tty13
dir_A/dev/tty14
dir_A/dev/tty15
dir_A/dev/tty16
dir_A/dev/tty17
dir_A/dev/tty18
dir_A/dev/tty19
dir_A/dev/urandom
dir_A/dev/zero
dir_A/tmp/runtime-username/pulse/native
dir_A/var/guix/daemon-socket/socket
dir_A/var/spool/postfix/private/anvil
dir_A/var/spool/postfix/private/bounce
dir_A/var/spool/postfix/private/defer
dir_A/var/spool/postfix/private/discard
dir_A/var/spool/postfix/private/error
dir_A/var/spool/postfix/private/lmtp
dir_A/var/spool/postfix/private/local
dir_A/var/spool/postfix/private/proxymap
dir_A/var/spool/postfix/private/proxywrite
dir_A/var/spool/postfix/private/relay
dir_A/var/spool/postfix/private/retry
dir_A/var/spool/postfix/private/rewrite
dir_A/var/spool/postfix/private/scache
dir_A/var/spool/postfix/private/smtp
dir_A/var/spool/postfix/private/tlsmgr
dir_A/var/spool/postfix/private/trace
dir_A/var/spool/postfix/private/verify
dir_A/var/spool/postfix/private/virtual
dir_A/var/spool/postfix/public/cleanup
dir_A/var/spool/postfix/public/flush
dir_A/var/spool/postfix/public/pickup
dir_A/var/spool/postfix/public/postlog
dir_A/var/spool/postfix/public/qmgr
dir_A/var/spool/postfix/public/showq
dir_A/var/tmp/audacity-username/.audacity.sock
dir_A/home/username/.cache/fontforge/python-socket
dir_A/home/username/.cache/keyring-70EDPZ/control
dir_A/home/username/.copy/copyagent-overlay.socket
dir_A/home/username/.dropbox/command_socket
dir_A/home/username/.dropbox/iface_socket
dir_A/home/username/.local/share/parcellite/fifo_c
dir_A/home/username/.local/share/parcellite/fifo_cmd
dir_A/home/username/.local/share/parcellite/fifo_p
dir_A/home/username/.steam/steam.pipe
dir_A/home/username/Dropbox/.emacs.d/packages/gnupg/S.gpg-agent
dir_A/home/username/ax/bups/hostname/dropbox/0rolling/Dropbox/.emacs.d/packages/gnupg/S.gpg-agent
'
)
#
set -l path_A .dir_A/$path
set -l path_B .dir_B/$path
# `sudo diff` doesn't work for some reason (permission still denied even with sudo). I guess a weird edgecase bug in diff.
# p sudo diff $path_A $path_B
# sudo diff $path_A $path_B
# or breakpoint
#
for x in $path_A $path_B
p sudo test -e $x
sudo test -e $x
or breakpoint
set -l size (sudo stat -c %s $x) # sudo prolly not needed?
p test $size = "0"
test $size = "0"
or breakpoint
end
end
所以我的两个备份dir_A
确实dir_B
是一样的。
(稍后我会检查所有这些奇怪的文件是否真的是原始来源中的尺寸为零。)
((我还有很多灾难恢复的事情要处理,所以我想我已经完成了这目前...))