目錄
?️ 2. Use dd with /dev/zero (Basic Secure Wipe)
? 3. For Extra Security: Use shred
? 4. Optional: Use badblocks for Destructive Write Test
✅ Final Step: Verify the Wipe
⚠️ Important Notes:
首頁 系統教程 Linux 如何在Linux上安全刪除硬盤驅動器

如何在Linux上安全刪除硬盤驅動器

Jul 24, 2025 am 12:08 AM
linux 硬盘擦除

確認目標硬盤設備名(如/dev/sda),避免誤刪系統盤;2. 使用sudo dd if=/dev/zero of=/dev/sdX bs=1M status=progress全盤覆寫零值,適用於大多數場景;3. 敏感數據使用sudo shred -v -n 3 /dev/sdX進行三次隨機數據覆寫,確保無法恢復;4. 可選執行sudo badblocks -wsv /dev/sdX做破壞性寫入測試;最後用sudo hexdump -C /dev/sdX | head驗證是否全為零,完成安全擦除。

How to Securely Erase a Hard Drive on Linux

If you're decommissioning a hard drive, selling an old laptop, or just want to make sure your data is truly gone, simply deleting files or reformatting isn't enough. On Linux, there are reliable, built-in tools to securely erase a hard drive so data can't be recovered—even with forensic tools.

How to Securely Erase a Hard Drive on Linux

Here's how to do it right:


? 1. Identify the Correct Drive

Before doing anything, double-check which drive you're targeting— wiping the wrong one could destroy your OS or data .

How to Securely Erase a Hard Drive on Linux
 lsblk

or

 sudo fdisk -l

Look for the device name like /dev/sda , /dev/nvme0n1 , etc.
? Pro tip: Unplug all unnecessary drives to avoid mistakes.

How to Securely Erase a Hard Drive on Linux

?️ 2. Use dd with /dev/zero (Basic Secure Wipe)

This overwrites the entire drive with zeros—good for most cases:

 sudo dd if=/dev/zero of=/dev/sdX bs=1M status=progress

Replace sdX with your actual drive (eg, sda ).

  • if=/dev/zero = input is all zeros
  • of=/dev/sdX = output to your target drive
  • bs=1M = faster write speed
  • status=progress = shows real-time progress

Why this works : Overwriting with zeros makes most recovery tools useless.
⚠️ Note : This takes time—hours for large drives.


? 3. For Extra Security: Use shred

shred writes random data multiple times (default: 3 passes), making recovery nearly impossible:

 sudo shred -v -n 3 /dev/sdX
  • -v = verbose (shows progress)
  • -n 3 = 3 overwrite passes (you can use more, but 3 is usually sufficient)

? Use this if the drive held sensitive data like passwords, financial records, or personal documents.


? 4. Optional: Use badblocks for Destructive Write Test

This is overkill for most users but useful if you want to both test for bad sectors and wipe:

 sudo badblocks -wsv /dev/sdX
  • -w = destructive write test (wipes the drive)
  • -s = show progress
  • -v = verbose

This does one pass of predefined patterns —not as thorough as shred , but faster and still secure for casual use.


✅ Final Step: Verify the Wipe

After wiping, check that the drive is actually blank:

 sudo hexdump -C /dev/sdX | head

You should see only zeros (like 00000000: 00 00 00 ... ). If you see readable text or patterns, the wipe failed.


⚠️ Important Notes:

  • Unmount all partitions first :
     sudo umount /dev/sdX*
  • SSDs vs HDDs : For SSDs, use blkdiscard or the drive's built-in secure erase (via hdparm )—because wear leveling can leave data in unused blocks.
  • Physical destruction is the only 100% secure method for top-secret data—but that's beyond software.

  • Basically, for 99% of users:

    1. Identify the drive ✅
    2. Run shred -v -n 3 /dev/sdX ?
    3. Verify with hexdump

    It's not glamorous—but it's secure, simple, and uses tools already on your Linux system.

    以上是如何在Linux上安全刪除硬盤驅動器的詳細內容。更多資訊請關注PHP中文網其他相關文章!

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

熱門話題

pycharm解釋器在哪裡 解釋器位置查找方法 pycharm解釋器在哪裡 解釋器位置查找方法 May 23, 2025 pm 10:09 PM

在PyCharm中設置解釋器的位置可以通過以下步驟實現:1.打開PyCharm,點擊“File”菜單,選擇“Settings”或“Preferences”。 2.找到並點擊“Project:[你的項目名]”,然後選擇“PythonInterpreter”。 3.點擊“AddInterpreter”,選擇“SystemInterpreter”,瀏覽到Python安裝目錄,選中Python可執行文件,點擊“OK”。設置解釋器時需注意路徑正確性、版本兼容性和虛擬環境的使用,以確保項目順利運行。

