如何安全地破坏/擦除硬盘上的数据与shred

如何安全地破坏/擦拭硬盘上的数据与碎片

有时您需要从硬盘驱动器中销毁或擦除数据(例如,在eBay上销售旧硬盘驱动器之前),以便其他人无法访问它们。 简单地删除数据(例如使用rm)是不够的,因为它只是删除文件系统指针而不是数据,因此可以轻松地使用恢复软件取消删除数据。 即使将您的硬盘驱动器清零可能还不够。 这里是shred进行播放 - shred可以重复覆盖文件和分区,以便使甚至非常昂贵的硬件探测更难以恢复数据。

我不会保证这将为您工作!

1初步说明

碎片可用于擦除文件以及分区和硬盘驱动器。 如果你看看shred的手册页...

man shred

你可能会注意到以下几点:

CAUTION: Note that shred relies on a very important assumption: that the file system overwrites data in place. This is the traditional way to do things, but many modern file system designs do not satisfy this assumption. The following are examples of file systems on which shred is not effective, or is not guaranteed to be effective in all file system modes:
* log-structured or journaled file systems, such as those supplied with AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)
* file systems that write redundant data and carry on even if some writes fail, such as RAID-based file systems
* file systems that make snapshots, such as Network Appliance's NFS server
* file systems that cache in temporary locations, such as NFS version 3 clients
* compressed file systems
In the case of ext3 file systems, the above disclaimer applies (and shred is thus of limited effectiveness) only in data=journal mode, which journals file data in addition to just metadata. In both the data=ordered (default) and data=writeback modes, shred works as usual. Ext3 journaling modes can be changed by adding the data=something option to the mount options for a particular file system in the /etc/fstab file, as documented in the mount man page (man mount).

只有当您使用shred擦除文件时,才需要担心。 但是,当我想要擦拭硬盘驱动器时,我将在本教程中使用整个分区或硬盘驱动器。

2使用碎片

如果要擦除系统分区,您必须启动到实时系统(如Knoppix,Ubuntu Live-CD,您的主机的救援系统等)。 如果您不想擦除系统分区,则不需要。

已经安装了碎片(你可以检查一下

which shred

); 如果不是你可以安装它如下(Debian / Ubuntu / Knoppix):

apt-get install coreutils

如前所述,我想在分区和硬盘上使用碎纸。 所以,例如,要擦除分区/ dev / sda5,可以使用

shred -vfz -n 10 /dev/sda5

-v :显示进度

-f :更改权限以允许写入(如有必要)

-z :使用零添加最终覆盖以隐藏切丝

-n :覆盖N次而不是默认(3)

所以这将覆盖/ dev / sda5十次。

您也可以使用碎片进行RAID分区,例如

shred -vfz -n 10 /dev/md1

要擦拭像/ dev / sda这样的完整硬盘驱动器,可以使用

shred -vfz -n 10 /dev/sda

请注意,碎片可能需要很长时间,具体取决于分区/硬盘驱动器的大小和运行次数( -n )。

赞(52) 打赏
未经允许不得转载:优客志 » 系统运维
分享到:

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