{"id":8346,"date":"2024-11-06T06:02:18","date_gmt":"2024-11-06T11:02:18","guid":{"rendered":"https:\/\/www.both.org\/?p=8346"},"modified":"2024-11-06T06:02:19","modified_gmt":"2024-11-06T11:02:19","slug":"securely-erasing-your-data-on-linux","status":"publish","type":"post","link":"https:\/\/www.both.org\/?p=8346","title":{"rendered":"Securely erasing your data on Linux"},"content":{"rendered":"<div class=\"pld-like-dislike-wrap pld-template-1\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"\" data-post-id=\"8346\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                        <i class=\"fas fa-thumbs-up\"><\/i>\r\n                <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">    <\/span>\r\n<\/div><\/div>\n<p>Many people choose to encrypt their disk drives because it ensures that their data stays secure and safe from the prying eyes of others. I always shy away from encrypting my disk because I don&#8217;t need that security. When one of my computers reaches the end of life, or I decide to sell it, then I take special measures to ensure that all the information is erased. I am also frequently called on to help clients dispose of old computers when they purchase new ones. What do you do when selling a computer or replacing an old spinning rust drive with a newer solid-state drive? That&#8217;s when I think of securely erasing them to remove confidential information before repurposing or disposing of them.&nbsp;<\/p>\n\n\n\n<p>Fundamentally, disk erasure on Linux serves as a versatile solution that tackles security, compliance, performance, and sustainability needs, catering to the varied demands of users. For individual usage or organizational requirements, disk erasure is a forward-thinking data management and information security strategy. Here are five commands to erase a disk on Linux:<\/p>\n\n\n\n<p>Here are five command sequences to ensure that data is securely erased from your Linux data drive(s).<\/p>\n\n\n\n<p><strong>dd<\/strong> command:<\/p>\n\n\n\n<p>This command writes zeros to the entire disk, effectively erasing all data.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo dd if=\/dev\/zero of=\/dev\/sdX bs=1M<\/code><\/pre>\n\n\n\n<p><strong>shred<\/strong> command:<\/p>\n\n\n\n<p><code>$ sudo shred -v \/dev\/sdX<\/code><\/p>\n\n\n\n<p>The <strong>shred<\/strong> command overwrites the disk multiple times, making data recovery very difficult.<\/p>\n\n\n\n<p><strong>wipe<\/strong> Command:<\/p>\n\n\n\n<p><code>$ sudo wipe -r \/dev\/sdX<\/code><\/p>\n\n\n\n<p>The <strong>wipe<\/strong> command is designed to securely erase disks by overwriting them with random data.<\/p>\n\n\n\n<p><strong>blkdiscard<\/strong> Command (for SSDs):<\/p>\n\n\n\n<p><code>$ sudo blkdiscard \/dev\/sdX<\/code><\/p>\n\n\n\n<p>This command discards all data on the specified SSD, effectively erasing it.<\/p>\n\n\n\n<p><strong>parted<\/strong> <strong>and<\/strong> <strong>mkfs<\/strong> Commands:<\/p>\n\n\n\n<p><code>$ sudo parted \/dev\/sdX mklabel gpt<br>$ sudo mkfs.ext4 \/dev\/sdX<\/code><\/p>\n\n\n\n<p>Using <strong>parted<\/strong> to create a new partition table followed by <strong>mkfs<\/strong> to format the disk erases the existing data. Replace <code>\/dev\/sdX<\/code> with your actual disk identifier. Double-check the device identifier before running these commands to avoid accidental data loss.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many people choose to encrypt their disk drives because it ensures that their data stays secure and safe<\/p>\n","protected":false},"author":32,"featured_media":4636,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[5,75],"tags":[630,628,632,631,569,629],"class_list":["post-8346","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-security","tag-blkdiscard","tag-dd","tag-mkfs","tag-parted","tag-shred","tag-wipe"],"modified_by":"David Both","_links":{"self":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/8346","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/users\/32"}],"replies":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8346"}],"version-history":[{"count":4,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/8346\/revisions"}],"predecessor-version":[{"id":8423,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/8346\/revisions\/8423"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/media\/4636"}],"wp:attachment":[{"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}