如何写回现有文件,确保磁盘上的位在OS X中被覆盖 [英] how to write back to an existing file, ensuring the bits on the disk get overwritten in OS X

查看:126
本文介绍了如何写回现有文件,确保磁盘上的位在OS X中被覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么API的Cocoa或Core Foundation,我可以用来确保当我写回一个已经存在于存储设备上的文件,这些位被写?

What API's Cocoa or Core Foundation, can I use to make sure that when I write back to a file that already exists on the storage device, that the bits get written over? The idea is to clear out the bits for security reasons.

推荐答案

在现代文件系统中,没有办法保证覆盖磁盘上的相同物理位置 - 该保证的缺少允许文件系统为您提供更好的性能。您可能有兴趣阅读本文(PDF),正确标题为

In modern filesystems, there's no way to guarantee that you are overwriting the same physical location on disk -- the lack of that guarantee allows the filesystem to offer you better performance. You might be interested in reading this paper (PDF), appropriately titled Why secure delete doesn't work and no sensitive data should ever be stored unencrypted on disk (emphasis mine).

还可以考虑 shred manpage

Consider also this warning from the shred manpage:


注意:shred依赖一个非常重要的假设:
文件系统将覆盖数据。这是传统的方式
做事情,但许多现代文件系统设计不满足这个
假设。以下是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:


  • 日志结构或日志文件系统,例如AIX和Solaris(以及JFS,ReiserFS,XFS,Ext3等)提供的文件系统。

  • log-structured or journaled file systems, such as those supplied with AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)

写入冗余数据并进行即使某些写入失败的文件系统,例如基于RAID的文件系统

file systems that write redundant data and carry on even if some writes fail, such as RAID-based file systems

创建快照的文件系统作为网络设备的NFS服务器

file systems that make snapshots, such as Network Appliance's NFS server

在临时位置缓存的文件系统,例如NFS版本3客户端

file systems that cache in temporary locations, such as NFS version 3 clients

在Cocoa或Core Foundation中允许您写入特定的磁头/磁盘/扇区/等等。在磁盘上 - 我不熟悉这些API - 但我非常怀疑。

That being said, there might be some way within Cocoa or Core Foundation to allow you to write to a specific head/cylinder/sector/etc. on a disk -- I'm not familiar enough with those APIs -- but I highly doubt it.

这篇关于如何写回现有文件,确保磁盘上的位在OS X中被覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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