Date: Thu, 26 Jun 2025 10:28:32 -0700 From: David Christensen <dpchrist@holgerdanske.com> To: questions@freebsd.org Subject: Re: Wiping a disk partition Message-ID: <94a016fd-a4d7-4b79-aa89-ef8e13c681e6@holgerdanske.com> In-Reply-To: <CAAdA2WMj-sGqq2gcMkZWNrP6UJppaDakwLPEzDvpLor8jxDp8g@mail.gmail.com> References: <CAAdA2WNwPQzaAEjn_yJEXDq9jOZeY9FgHoNNf7pjSYkNT0ztpg@mail.gmail.com> <ec1b78d2-ecce-4a93-9aed-d050b27dd9a4@holgerdanske.com> <CAAdA2WMj-sGqq2gcMkZWNrP6UJppaDakwLPEzDvpLor8jxDp8g@mail.gmail.com>
index | next in thread | previous in thread | raw e-mail
On 6/26/25 00:38, Odhiambo Washington wrote: > On Thu, Jun 26, 2025 at 3:05 AM David Christensen wrote: >> On 6/25/25 03:16, Odhiambo Washington wrote: >>> root@gw:/home/wash # df -h >>> Filesystem Size Used Avail Capacity Mounted on >>> /dev/ada0p2 1.8T 552G 1.1T 33% / >>> devfs 1.0K 0B 1.0K 0% /dev >>> fdescfs 1.0K 0B 1.0K 0% /dev/fd >>> procfs 8.0K 0B 8.0K 0% /proc >>> linprocfs 8.0K 0B 8.0K 0% /compat/linux/proc >>> linsysfs 8.0K 0B 8.0K 0% /compat/linux/sys >>> /dev/ada1p2 1.8T 856G 802G 52% /disk2 >>> ``` >>> >>> What is the fastest way to wipe all data on /dev/ada1p2? >> >> # camcontrol security ada1 -U user -s MyPass -e MyPass > > So I looked at mine: > > ``` > root@gw:/ # camcontrol security ada1 > pass1: <Samsung SSD 870 EVO 2TB SVT02B6Q> ACS-4 ATA SATA 3.x device > pass1: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 512bytes) > > Security Option Value > supported yes > enabled no > drive locked no > security config frozen yes > count expired no > security level high > enhanced erase supported yes > erase time 4 min > enhanced erase time 8 min > master password rev fffe > ``` > > However, I actually do not need "secure erase". I only wanted to know the > fastest way of emptying the partition. Another approach could be rm(1) followed by a manual TRIM of the filesystem. This should remove the files and directories, and erase the blocks behind them, on the /disk2 filesystem. Beware of using the confusingly named trim(8) command (!): https://freebsd-hackers.freebsd.narkive.com/o3g3PuaA/how-to-use-trim-command fsck_ufs(8) appears to be the right tool for a manual TRIM. So (untested): # rm -rf /disk2/* /disk2/.?* # fsck_ufs -E /disk2 I ran `fsck_ufs -E /` on my SOHO file server, but could not tell if any TRIM commands were executed (?). Adding the debug option `-d` did not help. A third approach could be to enable TRIM on the filesystem in fstab(5), reboot, and then run rm(1). I would expect rm(1) and disk write performance to be reduced: # vi /etc/fstab /dev/ada1p2 /disk2 ufs rw 1 2 # shutdown -r now # rm -rf /disk2/* /disk2/.?* Davidhelp
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?94a016fd-a4d7-4b79-aa89-ef8e13c681e6>
