Re: Wiping a disk partition
- Reply: David Christensen : "Re: Wiping a disk partition"
- In reply to: David Christensen : "Re: Wiping a disk partition"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 03 Jul 2025 09:24:20 UTC
On Thu, Jul 3, 2025 at 4:09 AM David Christensen <dpchrist@holgerdanske.com> wrote: > On 7/2/25 01:18, Odhiambo Washington wrote: > > My question was "What is the fastest way to wipe all data on > /dev/ada1p2?" > > It looks like delete, wipe, and erase all have different meanings here. > > I should have explained that "rm -rf" would take a long time, so I > needed a > > faster command. > > I didn't even want a secure erase, just the deletion. > > I concluded that there is no straight answer to my question. > > > I tend to think of "remove" in terms of file system metadata only -- > e.g. rm(1). > > > I tend to think of "erase" in terms of file system data and metadata -- > e.g. shred(1). But, journals, copy-on-write, snapshots, wear leveling, > etc., can defeat true destruction of data if the software tool and/or > storage API/DDI stack are not specified designed for such. Research and > verification would be required. > > > I tend to use "wipe" for entire drives -- security erase if available, > shred(1) or dd(1) /dev/zero if not. > > > If rm(1) is too slow because you have a huge number of small files and > if you do not care about leftover data on disk, the only tool I can > think of that might be faster would be newfs(8). > > > > What I ended up doing was > > dd if=/dev/ada1 of=/dev/ada2 bs=1g status=progress > > The 2nd disk is a replica of the 1st disk, and I use it only for > creating a > > backup of the first disk. > > > I assume you mean (?): > > dd if=/dev/ada0 of=/dev/ada1 bs=1g status=progress > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Yes! That should work if you boot from ada0p2 into single-user mode, ada0p2 > is mounted read-only, and ada1p2 not mounted. But, if both drives are > installed (such as to recover files), you might have problems if > fstab(5), etc., uses UUID's. > What I did was: umount /disk2 dd if=/dev/ada0 of=/dev/ada1 bs=1g status=progress -- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 In an Internet failure case, the #1 suspect is a constant: DNS. "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-) [How to ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html]