[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to rescue this backup data


> $ genisoimage -C ... -M /dev/sr0 -o backup.iso website_backup/
> $ wodim dev=/dev/sr1 backup.iso
>  (or, might also have been "$ growisofs -M /dev/sr1=backup.iso" )
> d. he happily labeled the DVD+R in /dev/sr1 as "website backup".

Wow, that's quite some puzzle to solve.

> Now, we have the DVD+R that was there in /dve/sr1 when he do step c, because
> it is correctly labeled as website backup. I can dump backup.iso by using
> this:
>   $ dd if=/dev/sr1 of=backup.iso bs=2048 count=155440 skip=1256096

If this is an ISO 9660 image then

  $ dd if=backup.iso bs=2048 skip=16 count=1 | \
    od -c | less

should show this output

  0000000 001   C   D   0   0   1  ...

If so, then you have the task to guess the offset
value TheOffset that was used with

  genisoimage -C c1,TheOffset

You would then create a dummy file of that size
(1 block = 2048 bytes) and append the image at
its end.

  $ dd if=/dev/zero bs=2048 count=$TheOffset \
  $ cat backup.iso >> prefix_file

Then you could mount it on Linux by:

  $ mount -o loop,sbsector=$TheOffset \
    backup.iso /mnt/

Of course any reference to the first session
of the media will yield files with all 0 bytes
in them. Expect only the directory tree and the
new files of session 2 to be valid.


This would be easy if you had the DVD from sr0.

If not, then lets have a look into ECMA-119,
8.4 Primary Volume Descriptor:
 "[byte position counting begins with 1]
  157 to 190
  Directory Record for Root Directory"
9.1 Format of a Directory Record
 "3 to 10
  Location of Extent"

This value tells you where the ISO image has its
first storage chunk for directory records.
It is supposed to sit shortly after the start
of the image.

With a first session generated by mkisofs i
get (on a system with AMD/Intel byte sex)

  $ dd if=fertig.iso bs=2048 skip=16 count=1 | \
    dd bs=1 skip=158 count=4 | od -d
  0000000    28     0

The number is recorded by least significant byte
first. So the value with offset 0 is 28 blocks.
(The other four bytes up to 10 are the same
 number as MSB.)

Now obtain the value from your image backup.iso.
  $ dd if=backup.iso. bs=2048 skip=16 count=1 | \
    dd bs=1 skip=158 count=4 | od -d
  0000000 40156    21

Compute the block number
  $ expr 21 '*' 65536 + 40156

subtract 28 and try this as $TheOffset for above
prefix file and mount option sbsector.
  $ expr 1416412 - 28

In case of failure, try the neighboring numbers.
The right one cannot be very far away.

You may get an impression about possible
deviations if you try this computation with
correctly recorded multi-session DVD+R.
The guess and the real track start address should
be quite near together.

With my xorriso generated images on a DVD-RW
it seems to work exactly. But mkisofs might have
other habits. (The offset itself is dictated by
the media. But the choice of first directory
address is at the discretion of mkisofs.)

Have a nice day :)


Reply to: