User Tools

Site Tools


notes:drive_wipe

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:drive_wipe [2022/06/07 21:05] Sean Rhonenotes:drive_wipe [2024/05/02 18:27] (current) Sean Rhone
Line 1: Line 1:
 +====== Information ======
 +
 +  * Quick-commands to wipe drives and clear EFI variables
 +  * Notably performs full-drive TRIMs for SSDs ([[https://wiki.archlinux.org/title/Solid_state_drive/Memory_cell_clearing|ArchWiki]])
 +  * Useful to perform before OS installations
 +
 +  * Ideally use [[distros:opensuse_tumbleweed_gnome#xfce|openSUSE Tumbleweed's latest XFCE image]] on LiveUSB due to it having up-to-date tools, a GUI, and USB data persistence ((can copy a command into Terminal and run it on one machine, boot the drive on another machine, and use Terminal history to re-run the command; it's quite convenient :p))
 +
 ====== Tools ====== ====== Tools ======
  
Line 31: Line 39:
  
 ===== Notes ===== ===== Notes =====
 +
 +  * 2024/05/02: TODO: Try ''nvme sanitize''
 +
 +==== 4K Sectors ====
  
   * https://steamcommunity.com/discussions/forum/1/4739473745776804012/?tscn=1641033020#c3203747342915419588   * https://steamcommunity.com/discussions/forum/1/4739473745776804012/?tscn=1641033020#c3203747342915419588
   * https://steamcommunity.com/discussions/forum/1/3203745634155479256   * https://steamcommunity.com/discussions/forum/1/3203745634155479256
  
-  * :!: Steam and Oculus are known to be broken with 4K sector size on Windows 11, so 512e/LBAF=0 should be used +  * :!: Steam and Oculus were **known** to be broken with 4K sector size on Windows 11 
-  * Steam and Oculus work fine with 4K sector size on Windows 10 LTSC 2021 and Linux+  * Steam and Oculus worked fine with 4K sector size on Windows 10 LTSC 2021 and Linux 
 +  * iTunes possibly fails with 4K sectors due to Bonjour and dnssd.dll ([[https://www.techpowerup.com/forums/threads/setting-4k-sector-size-on-nvme-ssds-does-performance-actually-change.289757/page-3#post-4981622|thread]]) 
 + 
 +  * See [[#sector_size]] to check or switch to available sector disk formats
  
 ===== nvme0 ===== ===== nvme0 =====
Line 49: Line 64:
  
 <code>sudo wipefs --all --force '/dev/nvme0n1'</code> <code>sudo wipefs --all --force '/dev/nvme0n1'</code>
 +
 +==== LBA 0 ====
 +
 +  * :!: This is using LBA Format ''0'' for 512 sector size
 +
 +<code>sudo blkdiscard --force --verbose '/dev/nvme0n1' && sync && sudo nvme format '/dev/nvme0' --force --namespace-id='1' --lbaf='0' --reset --ses='1' --pil='0' --pi='0' --ms='0' && sudo rm -f '/sys/firmware/efi/efivars/'* || sync</code>
 +
 +<code>sudo nvme format '/dev/nvme0' --force --namespace-id='1' --lbaf='0' --reset --ses='1' --pil='0' --pi='0' --ms='0' && sync</code>
  
 ===== nvme1 ===== ===== nvme1 =====
  
-  * :!: This is using LBA Format ''1'' for 4K sector size+  * :!: This is using LBA Format ''0''
  
-<code>sudo blkdiscard --force --verbose '/dev/nvme1n1' && sync && sudo nvme format '/dev/nvme1' --force --namespace-id='1' --lbaf='1' --reset --ses='1' --pil='0' --pi='0' --ms='0' && sudo rm -f '/sys/firmware/efi/efivars/'* || sync</code>+<code>sudo blkdiscard --force --verbose '/dev/nvme1n1' && sync && sudo nvme format '/dev/nvme1' --force --namespace-id='1' --lbaf='0' --reset --ses='1' --pil='0' --pi='0' --ms='0' && sudo rm -f '/sys/firmware/efi/efivars/'* || sync</code>
  
 <code>sudo blkdiscard --force --verbose '/dev/nvme1n1' && sync</code> <code>sudo blkdiscard --force --verbose '/dev/nvme1n1' && sync</code>
  
-<code>sudo nvme format '/dev/nvme1' --force --namespace-id='1' --lbaf='1' --reset --ses='1' --pil='0' --pi='0' --ms='0' && sync</code>+<code>sudo nvme format '/dev/nvme1' --force --namespace-id='1' --lbaf='0' --reset --ses='1' --pil='0' --pi='0' --ms='0' && sync</code>
  
 <code>sudo wipefs --all --force '/dev/nvme1n1'</code> <code>sudo wipefs --all --force '/dev/nvme1n1'</code>
Line 97: Line 120:
  
 <code>sudo wipefs --all --force '/dev/sdc'</code> <code>sudo wipefs --all --force '/dev/sdc'</code>
- 
-===== sdd ===== 
- 
-<code>sudo blkdiscard --force --verbose '/dev/sdd' && sync && sudo hdparm --user-master u --security-set-pass 'x' '/dev/sdd' && sudo hdparm --user-master u --security-erase 'x' '/dev/sdd' && sudo hdparm --user-master u --security-set-pass 'x' '/dev/sdd' && sudo hdparm --user-master u --security-erase-enhanced 'x' '/dev/sdd' && sudo rm -f '/sys/firmware/efi/efivars/'* || sync</code> 
- 
-<code>sudo blkdiscard --force --verbose '/dev/sdd' && sync</code> 
- 
-<code>sudo hdparm --user-master u --security-set-pass 'x' '/dev/sdd' && sudo hdparm --user-master u --security-erase 'x' '/dev/sdd' && sync</code> 
- 
-<code>sudo hdparm --user-master u --security-set-pass 'x' '/dev/sdd' && sudo hdparm --user-master u --security-erase-enhanced 'x' '/dev/sdd' && sync</code> 
- 
-<code>sudo wipefs --all --force '/dev/sdd'</code> 
  
 ====== Sector Size ====== ====== Sector Size ======
/var/www/wiki/data/attic/notes/drive_wipe.1654650333.txt.gz · Last modified: 2022/06/07 21:05 by Sean Rhone