Wednesday, 23 May 2007

Recovering corrupted floppy using dd.

Attempting to get all my PhD emails off floppies - N.B. I know I'm sad for doing this but one day Hattie might get a laugh out of my archived emails. Using a USB floppy drive from ebay which had been written to on a SUN box in MS-DOS format. I knew the floppy was corrupted badly - see syslog output below:




May 23 14:52:34 monty kernel: sd 0:0:0:5: SCSI error: return code = 0x08000002
May 23 14:52:34 monty kernel: sdf: Current: sense key: Medium Error
May 23 14:52:34 monty kernel: Additional sense: Unrecovered read error
May 23 14:52:34 monty kernel: Info fld=0x66
May 23 14:52:34 monty kernel: end_request: I/O error, dev sdf, sector 102
May 23 14:52:34 monty kernel: Buffer I/O error on device sdf, logical block 12
May 23 14:52:46 monty kernel: sd 0:0:0:5: SCSI error: return code = 0x08000002
May 23 14:52:46 monty kernel: sdf: Current: sense key: Medium Error
May 23 14:52:46 monty kernel: Additional sense: Unrecovered read error
May 23 14:52:46 monty kernel: Info fld=0x66
May 23 14:52:46 monty kernel: end_request: I/O error, dev sdf, sector 102
May 23 14:52:46 monty kernel: Buffer I/O error on device sdf, logical block 12
May 23 14:52:59 monty kernel: sd 0:0:0:5: SCSI error: return code = 0x08000002
May 23 14:52:59 monty kernel: sdf: Current: sense key: Medium Error
May 23 14:52:59 monty kernel: Additional sense: Unrecovered read error
May 23 14:52:59 monty kernel: Info fld=0x66
May 23 14:52:59 monty kernel: end_request: I/O error, dev sdf, sector 102
May 23 14:52:59 monty kernel: Buffer I/O error on device sdf, logical block 12


Started looking at using dd with the noerror and sync options:



dd if=/dev/sdg of=/home/tng/floppy_output.try bs=2x80x18b conv=noerror


Discovered the fantastic dd_rescue and decided to give that a try:




Script started on Wed 23 May 2007 14:38:53 BST
tng@monty: ~tng@monty:~$ dd_rescue /dev/sdf floppy_ddrescue.img
dd_rescue: (info): ipos: 24.5k, opos: 24.5k, xferd: 24.5k
* errs: 33, errxfer: 16.5k, succxfer: 8.0k
+curr.rate: 639kB/s, avg.rate: 0kB/s, avg.load: 0.0%
dd_rescue: (warning): /dev/sdf (24.5k): Input/output error!

dd_rescue: (info): ipos: 1440.0k, opos: 1440.0k, xferd: 1440.0k
errs: 224, errxfer: 112.0k, succxfer: 1328.0k
+curr.rate: 11100kB/s, avg.rate: 2kB/s, avg.load: 0.0%

tng@monty:~$ exit

Script done on Wed 23 May 2007 16:10:33 BST



As the file consisted of emails and I wasn't worried about concatenation, so simply edited the file using emacs (handles big files well).



emacs floppy_ddrescue.img


Deleted out the corruption at the start and end of the file and saved. Wahey- 11 year old emails recovered!

No comments: