safecopy is the anydvd of linux

Before you try anything here – this guide does really bad things to the atapi bus. If your computer suddenly reboots and hasn’t written consistent files due to a bus crash, don’t blame me or the utilities mentioned in here. Just buy a computer that doesn’t suck or buy a USB drive.

I want to buy someone a beer.

I have had a hell of a time with my kid biting everything (including his tongue) and that includes DVDs. I know I’m not alone – DVDs which come from Netflix are great examples of CSI work. You know the previous guy has little kids about the same age because you can look on the DVD and get their dental records.

I’ve talked about this before, but kids trash media. Not only do they trash media but the media itself tends to have copy protection which is intentional trash already on the media before your kids got to it. Disney does this to an extreme. The way it looks is a bunch of chapters on the disk which might be the right size and time except they’re filled with garbage. You need the physical copy of the disk. Previously you could use dd on the disk and that’s how I used to do it. I happened to run across safecopy when reading up on disaster recovery stuff for work and wow.

Here’s how safecopy works – it’s very similar to dd where you set the block size to huge and no read retries. The problem with the dd method is that if you have two files spanning the block size (and remember that DVDs don’t really have blocks, so “yes”), you discard the start of the next file. I’ve been getting around it by setting the block size to low for DVDs with “copy protection”, but this gives me plenty of time to make a list of people to kill while I research who came up with this. If the disk is scratched, I set the block size to a larger value (10M) because you know you’re going to hit that same scratch for literally the entire 8.5GB or whatever disk. This generally worked well so long as you didn’t hit the transition of the files.

safecopy changes that entirely.

You run safecopy in passes. The first pass is no recovery past bad blocks, and it skips a lot of blocks. In fact it’s no different from running dd. dd hits a bad block and skips to the next. safecopy hits a bad block and skips to the next and it keeps track of which addresses have bad blocks in a file it’s written. The magic is in the options – safecopy lets you specify a size of blocks to skip in bytes (16 is the default) or percent of size. That second one is the magic one, because block size changes physically as you move closer to the edge of the disk, and the edge of the disk is the part that goes in your little biters mouth. The question is – how many blocks are destroyed under each tooth mark?

How did I use it?

safecopy –stage1 /dev/sr1 /home/knarrj/tmp/damaged.iso

That makes safecopy do a fast pass and write off 10% of the total disk size (8.7GB) to bad sectors when it hits a bad sector. It writes a stage1.badblocks file and makes a note of the addresses it skipped. The ISO there is padded. If you try playing this ISO in VLC or whatever you’ll probably play it a bit and then VLC will crash when it tries to jump to a sector with the content BaDBlOcK. Then follows the magic:

safecopy –stage2 -I stage1.badblocks /dev/sr1 /home/knarrj/tmp/damaged.iso

Cool huh? Now safecopy goes back and reads the disk backwards from the boundary of the amount of bytes that it skipped to find the last, best sector. If we ran stage 3, it would be like dd again and attempt to read every byte on the disk. The first pass is about 15 minutes or so and the second pass is about 45 minutes meaning you can beat teeth marks and structural copy protection in about 1 hour.

Advertisements

3 thoughts on “safecopy is the anydvd of linux

  1. I got a new laptop and what I’ve realized is that safecopy is entirely dependent on which burner you have for how well it works. The old laptop worked really well, but it had a lite-on drive. The new laptop is HP cheap junk and it doesn’t work nearly as well. makemkv doesn’t appear to copy disks in their entirety, but thanks for the tip.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s