Launchpad Entry: https://launchpad.net/distros/ubuntu/+spec/cd-packet-writing
Created: 2006-01-02 by PhillipSusi
Packages affected: udftools
Ubuntu lacks proper support for packet-writing. This spec is an implementation plan for adding such support.
The only way to write to CD/DVD media is using the CD/DVD creator in Nautilus. While this is useful, it does not give the ability to remove or modify files using standard tools such as text and image editors. What packet-writing gives us is the ability to treat the CD like a normal file system, including reclaiming freed space.
- 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.
Basic support in the kernel and udftools seem to be present. However, pktsetup doesn't integrate with hal and pmount as it should. In addition, gnome-volume-manager needs support for handling packet-written CD/DVDs and mounting them as such rather than as UDF media. Nautilus-cd-burner or similar needs additional code to handle formatting of media.
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 cd/dvd+-rw 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 cd/dvd+-rw 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.
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.
Kernel patch to fix bug with larger packet sizes in pktcdvd, and uid/gid bug in udf: pktcdvd_len_fix+udf_uid_fix.diff
- Updated udftools package has been uploaded to revu
Data preservation and migration
- 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