views:

447

answers:

2

I have a situation with a failing LaCie 500GB hard drive. It stays on for only about 10 minutes, then becomes unusable. For those 10 minutes or so I do have complete control.

I can't get my main mov file(160GB) transferred off that quickly, so I was thinking if I split it into small chunks, I could move them all off. I tried splitting the movie file using the SPLIT command, but it of course took longer than 10 minutes. I ended up with about 14GBs of files 2GB each before it failed.

Is there a way I can use a split command and skip any existing files chunks, so as I'm splitting this file it will see xaa, xab, xac and start after that point so it will continue to split the file starting with xad?

Or is there a better option that can split a file in multiple stages? I looked at csplit as well, but that didn't seem like an option either.

Thanks!

-------- UPDATE ------------

Now with the help of bcat and Mark I was able to do this using the following

dd if=/Volumes/badharddrive/file.mov of=/Volumes/mainharddrive/movieparts/moviepart1 bs=1g count=4
dd if=/Volumes/badharddrive/file.mov of=/Volumes/mainharddrive/movieparts/moviepart2 bs=1g count=4 skip=4
dd if=/Volumes/badharddrive/file.mov of=/Volumes/mainharddrive/movieparts/moviepart3 bs=1g count=4 skip=8
etc
cat /Volumes/mainharddrive/movieparts/moviepart[1-3] -> newmovie.mov
+4  A: 

You can always use the dd command to copy chunks of the old file into a new location. This has the added benefit of not doing unnecessary writes to the failing drive. Using dd like this could get tedious with such a large mov file, but you should be able to write a simple shell script to automate part of the process.

bcat
+3  A: 

Duh! bcat's answer is way better than mine, but since I wrote some code I figured I'd go ahead and post it.

input = ARGV[0]
length = ARGV[1].to_i
offset = ARGV[2].to_i

File.open "#{input}-#{offset}-#{length}", 'w' do |file|
  file.write(File.read input, length, offset)
end

Use it like this:

$ ruby test.rb input_file length offset

Mark A. Nicolosi
Thanks, but I'm not sure my answer is better. You actually gave working code, which is always useful.
bcat
I think mine may give problems if the length is too large. Besides dd's well-tested.
Mark A. Nicolosi
Thank you both!
Angelfilm Entertainment