GNU/Linux 销毁资料:Shred
2018-07-25 13:53 更新
过去在 GNU/Linux 里,冻仁会使用 dd
,此指令会将资料填零而达到抹除磁盘的功用,但就算这样还是有被专业人士还原的风险;现在冻仁都改用 shred
指令来完成这项任务,此指令是专门用来撕碎资料的。
dd
将 /dev/sdX 装置填零。
dd if=/dev/zero of=/dev/sdX bs=1M
shred
开始 shred 之前,您必须先安装 coreutils 套件。
$ sudo aptitude install coreutils # -v 显示进度。 # -f 强制写入,必要时允许变更权限写入。 # -z 用零覆写并撕碎。 # -n 指定覆写次数。 # -n 指定覆写次数。
抹除硬盘
$ sudo shred -vfz -n 10 /dev/sdX shred: /dev/sdX:11 次之第 1 次 (random)... shred: /dev/sdX:11 次之第 1 次 (random)...471MiB/932GiB 0% shred: /dev/sdX:11 次之第 1 次 (random)...472MiB/932GiB 0% shred: /dev/sdX:11 次之第 1 次 (random)...949MiB/932GiB 0% ......
抹除档案
$ shred -vu -n 10 hello-sherd.txt shred: hello-sherd.txt: pass 1/3 (random)... shred: hello-sherd.txt: pass 2/3 (random)... shred: hello-sherd.txt: pass 3/3 (random)... shred: hello-sherd.txt: removing shred: hello-sherd.txt: renamed to 000000000000000 shred: 000000000000000: renamed to 00000000000000 shred: 00000000000000: renamed to 0000000000000 shred: 0000000000000: renamed to 000000000000 shred: 000000000000: renamed to 00000000000 shred: 00000000000: renamed to 0000000000 shred: 0000000000: renamed to 000000000 shred: 000000000: renamed to 00000000 shred: 00000000: renamed to 0000000 shred: 0000000: renamed to 000000 shred: 000000: renamed to 00000 shred: 00000: renamed to 0000 shred: 0000: renamed to 000 shred: 000: renamed to 00 shred: 00: renamed to 0 shred: hello-sherd.txt: removed
※ shred 在 ext3, ext4 这类的日志档案系统上运作时可能无法完整清除,若真不放心可以试试 hdparm。
资料来源
以上内容是否对您有帮助:
更多建议: