Even easier, just encrypt the whole disk and then "lose" the decryption key. Now it's safe for sale since other's can reformat it despite the encryption that essentially made your data completely irretrievable.
Less expert with phones, but at the very least format one before selling.
Edit: having now read the article, encryption is exactly what they recommend for laptops. Excellent.
https://datarecovery.com/rd/why-does-it-take-multiple-passes...
If a drive contained state secrets, I might use /dev/urandom instead of /dev/zero, but those kinds of drives are probably just shredded.