xref: /openbsd-src/sbin/scan_ffs/scan_ffs.8 (revision 86ad6a97042a4239b16aff5c4895d9b6aeffdbe0)
1.\"	$OpenBSD: scan_ffs.8,v 1.19 2019/02/10 18:30:11 jca Exp $
2.\"
3.\" Copyright (c) 1997 Niklas Hallqvist, Tobias Weingartner
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25.\"
26.Dd $Mdocdate: February 10 2019 $
27.Dt SCAN_FFS 8
28.Os
29.Sh NAME
30.Nm scan_ffs
31.Nd find UFS/FFS partitions on a disk
32.Sh SYNOPSIS
33.Nm scan_ffs
34.Op Fl lsv
35.Op Fl b Ar begin
36.Op Fl e Ar end
37.Ar device
38.Sh DESCRIPTION
39This is the life-saver of typos.
40If you have ever been working too long,
41and just happened to type 'disklabel -w sd0 floppy', instead of 'disklabel
42-w fd0 floppy', you know what I am talking about.
43.Pp
44This little program will take a raw disk device (which you might have to
45create) that covers the whole disk, and finds all probable UFS/FFS partitions
46on the disk.
47It has various options to make it go faster, and to print out
48information to help in the reconstruction of the disklabel.
49.Pp
50.Nm
51works only on FFS file systems,
52not FFS2 file systems.
53.Pp
54The options are as follows:
55.Bl -tag -width Ds
56.It Fl b Ar begin
57Tell
58.Nm
59where to begin searching for filesystems.
60This makes it easier to skip swap
61partitions, or other large non-UFS/FFS partitions.
62.It Fl e Ar end
63Ditto for telling
64.Nm
65where to stop.
66.It Fl l
67This will make
68.Nm
69print out a string looking much like the input to disklabel.
70With a little massaging, this output can usually be used in the disklabel edit.
71.It Fl s
72This tells
73.Nm
74to be smart about skipping partitions (when it thinks it found a valid one).
75By not scanning partitions for superblocks, the program completes a couple of
76orders of magnitude faster.
77However, sometimes being smart is too good for
78its own good,
79especially if your disk has had a different layout previously, or contains
80other non-UFS/FFS filesystems.
81.It Fl v
82Tell
83.Nm
84to be verbose about what it is doing, and what it has found.
85.It Ar device
86This specifies which device
87.Nm
88should use to scan for filesystems.
89Usually this device should cover the whole disk in question.
90.El
91.Pp
92The basic operation of this program is as follows:
93.Bl -enum -width "1111"
94.It
95Panic.
96You usually do so anyways, so you might as well get it over with.
97Just don't do anything stupid.
98Panic away from your machine.
99Then relax, and see if the steps below won't help you out.
100.It
101Try to find your old disklabel by any other means possible.
102This includes
103printouts, backups
104(look in
105.Pa /var/backups/ ) ,
106screendumps, and whatever other method you can think of.
107The more information you have, the better your chances are in recovering the
108disklabel of the disk.
109.It
110Create a disklabel on the affected disk, which covers the whole disk, and has
111at least one partition which covers the whole disk.
112As the
113.Dq c
114partition
115usually covers the whole disk anyways, this sounds like a good place to start.
116.It
117Run
118.Nm
119over this partition.
120If you have any information about the disklabel
121which used to exist on the disk, keep that in mind while
122.Nm
123spews out its things.
124.It
125Use
126.Xr disklabel 8
127to reconstruct the disklabel on the affected disk, using
128all the information you gathered from
129.Nm
130and other sources.
131.El
132.Pp
133Last but certainly not least, we wish you good luck.
134The UFS/FFS filesystems are pretty sturdy.
135I've seen them reconstructed after some pretty weird and
136awesome fumbles.
137If you can't have backups, at least have funky tools to help
138you out of a jam when they happen.
139.Sh SEE ALSO
140.Xr disklabel 8
141