Re: How To Read Volume ID from DVD

2009-10-05 Thread Thomas Schmitt
Hi,

 The explanation for why
 volname returned CDROM is that is apparently the default volume
 label when none is specified (which wasn't in the first session). I
 specified volly on a later session but volname and vol_id (which
 someone else suggested) appear to not be multi-session aware and
 return data only from the first session.

This effect dependends on the media type. It
appears with sequential media like CD, DVD-R[W],
DVD+R, BD-R, but not with overwriteable ones
like DVD+RW, DVD-RAM, DVD-RW formatted, BD-RE.

With sequential media you have to determine
the start position of the most recent session
and to look there for the Primary Volume
Descriptor which holds the volume id.

With overwriteable media it was the job of the
burn program to install a PVD copy at the start
of the media. So with overwriteables, there
is no need to find the real start of the last
session.

The fact that the volume identifier tools do
not know the mount rules for sequential multi-
session media appears to be a birth defect:
To learn about the media type and eventually
the start of the most recent session they would
need to identify the media type. For that they
need ioctl(). Either from the CDROM_* family, if
there is a matching ioctl(), or via SG_IO with
commands from the MMC standard. Both seems not
to be in their scope.


 [xorriso]  I see its -toc mode
 emits the volume IDs for each session, vs.wodim -toc which doesn't
 show this.

xorriso is an integrated ISO 9660 multi-session
tool. wodim (resp. cdrecord) is a burn tool
which is not entitled to know about ISO 9660
entrails.


 I had begun reading ECMA-119 last night when it appeared there was no
 way to do this but write my own code.

There can never be enough experts.

 My case is multi-session discs
 so it'll take a little more than this. I've still got to look at
 ECMA-168

xorriso does not rely on ECMA-168 but on ECMA-119
plus some SUSP based extensions like Rock Ridge.
Afaik the mkisofs runs of growisofs do not refer
to ECMA-168 either.
Although multi-session is not mentioned in
ECMA-119, we simply fool that standard by help of
the mount conventions of the operating systems.
I.e. we do not violate those specs but we do
things which are not explicitely mentioned there.
It works fine (unless with tools like volname).


 I found there are various other fields (e.g. application identifier)
 the image creation tools will allow you to specify yet even the
 relatively heavy weight tools don't appear to expose, so I'm going to
 write a simple tool a la volname but multi-session aware and that can
 report the other volume descriptor fields.

How about we integrate this into xorriso as a
command option ?
The task to find the PVD is not trivial and
xorriso already can do that. What info would
you like to extract ?


Have a nice day :)

Thomas


-- 
To UNSUBSCRIBE, email to cdwrite-requ...@other.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@other.debian.org



Re: How To Read Volume ID from DVD

2009-10-05 Thread m
 xorriso does not rely on ECMA-168 but on ECMA-119
 plus some SUSP based extensions like Rock Ridge.
 Afaik the mkisofs runs of growisofs do not refer
 to ECMA-168 either.

Yes, today I perused ECMA-168 and realized it specifies a form of
layout different than what my burnt discs conform to (i.e. it uses a
descriptor identifier of CDW02, vs. growisofs's CD001 which is
ECMA-119).

 Although multi-session is not mentioned in
 ECMA-119, we simply fool that standard by help of
 the mount conventions of the operating systems.
 I.e. we do not violate those specs but we do
 things which are not explicitely mentioned there.
 It works fine (unless with tools like volname).

Indeed I have been frustrated trying to find out a description of
multi-session ECMA-119 layout. Is this written up somewhere or nothing
more than having to reverse engineer some de facto standard
implementation (yuck)? (To wit, the Volume Space Size field from the
Primary Volume Descriptor from ECMA-119 doesn't fully account for the
difference between sessions.)

 How about we integrate this into xorriso as a
 command option ?
 The task to find the PVD is not trivial and
 xorriso already can do that. What info would
 you like to extract ?

