[sclug] CD/RW Writing like a hard drive info
Daniel Lower
daniel_lower at yahoo.com
Thu Dec 11 18:29:50 UTC 2003
Hiya,
Basically under Linux it is possible to mount a CD/RW disc and write
to it like you would a normal hard drive all possible thanks to UDF
and packet-writing. Thus at least we keep pace with Win XP which can
write to CD/RW drives as normal drives.
In one of my previous message I mentioned.
http://packet-cd.sourceforge.net
I've found a kind of howto hint in this case to describe how to get
this all going.
http://archives.linuxfromscratch.org/mail-archives/hints/2002-August/001207.html
Reproduced here:
SYNOPSIS:
How to set up LFS to be able to Mount CD-RW drives READ-WRITE.
HINT:
Background.
-----------
Recent 2.4.x kernels, as used in LFS from Version 3.3, support the
UDF
filesystem for read only access. The UDF filesystem is a standard
used for
CD-RW drives (and CD-R and DVD-RAM etc.) To find out more about the
UDF
filesystem you should check out the Standards Body's websites at
http://www.osta.org and http://www.ecma.org - I shan't elaborate
further here.
The problem is that WRITE access isn't supported, so if you have a
CD-RW drive
you can't use Linux to write to it with a UDF filesystem, all you can
do is
write Disk-at-a-time or Track-at-a-time with CDrecord and friends(
see the BLFS
book for how-to on that).
If, on the other hand, you were using, God forbid, Microsoft Windows
(TM), then
you could 'buy' Adaptec CDDirect, or HP DLA to give you
Drive-Letter-Access
to the drive, just as if it were a (rather slow) fixed disk. These
utilities
are often bundled with the drives, which doesn't help if you want to
use Linux!
But, fear not, for the courageous help is at hand in the form of a
Kernel Patch
to provide Packet-CD access. This, combined with some simple tools,
allows you
to provide a full read-write capability as a mounted UDF filestore.
Hopefully,
this facility will be incorporated in 2.6 kernels when they arrive.
This hint is how I did it, and only applies to CD-RW drives, I
understand that
the same approach can be used by those lucky enough to be able to
afford DVD-RAM
drives! The following websites were my primary sources of
information, so start
there:
for the kernel patches:
http://w1.894.telia.com/~u89404340/patches/packet/
for the usenet archive:
http://lists.suse.com/archive/packet-writing/
for the UDF tools: http://sourceforge.net/projects/linux-udf
Obtain the right patch and apply it to your Kernel.
---------------------------------------------------
>From the kernel patch site above download the patch for the version
of the
kernel you are using. I'm currently on 2.4.19, so I got
packet-2.4.19-2.patch.
Check that the patch you get is the latest dated for your kernel,
they seem to
be updated quite often (see the Usenet Archives for why, when etc..)
Become superuser and move to your linux source directory, then apply
the patch
with:
patch -Np1 -i packet-2.4.19-2.patch
Now run 'make xconfig', or whatever version of kernel config you use
(the LFS
book uses 'make menuconfig', which is fine)
Go to the section on 'Block Devices' and select:
Packet writing on CD/DVD media
If you are into modules you can do it that way - I didn't.
Now go to the section on 'File systems' and select the following:
UDF files systems support (read only)
UDF write support (DANGEROUS)
Despite the note on this latter option saying it only applies to
fixed disks and
DVD-RAM, the patch will make it work with CD-RW too!
Select 'Save and Exit', then build your new kernel exactly as in the
LFS book
with:
make bzImage
then copy the resulting kernel to /boot as, say, vmlinuz-2.4.19-UDF.
I use GRUB as a bootloader, so you will need to read the book and
hints on lilo
if you use that, but set up your boot loader to be able to boot
either your old
kernel or this new one. (Always keep the old kernel bootable, just in
case...)
Now reboot with the new kernel, it should be almost identical to your
old one.
Note: I think that if you built the packet driver as a module, you
need to add:
alias block-major-97 pktcdvd
to your /etc/modules file, as I don't use modules, i don't have any
experience
here.
Make the Packet Driver device file.
-----------------------------------
As superuser, make the file(s) in /dev with:
mknod /dev/pktcdvd0 b 97 0
mknod /dev/pktcdvd1 b 97 1
etc...
If you want ordinary users to be able to use CD-RW too, then:
chmod 666 /dev/pktcdvd*
Obtain and Unpack the UDFtools package.
---------------------------------------
Download the latest package from:
http://sourceforge.net/projects/linux-udf,
the version I used was 1.0.0b2.
Unpack this is the usual way and build it with:
./configure --prefix=/usr &&
make &&
make install
You now have three new programs in /usr/bin, complete with man pages
which I
suggest you read about now.:
cdrwtool - a tool to do various jobs on your CD-RW drive and
disks.
mkudffs - to create an UDF filesystem (on your hard disk if you
want)
pktsetup - a tool to setup and tear down packet drive
associations.
Using the tools.
----------------
Lets suppose you have a CD-RW disk straight out of the box, and want
to prepare
it for use. Like me, your CD-RW drive is on /dev/scd0.
cdrwtool -d /dev/scd0 -q
will format the new disk. (By the way, unlike CDRecord, UDFtools
don't need
ide-atapi devices to be made fake scsi devices)
pktsetup /dev/pktcdvd0 /dev/scd0
associates a packet-driver with your CD-RW drive (this doesn't
survive a reboot).
mount /dev/pktcdvd0 /mnt/cdrom -t udf -o rw,noatime
will mount your new disk as a read-write filesystem, all ready to
use, just like
any other hard disk. ('noatime' just speeds things up by not
updating the access
times, CD-RW can be a little slow)
Then you can 'umount /dev/pktcdvd0' in the usual way, when you're
done.
Enjoy,
More information about the Sclug
mailing list