參加VSCode線下技術交流活動的經驗 參加VSCode線下技術交流活動的經驗 May 29, 2025 pm 10:00 PM

參加VSCode線下技術交流活動的經驗非常豐富,主要收穫包括插件開發的分享、實戰演示和與其他開發者的交流。 1.插件開發的分享:了解瞭如何利用VSCode的插件API提升開發效率,如自動格式化和靜態分析插件。 2.實戰演示:學習瞭如何使用VSCode進行遠程開發,認識到其靈活性和擴展性。 3.與開發者交流:獲取了優化VSCode啟動速度的技巧,如減少啟動時加載的插件數量和管理插件加載順序。總之,這次活動讓我受益匪淺,強烈推薦對VSCode感興趣的人參加。

mysql安裝教程 手把手教你mysql安裝配置詳細步驟 mysql安裝教程 手把手教你mysql安裝配置詳細步驟 May 23, 2025 am 06:09 AM

MySQL的安裝和配置可以通過以下步驟完成:1.從官方網站下載適合操作系統的安裝包。 2.運行安裝程序,選擇“開發者默認”選項並設置root用戶密碼。 3.安裝後配置環境變量,確保MySQL的bin目錄在PATH中。 4.創建用戶時遵循最小權限原則並設置強密碼。 5.優化性能時調整innodb_buffer_pool_size和max_connections參數。 6.定期備份數據庫並優化查詢語句以提高性能。

linux如何限制用戶資源? ulimit怎麼配置? linux如何限制用戶資源? ulimit怎麼配置? May 29, 2025 pm 11:09 PM

Linux系統通過ulimit命令限制用戶資源,防止資源過度佔用。 1.ulimit是shell內置命令,可限製文件描述符數(-n)、內存大小(-v)、線程數(-u)等,分為軟限制(當前生效值)和硬限制(最高上限)。 2.臨時修改直接使用ulimit命令,如ulimit-n2048,但僅對當前會話有效。 3.永久生效需修改/etc/security/limits.conf及PAM配置文件,並添加sessionrequiredpam_limits.so。 4.systemd服務需在unit文件中設置Lim

Informix與MySQL在Linux上的比較 Informix與MySQL在Linux上的比較 May 29, 2025 pm 11:21 PM

Informix和MySQL均為廣受青睞的關係型數據庫管理系統,它們在Linux環境下均表現優異並得到廣泛應用。以下是對兩者在Linux平台上的對比分析:安裝與配置Informix:在Linux上部署Informix需要下載對應的安裝文件,隨後依據官方文檔指引完成安裝及配置流程。 MySQL:MySQL的安裝過程較為簡便,可通過系統的包管理工具(例如apt或yum)輕鬆實現安裝,並且網絡上有大量的教程和社區支持可供參考。性能表現Informix:Informix以卓越的性能和

Debian下Filebeat與Elasticsearch如何集成 Debian下Filebeat與Elasticsearch如何集成 May 28, 2025 pm 05:09 PM

在Debian操作系統中,實現Filebeat與Elasticsearch的集成能夠簡化日誌數據的採集、傳輸和存儲流程。以下是具體的實施步驟:第一步:部署Elasticsearch首要任務是在Debian系統中完成Elasticsearch的安裝工作。你可以從Elastic官網下載對應版本的Elasticsearch軟件包,並依據官方提供的指導完成安裝過程。下載與安裝Elasticsearchwgethttps://artifacts.elastic.co/downloads/elasticse

VSCode 插件更新後導致編輯器崩潰的原因及解決辦法 VSCode 插件更新後導致編輯器崩潰的原因及解決辦法 May 29, 2025 pm 10:03 PM

VSCode插件更新後編輯器崩潰的原因是插件與現有版本的VSCode或其他插件存在兼容性問題。解決方法包括:1.逐個禁用插件排查問題插件;2.降級問題插件到之前版本;3.尋找替代插件;4.保持VSCode和插件更新,並進行充分測試;5.設置自動備份功能以防數據丟失。

如何在Debian上實現Docker的自動化部署 如何在Debian上實現Docker的自動化部署 May 28, 2025 pm 04:33 PM

在Debian系統上實現Docker的自動化部署可以通過多樣的方法來完成,以下是詳細的步驟指南:1.安裝Docker首先,確保你的Debian系統保持最新狀態:sudoaptupdatesudoaptupgrade-y接著,安裝必要的軟件包以支持APT通過HTTPS訪問倉庫:sudoaptinstallapt-transport-httpsca-certificatescurlsoftware-properties-common-y導入Docker的官方GPG密鑰:curl-

See all articles