Well, if you'd be up for it that'd be appreciated. All the textual
fields from the ECMA-119 volume descriptor can be specified in
growisofs (to name one), as well they should but reading them back is
lacking: system identifier, volume identifier, volume set identifier,
publisher identifier, data preparer identifier, application
identifier, copyright file identifier, abstract file identifier,
bibliographic file identifier.


-- 
To UNSUBSCRIBE, email to cdwrite-requ...@other.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@other.debian.org



Re: How To Read Volume ID from DVD

2009-10-05 Thread Thomas Schmitt
Hi,

 growisofs's CD001

That's actually mkisofs's CD001.

growisofs -M examines media TOC resp. the
ECMA-119 PVD in order to get the parameters
for a run of mkisofs -C . growisofs then
starts mkisofs and writes its output to the
media. In case of overwriteable media it
finally copies the Volume Descriptors of
the new session to the start of the media.

xorriso does about the same but uses
libraries libisofs, libburn and libisoburn.
On overwriteable media it puts the first
session to LBA 32 rather than 0. This protects
the PVD of the first session from being
overwritten by the PVD copies of further
sessions. So it is possible to follow a chain
of sessions when printing a table-of-content.


 Indeed I have been frustrated trying to find out a description of
 multi-session ECMA-119 layout.

The idea is quite simple:
Mount uses as superblock address the start
of the first track in the last session.
At this address it expects a System Area of
16 blocks followed by a Volume Descriptor Set.
It is interested in the PVD which tells the
address of the Directory Entry of the root
directory and the size of the image.

The only deviation from ECMA-119 is that the
superblock address is not 0. Prescribed is:
6.2.1 System Area and Data Area
 The System Area shall occupy the Logical
 Sectors with Logical Sector Numbers 0 to 15.
 [...]
 6.7.1 Volume Descriptor Set
 A Volume Descriptor Set shall be a sequence of
 volume descriptors recorded in consecutively
 numbered Logical Sectors starting with the
 Logical Sector Number 16.

Everything else in our doings follows ECMA-119
resp. squeezes itself into the niches which have
been left open in that standard.
E.g. SUSP, Rock Ridge, AAIP use a few reserve
bytes of each directory entry to attach extra
info and make ISO 9660 a decent filesystem.

On sequential media we formally fulfill the
demands of ECMA-119 by having an outdated
system area and Volume Descriptor Set at
addresses 0 and 16.
On overwriteable media we fulfill ECMA-119
completely by putting an updated copy of the
prescribed stuff to LBA 0 to 16.

The El-Torito specs for booting support our
interpretation of ECMA-119 liberty by prescribing
to use the System Area of the last session.
Nevertheless many BIOSes stick to ECMA-119 and
insist in using the System Area at LBA 0 and
the El-Torito boot record at LBA 17 to 31.
So bootable multi-session CDs and DVDs should
in each session point to the same boot objects
in the image which should all sit in the first
session.


 (To wit, the Volume Space Size field from the
 Primary Volume Descriptor from ECMA-119 doesn't fully account for the
 difference between sessions.)

Oh it does. But each PVD can only give the
end address of its own session. So you will
see an increasing volume size in each session.
It is always counted from LBA 0 and not from
the start LBA of the session.
I.e. a PVD covers its own session and all
older sessions.


 system identifier, volume identifier, volume set identifier,
 publisher identifier, data preparer identifier, application
 identifier, copyright file identifier, abstract file identifier,
 bibliographic file identifier.

How about this:

  $ xorriso -indev /dev/... -pvd_info
  ...
  System Id: ...
  Volume Id: ...
  Volume Set Id: ...
  Publisher: ...
  Preparer : ...
  Application  : ...
  Copyright Id : ...
  Abstract Id  : ...
  Bibliogr. Id : ...


Have a nice day :)

Thomas


-- 
To UNSUBSCRIBE, email to cdwrite-requ...@other.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@other.debian.org



Re: How To Read Volume ID from DVD

2009-10-05 Thread Thomas Schmitt
Hi,

libisofs does already provide all PVD components
which you requested. So it was easy to implement
a sketch of -pvd_info.

See some examples from my test runs.
Comments and change wishes are appreciated.

-
Drive current: -indev '/dev/sr1'
PVD address  : 16s
System Id: LINUX
Volume Id: Debian 4.0 r0 M-A 1
Volume Set Id:  
Publisher Id :  
Preparer Id  :  
App Id   : MKISOFS ISO 9660/HFS FILESYSTEM BUILDER  CDRECORD CD-R/DVD 
CREATOR (C) 1993 E.YOUNGDALE (C) 1997 J.PEARSON/J.SCHILLING
Copyright Id :  
Abstract Id  :  
Biblio Id:  
-
Drive current: -indev '/dev/sr1'
PVD address  : 16s
System Id: LINUX
Volume Id: Ubuntu 7.10 Server
Volume Set Id:  
Publisher Id :  
Preparer Id  :  
App Id   : MKISOFS ISO 9660/HFS FILESYSTEM BUILDER  CDRECORD CD-R/DVD 
CREATOR (C) 1993 E.YOUNGDALE (C) 1997 J.PEARSON/J.SCHILLING
Copyright Id :  
Abstract Id  :  
Biblio Id:  
-
Drive current: -indev '/dev/sr1'
PVD address  : 6924016s
System Id:  
Volume Id: UPDATE_HOME_2009_10_04_122807
Volume Set Id: ISOIMAGE
Publisher Id :  
Preparer Id  : XORRISO-0.4.3 2009.09.30.092640, LIBISOBURN-0.4.3, LIBISOFS-0.6.2
3, LIBBURN-0.7.1
App Id   :  
Copyright Id : _
Abstract Id  : _
Biblio Id: _
-

(I will have to beautify my own PVD ornaments.
-volid, -publisher and -application_id are user
adjustable already. I'll have to study which of
the others are for the user and which are for the
program.)


Note the subtle differences between -toc line
  Volume id: '...'
and -pvd_info line
  Volume Id: ...

Would you prefer quoted output in -pvd_info ?


Have a nice day :)

Thomas


-- 
To UNSUBSCRIBE, email to cdwrite-requ...@other.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@other.debian.org



Re: How To Read Volume ID from DVD

2009-10-05 Thread m
These look good.

 Note the subtle differences between -toc line
  Volume id: '...'
 and -pvd_info line
  Volume Id: ...

 Would you prefer quoted output in -pvd_info ?

For the sake of programmatic use, the known delimiters of colon-space
and newline (or whatever) serves as implicit quoting for grepping.
Also it seems to me the norm on such things (/proc files, etc.) is to
list fields without quoting, so aesthetically I'd go with how you have
it now.

Much thanks. I think it's been too long there's been no (apparent,
convenient) way to access these fields.


-- 
To UNSUBSCRIBE, email to cdwrite-requ...@other.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@other.debian.org



Re: How To Read Volume ID from DVD

2009-10-05 Thread Thomas Schmitt
Hi,

i uploaded 
  http://scdbackup.webframe.org/xorriso-0.4.3.tar.gz
which performs the new option -pvd_info.

xorriso -version should report Version timestamp
2009.10.05.190215 or newer.

Try
  xorriso -indev ...device... -pvd_info 2/dev/null

-

 how is the sector offset for the
 next session derived. As an example, a multisession disc I have has
 this layout:
  TOC layout   : Idx ,  sbsector ,   Size , Volume Id
  ISO session  :   1 , 0 , 10568s , CDROM
  ISO session  :   2 , 12624 ,304274s , CDROM
 The 10568 is the volume space size field from the PVD, logically. What
 I don't see is how does it derive 12624 as the start of the next
 session, what accounts for the other 2056 sectors?

Let me guess: this is a DVD+R media.
The gap is 4 MB plus alignment to the next full
16 block address.

Again, we have two families of media types:

Sequential media have a table-of-content on the
level of media and drive. See MMC-5 
  http://www.t10.org/ftp/t10/drafts/mmc5/mmc5r03c.pdf
