Gentoo Wiki


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc
Merge-arrows.gifIt has been suggested that this article be Merged into one article with HOWTO Packet Writing on CD-RW    (Discuss)


Download the Kernel Patch

Note: This patch isn't needed since 2.6.10 kernel release

Download Kernel Patch


Goal: Use your CD-RWs like you would a floppy, just dragging stuff onto the mounted CD ROM. - Uses UDF on CD-RW filesystem, so its compatible with Nero InCD.

NOTE: All computers must have UDF read support in order to read any CDs created using the method in this post. This means all Windows machines must have Nero InCD and all Linux machines must have the UDF read support kernel option enabled.


1. Check that the symbolic link /usr/src/linux point to the kernel you wish to install this to.

# ls -l /usr/src

2. Download the appropiate patch for your kernel from and copy it to /usr/src/linux

3. Unpack the patch and apply it

# cd /usr/src/linux
# bunzip2 packet-*
# patch -p1 < packet-*

4. Enter the kernel configuration.

# make menuconfig

Make sure these options are enabled.

Device Drivers  --->
  Block devices  --->
    <*> Packet writing on CD/DVD media (EXPERIMENTAL)
    (8)   Free buffers for data gathering
    [ ]   Enable write caching
File systems  --->
  CD-ROM/DVD Filesystems  ---> 
    <*> UDF file system support
    (on 2.4 kernels, reading and writing is separate options, enable BOTH)

5. Recompile your kernel and copy it over (backup your old one as well)

# make && make modules_install
# mount /boot
# cp arch/i386/boot/bzImage /boot

6. If you compiled it as a module, edit /etc/modprobe.d/aliases and add the following line:

File: /etc/modprobe.d/aliases
 alias block-major-97 pktcdvd

Afterwards run update-modules.

7. Create the new device node

# mknod /dev/pktcdvd0 b 97 0
   (If you have more then one CD-RW drive, change all the 0s in the above line to the next number... So for a second drive, you would trype:
# mknod /dev/pktcdvd1 b 97 1

For the rest of this tutorial, its assumed you will do that appropiately for each command/line.

8. Install udftools

# emerge sys-fs/udftools

9. Edit fstab to add the following line

File: /etc/fstab
/dev/pktcdvd0           /mnt/cdrw       udf             sync,noauto,noatime,rw,users    0 0

Be sure to create the new /mnt/cdrw directory and set it with the appropiate permissions:

# mkdir /mnt/cdrw
# chmod 0777 /mnt/cdrw

Formatting a CD-RW

To format a CD-RW with the UDF filesystem, type the following command (WARNING: replace scd0 with your CD RW drive!)

$ cdrwtool -d /dev/scd0 -q

You may now mount UDF formatted in writable mode CD-RWs by typing:

$ mount /mnt/cdrw

Prepping the system for writing

Save this file as /etc/init.d/cdrw:

File: /etc/init.d/cdrw
 # Copyright 1999-2003 Gentoo Technologies, Inc.
 # Distributed under the terms of the GNU General Public License v2
 # $Header: $


depend() {
   need localmount

start() {
   for i in ${DEVICES}
       ebegin "Enabling CD-RW packet writing on /dev/${i}"
       pktsetup /dev/pktcdvd0 /dev/${i}
       eend $? "Failed to enable packet writing on /dev/${i}."

stop() {
   for i in ${DEVICES}
       ebegin "Disabling CD-RW packet writing on /dev/${i}"
         pktsetup -d /dev/pktcdvd0 /dev/${i}
         eend $? "Failed to disable packet writing on /dev/${i}"

# vim:ts=4

Make this file executable. Use /etc/init.d/cdrw start to prepare it for writing. I recommend doing rc-update add cdrw default so your CD-RW drive is ready for use after every bootup... Be sure to change DEVICES="hdd" to the proper devices, currently it only supports one device but that should change soon...

Note: If your CDRW device behaves erratically when pktsetup is executed and a disc is inside the device, try executing pktsetup without a disc inside. After executing pktsetup, then you may insert the disc.

See Also

Original Gentoo Forum Topic

Retrieved from ""

Last modified: Sat, 19 Jul 2008 09:03:00 +0000 Hits: 12,294