Re: Could BD-RE disc come back to un-formatted state?

2018-01-03 Thread Thomas Schmitt
Hi,

sorry to the list: I forgot to Cc: it with my reply. But WF quoted it
completely, so i don't have to repost it here.

WF wrote:
> Currently I use dd to nullify the first 64KB to quickly
> clean the udf filesystem built on the BD-RE disc.

That's enough for ISO 9660 but not really for UDF. You need to hit the
"Anchor Volume Descriptors" at block 256, the last block of the medium,
and 256 blocks before the end. See
  http://wiki.osdev.org/UDF


> So the state switch of BD-RE disc is:
> blank -> formatted -> filesystem -> formatted

There is a distinction between hardware state "formatted medium" and the
data content state "formatted as filesystem".

Hardware formatting is a matter of the medium state as perceived by the
drive's firmware.
Optical media have two write access models, depending on the media type
and the hardware formatting state:

- CD-R, CD-RW, DVD-R, DVD+R, DVD-RW, and BD-R can be used unformatted
  in the sequential write model: The drive says where the burn program
  may begin writing and the burn program then writes block by block without
  trying to jump forth or back.

- CD-RW, DVD-RW, DVD-RAM, DVD+RW, BD-RE, and BD-R can be used formatted.
  Except for BD-R this implies the overwritable write model: The burn
  program can decide freely where to start writing (on DVD-RW in 32 KiB
  steps, on others in 2 KiB steps) and where to write next.
  This is near enogh to the normal block device model that the Linux kernel
  can offer "dd" a writable block device.
  BD-R can be formatted for sequential Defect Management or for
  Pseudo-Overwrite. growisofs formats to Pseudo-Overwrite by default.
 
What is "blanked medium" with an unformatted CD-RW or DVD-RW has no hardware
counterpart with overwritable media. Their "blank" rather means "yet unused
and in need of formatting".

Filesystem "formatting" is just a framework of readable data on the medium,
regardless whether hardware formatted or not. Beginning by a "superblock"
at some publicly defined position the filesystem driver software can then
interpret the data on the medium as directory tree, file content, or other
kinds of information.
So this kind of "formatting" can be erased by overwriting the superblocks,
the directory tree data, or the whole medium content.


> Since it cannot be deformatted back to blank state regularly, I have to use
> "lsblk -o FSTYPE" to classify the "formatted" and "filesystem" states.

If you want to erase all possibly readable file content on a BD-RE, then
you need to overwrite the entire medium with non-secret data. In the most
simple case:
  dd if=/dev/zero bs=1M of=/dev/sr0
This will hide any previous data from normal reader devices. But possibly
a forensic reader with special firmware could reconstruct the previous data.

Low security instructions for confidential data prescribe to overwrite the
medium 3 times with random numbers. Higher security demands can only be
fulfilled by physically destroying the medium.


> Your burner which could deformat BD-RE disc is really funny :-)

I needed some tries to find out that it was my attempt to read a CD
which destroyed its Blu-ray burn capability. To my luck it sits in an
USB box and can be de-powered without rebooting the system.

Interesting for your case:
The previously existing data were again readable after a "fast" formatting
run. So de-formatting a BD-RE is not really a privacy improvement.
(And it also did not remove the visible color contrast on the writable
 side of the medium.)


Have a nice day :)

Thomas



Re: Could BD-RE disc come back to un-formatted state?

2018-01-03 Thread 王锋
Hi Thomas,


Many thanks for your reply. The use case is that BD-RE discs need recycling to 
be reused again.  Currently I use dd to nullify the first 64KB to quickly clean 
the udf filesystem built on the BD-RE disc. But this state is different with 
the original blank state.  So the state switch of BD-RE disc is:
blank -> formatted -> filesystem -> formatted


In the "blank" and "formatted" states the disc actually cannot be used by users 
directly.  The hardware media states of "formatted" and "filestystem" are the 
same "complete".  I'd like to unify the "blank" and  "formatted" status to one 
state and make it different with the "filesystem" state.


Since it cannot be deformatted back to blank state regularly, I have to use 
"lsblk -o FSTYPE" to classify the "formatted" and "filesystem" states. Do you 
have any suggestion on this?
Your burner which could deformat BD-RE disc is really funny :-)



--
WF
 

 
 
 
---------- Original ----------
From:  "Thomas Schmitt";
Date:  Wed, Jan 3, 2018 04:52 PM
To:  "feng.wang"; 

Subject:  Re: Could BD-RE disc come back to un-formatted state?

 
Hi,

> After being formatted, the BD-RE disc is changed to "complete" from "blank"
> status. Could we change the status back to "blank"?

Not regularly. The SCSI/MMC command set for optical media offers no
opportunity to deformat a BD-RE medium. One may only change the size of the
Spare Area.

Said this, i have an old BD burner which can do the trick by accident:
"Optiarc", model "BD RW BD-5300S", firmware "1.04".
If i insert and remove a CD-R medium then it afterwards deformats any BD-RE
medium i give to it and refuses to write them. A power-off-on cycle brings
it back to normal operation.
The affected media have to be formatted again before they can be written.


> According to the
> thread https://lists.debian.org/cdwrite/2010/02/msg00014.html, the
> "dvd+rw-format -blank" command is useless to change the status back to
> "blank". 

Indeed. The "-blank" option only applies to DVD-RW media. Those can be
de-formatted from overwritable state to sequential "blank" state (or
erased from sequential states "appendable" or "closed" to "blank").

My program xorriso extends the model of "blank", "appendable", and "closed"
to ISO 9660 sessions on overwritable media like BD-RE. Valid ISO 9660
filesystems do not get overwritten by xorriso unless they get devalidated
by a xorriso "-blank" command.
But that is only a content-orient classification. The hardware state of
such media stays "complete" and no writing can be done before the medium
gets formatted to that state.


What is your use case for which you need to de-format the BD-RE medium ?
Why would a formatted BD-RE not work for this use case ?


Have a nice day :)

Thomas