RECOVERDISK(1)
πΎ RECOVERDISK(1) β the group-chat guide πΎ
okay so bestie, buckle up, because this one is about the little tool called recoverdisk from the General Commands Manual section 1, and it literally rescues your data from disks that are actively dying. iconic behavior honestly. π«Ά
β¨ NAME β¨
recoverdisk β recover data from disk-like devices. that's it, that's the whole vibe. it goes and gets your bytes back. π
πΈ SYNOPSIS πΈ
recoverdisk [-b bigsize] [-i interval] [-r readlist] [-s interval]
[-u pattern] [-v] [-w writelist] source [destination]
π¦ DESCRIPTION π¦
So recoverdisk reads all the data from source, and it just keeps retrying read operations until they succeed. no cap, it will sit there and try again and again. if you give it a destination, then everything it reads gets written there too. π
The internal work-list can be saved and loaded, which means recoverdisk sessions can be resumed β super handy when, like, a marginal source hard-disk just shuts down mid-recovery. rude of it, but okay. π
The work-list starts out initialized with a single item that covers the entire source, and recoverdisk always chips away at the first item on the work-list. first in line, first served, periodt.
When a read succeeds, that part of the current chunk is eliminated from the work-list. slay. β¨
When a read fails, that part of the item gets appended to the worklist as a separate item, and it'll be retried in due order. and if destination is specified, the corresponding range gets filled with '_UNREAD_' so you know exactly which bits ghosted you. π
The first pass attempts to read everything in "big-size" chunks, the second pass reads in "medium-size" chunks, and the third and subsequent passes read in "small-size" chunks. this three stage process is an attempt to optimize the case where only a few bad blocks exist on source. and if too many read-errors show up, recoverdisk will fall back to smaller sizes sooner β it's adaptive, it's giving main character energy honestly.
The three sizes default to 128kB (or less if the sector size does not divide 128kB cleanly β think audio CD media, iykyk), and the reported DIOCGSTRIPESIZE and DIOCGSECTORSIZE respectively.
The options are as follows:
π OPTIONS π
-b bigsizeβ the size of reads attempted in the first pass. the chunky era. π-m mediumsizeβ the size of reads attempted in the second pass. the middle child. π-s smallsizeβ the size of reads attempted in the third and subsequent passes. tiny but mighty. π§-r work-list-fileβ read the work-list from a file. resuming your saga. β-w work-list-fileβ write the work-list to a file when a read succeed, but at most once every minute. (yes, "succeed", that's verbatim, we don't fix what the manpage wrote π ) this is your safety net bestie, use it.-l log-fileβ each successful read is logged with timestamp, offset and length. receipts. π-t totalsizeβ how many bytes should be recovered. the default is whatDIOCGMEDIASIZEreports for character and block devices, orst_sizeifsourceis a regular file.-i pauseβsleep(3)this long between reads. this reduces the load on thesourcedevice and the system in general. be gentle with it. π-p pauseβsleep(3)this long whenever a read fails. this makes thesourcedevice look less sick to the operating system. gaslight gatekeep girlboss, but for hardware. π-u patternβ by default blocks which cannot be read are filled with the pattern'_UNREAD_'in the output file. this option can be used to specify a different pattern. if the pattern is the empty string, nothing is written.-vβ produce a detailed progress report with ANSI escapes and UTF-8. pretty colors, pretty bytes. πΈ
Also super important: recoverdisk can be aborted with SIGINT, but with a sick source it may take up to several minutes before the current read operation returns from the kernel. so likeβ¦ press Ctrl+C and then go make a snack, it's not ignoring you, it's just stuck in the kernel. π
π₯ EXAMPLES π₯
# check if all sectors can be read on a USB stick:
recoverdisk /dev/da0
# recover data from failing hard drive ada3
recoverdisk /dev/ada3 /data/disk.img
# clone a hard disk
recoverdisk /dev/ada3 /dev/ada4
# read an ISO image from a CD-ROM
recoverdisk /dev/cd0 /data/cd.iso
# continue reading from a broken CD and update the existing worklist
recoverdisk -r worklist -w worklist /dev/cd0 /data/cd.iso
# recover a single file from the unreadable media
recoverdisk /cdrom/file.avi file.avi
π PRACTICAL ADVICE π
In Datamuseum.dk recoverdisk has been used to recover all sorts of data-media for two decades, and here are some things they've learned (elder wisdom, fr fr):
- Interacting with failing hardware has a tendency to crash machines, so it is always a good idea to use the
--w -work-list-fileso that it is possible to continue. (yep, that's written exactly like that in the original, we are not touching it β¨) - When attempting to recover hard to read data from failing hard disks, it pays to pamper the drive as much as possible:
- It is generally best to keep the drive in it's usual physical orientation, but it can also help to try other orientations. (again β verbatim, "it's" and all. we respect the elders π«Ά)
- Insulate the drive from external vibrations.
- Keep the drive cool with a fan.
- If possible, power the drive from a laboratory power supply.
- Do not loose patience: Let
recoverdiskrun as long as possible. (yes, "loose". iconic typo. let it run forever honestly π―οΈ) - (S)ATA controllers do not handle failing disks well, if this is a problem, use a USB-(S)ATA adapter instead.
- The
recoverdisksource code is deliberately written to be easily portable to older versions of FreeBSD and to other operating systems. - If you need to read ST-506, RLL or ESDI drives FreeBSD 3.5.1 is a good compromise.
- Sometimes forcing the disk to step between reads helps. Since
recoverdiskprocess the work-list in the order it is read, this can be accomplished by sorting the work-list with something like:
% sort +0.5
- By default the CAM layer will retry failing read operations, but that will get stuck on the bad sectors for long time and delay recovering what actually can be read from a rapidly failing drive. In that situation, set the appropriate
kern.cam.*.retry_count
sysctl to zero.
- For floppies and un-zoned hard disks (ST-506 to early IDE) set
-b bigsizeto the size of a track.
π§ SEE ALSO π§
dd(1), ada(4), cam(4), cd(4), da(4)
β HISTORY β
The recoverdisk utility first appeared in FreeBSD 7.0 because Somebodyβ’ forgot to make a backup copy. π not me tho. anyway. a whole tool, born from one person's oopsie. we love to see it.
π AUTHORS π
The original implementation was done by Poul-Henning Kamp <phk@FreeBSD.org> with minor improvements from Ulrich SpΓΆrlein <uqs@FreeBSD.org>.
This manual page was originally written by Ulrich SpΓΆrlein.
π BUGS π
- If a failing device causes the machine to crash, there is a risk that a chunk might have been successfully read and removed from the work-list, but not yet flushed to the destination. π¬
recoverdiskcallsfdatasync(3)on the destination before writing the work-list to a temporary file, and calls it again on the temporary file before renaming it to the specified-w work-file-listfilename. But even then things dont always work out. (yep, "dont". we keep it.)recoverdiskshould have an option for reconstructing the work-list from the destination by enumerating the-u patternfilled ranges.
π kudos for making it to the end of the manpage bestie, you ate that. this page came from the Debian edition and it's dated April 3, 2020. now go save some data. mwah. π β¨π
π¦ where this page comes from
- freebsd 15.1: base 15.1
- Copyright (c) 2006 Ulrich Spoerlein <uspoerlein@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms