Bug 263746

Summary: FAQ: Exercise caution before suggesting commands that will destroy data
Product: Documentation Reporter: Graham Perrin <grahamperrin>
Component: Books & ArticlesAssignee: Sergio Carlavilla Delgado <carlavilla>
Status: Closed Overcome By Events    
Severity: Affects Many People CC: carlavilla, doc, fernape, pauamma
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
URL: https://github.com/freebsd/freebsd-doc/blob/main/documentation/content/en/books/faq/_index.adoc#810-how-do-i-use-a-new-removable-drive
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254191
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263339

Description Graham Perrin freebsd_committer freebsd_triage 2022-05-03 04:49:40 UTC
For example, under <https://docs.freebsd.org/en/books/faq/#removable-drives>: 

> # dd if=/dev/zero of=/dev/da0 count=2
> # gpart create -s GPT /dev/da0
> # gpart add -t freebsd-ufs /dev/da0

– there is no forewarning to check that the required drive is truly at 
  0    i.e. /dev/da0    before destroying (overwriting) what's there. 

Risk: dataloss (the required drive might be at /dev/da1 or elsewhere). 


I noticed this from a quick look at part of the book of frequently asked questions. Whether there's a comparable lack of caution anywhere in the FreeBSD Handbook, I don't know.
Comment 1 xxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxx 2022-05-03 06:08:38 UTC
This section specifically says:

"How do I use a new removable drive?"

New implies no need to worry about data loss.
Comment 2 Graham Perrin freebsd_committer freebsd_triage 2022-05-03 06:26:06 UTC
(In reply to JustIgnoreMe from comment #1)

1. imagine my entire photo collection at /dev/da0p1

2. you hand me a "new" drive

3. I plug it in, alongside the drive that includes my photos

4. you tell me to overwrite /dev/da0

5. I ask you to pay for restoration of lost data ;-)
Comment 3 xxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxx 2022-05-03 07:02:26 UTC
If the user cannot understand the risks in ANY formatting of a disk, he/she should not be performing such tasks.

One assumes a level of knowledge. The example newfs uses has been there for years and I personally have not noticed a wave of people complaining about being misled by an "example". I wonder if others have?

But, by all means, offer up the diffs to rectify this Pandora's box.
Comment 4 Pau Amma 2022-05-03 23:21:51 UTC
(In reply to JustIgnoreMe from comment #3)

Please read https://docs.freebsd.org/en/books/fdp-primer/overview/#overview-documentation-ecosystem before opining on the appropriateness of documentation change requests.
Comment 5 Pau Amma 2022-05-03 23:38:42 UTC
(In reply to Graham Perrin from comment #0)

Warnings in some Handbook sections eg 2.3.1.1 and 20.3.8, but not in others eg 18.6.8 and 18.13.2 (only looked for uses of dd, so likely not exhaustive).
Comment 6 xxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxx 2022-05-04 01:42:43 UTC
FAQ: "This format does not permit long and comprehensive answers."
Comment 7 Pau Amma 2022-05-05 08:13:38 UTC
(In reply to xxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxx from comment #6)

I think it would be fine as long as it's shorter than 16.3.
Comment 8 Fernando Apesteguía freebsd_committer freebsd_triage 2022-10-09 16:12:00 UTC
^Triage: reporter is committer, assign accordingly.
Comment 9 Fernando Apesteguía freebsd_committer freebsd_triage 2023-08-21 06:25:26 UTC
^Triage: Reporter is committer, assign accordingly

Any committer may commit to any repository with an accepted review from any committer with existing access to that repository.

Committers may obtain review via a Differential in Phabricator, adding the "Contributor Reviewers ($Repository)" group as a Reviewer, reaching out to other committers; directly or via mailing lists, or setting the attachment flag to: maintainer-approval ? <person-youd-like-to-review>