commands 51h READ DISC INFORMATION and 52h READ
TRACK INFORMATION or 43h READ TOC/PMA/ATIP.
The mount command learns from this info where
the last session begins. It does not have to
interpret the payload data content for that.
The drive decides where the next track may begin:
TRACK INFORMATION field Next Writeable Address.
In case of DVD+R this is about 4 MB after the
last track end. DVD-R and CD have even larger
gaps.

Overwriteable media have no real
table-of-content. The drive reports stubbornly a
single session with a single track.
So in this case the mount command must get its
superblock at address 0. After each new session
the first 16+ blocks of the media have to be
updated by a copy of the first 16+ blocks of the
new session.
For printing an emulated table-of-content it is
necessary to interpret the PVDs of the sessions.
The first one can be found at LBA 32+16 and tells
the size of its session. The next one can be
found shortly after the session end. In case of
xorriso this is the next address divisible by 32.
growisofs aligns rather to 16 and spoils the
chain of sessions by placing the first one at
LBA 0 which gets overwritten with each new
session.
The Next Writeable Address for a new session gets
determined by the burn program. My decision to
use 32 block alignment is mainly motivated by
the 32 block granularity of Blu-ray media.


 Is it the case
 that this information is out of band from the sector data and accessed
 using special device commands?

The gap with DVD+R contains no payload and afaik
no other useful information. Its technical
reason is obscure to me. Maybe one can find an
explanation in ECMA-349.
To my experience the gaps of DVD+R are readable
as zero bytes. (CD gaps are not readable by the
normal SCSI READ command.)


About all my knowledge with MMC drives and media
is collected in file
  xorriso-*/doc/cookbook.txt
which you can find in the xorriso tarball.
It refers to SCSI specs SPC, SBC and MMC.


Have a nice day :)

Thomas


-- 
To UNSUBSCRIBE, email to cdwrite-requ...@other.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@other.debian.org



Re: How To Read Volume ID from DVD

2009-10-04 Thread Thomas Schmitt
Hi,

   $ growisofs -Z /dev/dvdrw1  -R -J -V volly tmp/
 but although it seems absurd I can't find any way to read this volume
 label back once written.
  $ volname /dev/dvdrw1
  CDROM

CDROM is the default volume id of mkisofs.
-V volly should have overridden that.

volname works for me.
Own backup formatted by xorriso:
   $ volname /dev/sr2   
   UPDATE_HOME_2008_12_09_115802 

Debian CD formatted by mkisofs
   $ volname /dev/sr2
   Debian 4.0 r0 M-A 1

Now mkisofs under control of growisofs:
   $ growisofs -Z /dev/sr2 -R -J -V volly /test/test
   ...
   /dev/sr2: reloading tray
   $ volname /dev/sr2
   volly   

So your growisofs command seems ok.

One can get the volume id from xorriso too:
   $ xorriso -indev /dev/sr2 21 | grep '^Volume id'
   Volume id: 'volly'
just to make sure that the local volname has not
gone bad in some way.
Or make an attempt with vanilla tools:
   $ dd bs=1 skip=32808 count=32 if=/dev/sr2 | strings
   volly
(ECMA-119 8.4.6 Volume Identifier (BP 41 to 72)
under the assumption that the PVD is at LBA 16.)


Was the media ejected and reloaded after
writing ?
If not, and if the media held an ISO image before
then the Linux block device drive might have some
old media content cached.


Have a nice day :)

Thomas


-- 
To UNSUBSCRIBE, email to cdwrite-requ...@other.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@other.debian.org



Re: How To Read Volume ID from DVD

2009-10-04 Thread lists . cdwrite
Hello,

On Sunday October 04 2009, m wrote to cdwrite@other.debian.org:

 m There's various places that discuss burning with growisofs and
 m specifying a volume ID, like
 m   $ growisofs -Z /dev/dvdrw1  -R -J -V volly tmp/
 m but although it seems absurd I can't find any way to read this
 m volume label back once written.

 m Is there any way to do this under Linux?

