PacketCD

Revision 4 as of 2006-01-09 05:11:32

Clear message

Summary

This specification describes the plan to add support to ubuntu for writing to cdrw type media in packet mode

Rationale

Currently ubuntu supports writing to cd media using track/session at once mode via growisofs. This allows adding files to a cdr or cdrw easily, but can not remove files to reclaim the space, or edit files in place. Use of packet mode allows the cdrw to be used like a giant floppy. This means you can mount it as a true filesystem so command line tools can see it, and you can delete files from the disc and reuse that space without having to reformat the entire disc.

Use cases

  • Joe needs to transport files he works on between work and home. He used to use floppies for this, but these days his files are much too large to fit on a floppy. Using the growisofs solutions on cdrw media is a pain because of the limited number of sessions which can be added and inability to reuse space from deleted files.
  • Cindy has important documents on her hard drive and is worried that they would be lost if her hard drive crashed. She would like to be able to easily copy these documents to a cdrw for backup.

Scope

Some improvements and bug fixes are needed in the udftools package. The kernel udf filesystem and pktcdvd driver also need a bug fix. gnome-volume-manager needs patched to recognize and correctly mount a packet mode cdrw, and offer the user the option to format a blank cdrw for packet mode. Eventually the kernel pktcdvd device driver needs to be improved.

Design

Currently the udftools package can be installed and configured, which will set up the kernel packet writer module to create a new device which allows full read/write access to a cdrw disk that has been formatted for packet writing. This device can be mounted with any filesystem, but udf is prefered. Currently the package uses a configuration file that you must edit to list the devices which should have a pktcdvd device created and associated with them. This should be removed and instead the hal should invoke pktsetup to configure cdrw drives as they are detected. The pktsetup program needs modified slightly to be more plug and play friendly. Gnome-volume-manager needs modified to give the user an option to format the media for packet mode when a blank is inserted and to detect when a disc already formatted for packet mode is inserted and mount it via the corresponding pktcdvd device instead.

Implementation

The kernel pktcdvd driver seems to have hard limit on the maximum packet length that is set at compile time. Right now that size is 32 sectors ( 64 KB ) and when a 700 MB cdrw disc is formatted using packets of this size, it yields only 575 MB of usable space. Increasing the packet length to 128 sectors gives a usable space of 666.25 MB. I believe that the driver should be fixed so that it can dynamically use the correct packet length specified in the track header on the disc, but in the mean time, increasing the compile time constant from 32 to 128 should be sufficient.

The kernel udf filesystem driver currently does not update the on disc owning uid/gid if they match the value specified in the mount options. For removable media such as this, the logged in user id will be specified in the mount options because it is assumed that the media will be used in other computers which won't have the same meanings of uids/gids. This bug was causing files owned by the desktop user to revert to being owned by the previous user ( root if newly created ) when the disc was unmounted and remounted.

I fixed this by patching the code to allways save the owning uid/gid to disc, but substitute -1 if the id matches that in the mount option. The filesystem already substitutes the mount id when it reads a -1 from the disc, so this has the net effect of allowing the desktop user to allways own the file, even if a different user logs in and uses the disc, or if the disc is used in another computer. Any ownerships other than the id specified in the mount options will be retained on disc as is.

The udftools package has a few bugs which I have already fixed. They included:

  • Document the -z ( packet size ) parameter to cdrwtool in the man page
  • Fix bug in cdrwtool where some code made the assumption that the packet size was 32 sectors, causing it to break when you changed it
  • Change default owning uid/gid for the new root and lost+found directories in the fresly created filesystem to -1 from 0 so that the uid= and gid= mount options will be honored
  • Added new single argument use case to pktsetup where you only have to specify the cdrom device to bind to, and a pktcdvd device will be auto assigned.

Code

  • Kernel patch to fix bug with larger packet sizes in pktcdvd, and uid/gid bug in udf: attachment:pktcdvd_len_fix+udf_uid_fix.diff
  • Updated udftools package has been uploaded to revu

Data preservation and migration

Outstanding issues

  • Kernel patches need applied, already sent to BenC for review
  • udftools package is on revu, and needs approved
  • Need to start working on gnome-volume-manager

BoF agenda and discussion


CategorySpec