My Disk Archiving Workflow
Identifying disk
ls -lh /dev/disk/by-id/ata-*
Creating disk image
ddrescue /dev/disk/by-id/ata-SB8000NM1234-123456_DEADCAFE ata-SB8000NM1234-123456_DEADCAFE.img ata-SB8000NM1234-123456_DEADCAFE.txt
GNU ddrescue - Data recovery tool. Copies data from one file or block device to another, trying to rescue the good parts first in case of read errors. Usage: ddrescue [options] infile outfile [mapfile] Always use a mapfile unless you know you won't need it. Without a mapfile, ddrescue can't resume a rescue, only reinitiate it.
Creating hash and recovery records
par2 create -r3 -b3000 ata-SB8000NM1234-123456_DEADCAFE.img.par2 ata-SB8000NM1234-123456_DEADCAFE.img
Usage: par2 c(reate) [options] <PAR2 file> [files] : Create PAR2 files Options: (create) -b<n> : Set the Block-Count -s<n> : Set the Block-Size (don't use both -b and -s) -r<n> : Level of redundancy (%%) -r<c><n> : Redundancy target size, <c>=g(iga),m(ega),k(ilo) bytes -c<n> : Recovery Block-Count (don't use both -r and -c) -l : Limit size of recovery files (don't use both -u and -l) -n<n> : Number of recovery files (don't use both -n and -l)
Wiping disk
badblocks -s -v -b 4096 -t random -o badblocks.txt -w /dev/disk/by-id/ata-SB8000NM1234-123456_DEADCAFE
NAME badblocks - search a device for bad blocks OPTIONS -s Show the progress of the scan by writing out rough percentage completion of the current badblocks pass over the disk. Note that badblocks may do multiple test passes over the disk, in particular if the -p or -w option is requested by the user. -v Verbose mode. Will write the number of read errors, write errors and data- corruptions to stderr. -b block_size Specify the size of blocks in bytes. The default is 1024. -t test_pattern Specify a test pattern to be read (and written) to disk blocks. The test_pattern may either be a nu‐ meric value between 0 and ULONG_MAX-1 inclusive, or the word "random", which specifies that the block should be filled with a random bit pattern. For read/write (-w) and non-destructive (-n) modes, one or more test patterns may be specified by specifying the -t option for each test pattern desired. For read-only mode only a single pattern may be specified and it may not be "random". Read-only testing with a pattern assumes that the specified pattern has previously been written to the disk - if not, large numbers of blocks will fail verification. If multiple patterns are specified then all blocks will be tested with one pattern before proceeding to the next pattern. -o output_file Write the list of bad blocks to the specified file. Without this option, badblocks displays the list on its standard output. The format of this file is suitable for use by the -l option in e2fsck(8) or mke2fs(8). -w Use write-mode test. With this option, badblocks scans for bad blocks by writing some patterns (0xaa, 0x55, 0xff, 0x00) on every block of the device, reading every block and comparing the contents. This option may not be combined with the -n option, as they are mutually exclusive.