Have you tried vol_id?
  vol_id /dev/dvdrw1  or
  vol_id --label /dev/dvdrw1
do it for me.

Regards,

   Hans.

jdh dot beekhuizen at duinheks dot nl
--- GoldED+/LNX 1.1.5/091003
 * Origin: The Wizard is using MBSE/Linux (2:280/1018)


-- 
To UNSUBSCRIBE, email to cdwrite-requ...@other.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@other.debian.org



Re: How To Read Volume ID from DVD

2009-10-04 Thread Joerg Schilling
m mag...@gmail.com wrote:

 There's various places that discuss burning with growisofs and
 specifying a volume ID, like
   $ growisofs -Z /dev/dvdrw1  -R -J -V volly tmp/
 but although it seems absurd I can't find any way to read this volume
 label back once written.

 volname is discussed but is worthless here:
  $ volname /dev/dvdrw1
  CDROM

Use isoinfo -o xx.iso -d

Note that if you use non-asci chars in Joliet and like to add -J
that you need to use the official cdrtools

ftp://ftp.berlios.de/pub/cdrecord/alpha/

as th fork on seveal Linux distros is full of bugs.

Jörg

-- 
 EMail:jo...@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
   j...@cs.tu-berlin.de(uni)  
   joerg.schill...@fokus.fraunhofer.de (work) Blog: 
http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily


-- 
To UNSUBSCRIBE, email to cdwrite-requ...@other.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@other.debian.org



Re: How To Read Volume ID from DVD

2009-10-04 Thread m
 CDROM is the default volume id of mkisofs.
 -V volly should have overridden that.

 volname works for me.
 Own backup formatted by xorriso:
   $ volname /dev/sr2
   UPDATE_HOME_2008_12_09_115802

My apologies, my example indicated a first (-Z) session but should
have been of a subsequent (-M) session. The explanation for why
volname returned CDROM is that is apparently the default volume
label when none is specified (which wasn't in the first session). I
specified volly on a later session but volname and vol_id (which
someone else suggested) appear to not be multi-session aware and
return data only from the first session.

 One can get the volume id from xorriso too:
   $ xorriso -indev /dev/sr2 21 | grep '^Volume id'
   Volume id: 'volly'

Thanks, I hadn't heard of this tool and indeed it works, properly
returning info from the latest session. As well I see its -toc mode
emits the volume IDs for each session, vs.wodim -toc which doesn't
show this.

 Or make an attempt with vanilla tools:
   $ dd bs=1 skip=32808 count=32 if=/dev/sr2 | strings
   volly
 (ECMA-119 8.4.6 Volume Identifier (BP 41 to 72)
 under the assumption that the PVD is at LBA 16.)

I had begun reading ECMA-119 last night when it appeared there was no
way to do this but write my own code. My case is multi-session discs
so it'll take a little more than this. I've still got to look at
ECMA-168 to see how to find the start of each session.

I found there are various other fields (e.g. application identifier)
the image creation tools will allow you to specify yet even the
relatively heavy weight tools don't appear to expose, so I'm going to
write a simple tool a la volname but multi-session aware and that can
report the other volume descriptor fields.


-- 
To UNSUBSCRIBE, email to cdwrite-requ...@other.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@other.debian.org



How To Read Volume ID from DVD

2009-10-03 Thread m
There's various places that discuss burning with growisofs and
specifying a volume ID, like
  $ growisofs -Z /dev/dvdrw1  -R -J -V volly tmp/
but although it seems absurd I can't find any way to read this volume
label back once written.

volname is discussed but is worthless here:
 $ volname /dev/dvdrw1
 CDROM

dvd+rw-mediainfo gives other info but not the volume label.

Putting the produced DVD into a Windows machine shows the volume
label, no problem.

Is there any way to do this under Linux?


-- 
To UNSUBSCRIBE, email to cdwrite-requ...@other.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@other.debian.org