====== 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 [[linux;distros;opensuse_tumbleweed_gnome#gnome_live|openSUSE Tumbleweed's latest GNOME Live image]] on USB 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)) * TODO: Leap GNOME: https://download.opensuse.org/download/distribution/openSUSE-stable/live/openSUSE-Leap-15.6-GNOME-Live-x86_64-Media.iso ====== Notes ====== * [[linux:notes:ufs_freebsd_mount|FreeBSD UFS mount]] (from Linux LiveUSB) * [[linux:notes:disk_gpt_format|Disk Format (GPT)]] * [[linux:notes:rsync_nas|Drive-to-drive rsync]] ====== Tools ====== sudo zypper install 'nvme-cli' -y && sync sudo dnf install nvme-cli hdparm -y && sync sudo apt install 'nvme-cli' -y && sync ===== Dell Fan Speed ===== * 2024/10: Seemingly broken in new-ish/6.11+ kernels but works fine from 6.6(?) in oS Leap 15.6 sudo smbios-thermal-ctl --set-thermal-mode='performance' ====== Suspend/Wake ====== * Some motherboard firmware lock/freeze drives, and prevents some wipe commands from working * Unlocking drives can be done with a suspend and wake * :!: This applies to both SATA and NVMe drives sync && systemctl suspend ====== lsblk ====== * :!: **Always** check before running anything * :!: Assume nothing; all commands below are **immediately destructive** on the block device they're ran on lsblk ====== EFI Variables ====== **** sudo rm -f '/sys/firmware/efi/efivars/'* || sync && sudo efibootmgr -v ====== Drive Wipe ====== ===== NVMe ===== ==== Check LBA Formats ==== * Switching is done with ''nvme format --lbaf=1'' sudo nvme id-ns '/dev/nvme0' --namespace-id='1' --human-readable sudo smartctl --all '/dev/nvme0' ==== nvme0 ==== * This is using LBA Format ''0'' * Last tested: ''Samsung Electronics Co Ltd NVMe SSD Controller PM9A1/PM9A3/980PRO'' (only 1 LBA Format at ''512'') sudo blkdiscard --force --verbose '/dev/nvme0n1' && 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 === Individual === sudo blkdiscard --force --verbose '/dev/nvme0n1' sudo nvme format '/dev/nvme0' --force --namespace-id='1' --lbaf='0' --reset --ses='1' --pil='0' --pi='0' --ms='0' sudo wipefs --all --force '/dev/nvme0n1' sudo dd if='/dev/zero' of='/dev/nvme0n1' count='1024' ===== sda/b/c ===== ==== LBA Formats ==== === Check === **** sudo smartctl --all '/dev/sda' === Switch === **** sudo hdparm --set-sector-size '4096' '/dev/sda' ==== sda ==== **** sudo blkdiscard --force --verbose '/dev/sda' && sudo hdparm --user-master u --security-set-pass 'x' '/dev/sda' && sudo hdparm --user-master u --security-erase 'x' '/dev/sda' && sudo hdparm --user-master u --security-set-pass 'x' '/dev/sda' && sudo hdparm --user-master u --security-erase-enhanced 'x' '/dev/sda' && sudo rm -f '/sys/firmware/efi/efivars/'* || sync === Individual === sudo blkdiscard --force --verbose '/dev/sda' sudo hdparm --user-master u --security-set-pass 'x' '/dev/sda' && sudo hdparm --user-master u --security-erase 'x' '/dev/sda' sudo hdparm --user-master u --security-set-pass 'x' '/dev/sda' && sudo hdparm --user-master u --security-erase-enhanced 'x' '/dev/sda' sudo wipefs --all --force '/dev/sda' sudo dd if='/dev/zero' of='/dev/sda' count='1024' ==== sdb ==== **** sudo blkdiscard --force --verbose '/dev/sdb' && sudo hdparm --user-master u --security-set-pass 'x' '/dev/sdb' && sudo hdparm --user-master u --security-erase 'x' '/dev/sdb' && sudo hdparm --user-master u --security-set-pass 'x' '/dev/sdb' && sudo hdparm --user-master u --security-erase-enhanced 'x' '/dev/sdb' && sudo rm -f '/sys/firmware/efi/efivars/'* || sync === Individual === sudo blkdiscard --force --verbose '/dev/sdb' sudo hdparm --user-master u --security-set-pass 'x' '/dev/sdb' && sudo hdparm --user-master u --security-erase 'x' '/dev/sdb' sudo hdparm --user-master u --security-set-pass 'x' '/dev/sdb' && sudo hdparm --user-master u --security-erase-enhanced 'x' '/dev/sdb' sudo wipefs --all --force '/dev/sdb' sudo dd if='/dev/zero' of='/dev/sdb' count='1024' ==== sdc ==== **** sudo blkdiscard --force --verbose '/dev/sdc' && sudo hdparm --user-master u --security-set-pass 'x' '/dev/sdc' && sudo hdparm --user-master u --security-erase 'x' '/dev/sdc' && sudo hdparm --user-master u --security-set-pass 'x' '/dev/sdc' && sudo hdparm --user-master u --security-erase-enhanced 'x' '/dev/sdc' && sudo rm -f '/sys/firmware/efi/efivars/'* || sync === Individual === sudo blkdiscard --force --verbose '/dev/sdc' sudo hdparm --user-master u --security-set-pass 'x' '/dev/sdc' && sudo hdparm --user-master u --security-erase 'x' '/dev/sdc' sudo hdparm --user-master u --security-set-pass 'x' '/dev/sdc' && sudo hdparm --user-master u --security-erase-enhanced 'x' '/dev/sdc' sudo wipefs --all --force '/dev/sdc' sudo dd if='/dev/zero' of='/dev/sdc' count='1024' ====== Sector Size Notes ====== ===== 4K Sectors ===== * https://steamcommunity.com/discussions/forum/1/4739473745776804012/?tscn=1641033020#c3203747342915419588 * https://steamcommunity.com/discussions/forum/1/3203745634155479256 * :!: Steam and Oculus were **known** to be broken with 4K sector size on Windows 11 * 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|post]]) ===== Sector Size ===== * https://community.wd.com/t/sn550-why-it-uses-512b-sector-instead-of-4096/250724 * https://filers.blogspot.com/2018/12/how-to-format-nvme-drive.html * https://wiki.archlinux.org/title/Advanced_Format * https://unix.stackexchange.com/questions/562571/switching-hdd-sector-size-to-4096-bytes * https://www.thomas-krenn.com/en/wiki/Advanced_Sector_Format_of_Block_Devices