1. udftools for Debian
  2. ===================
  3.  
  4. Kernel support for packet writing
  5. ---------------------------------
  6.  
  7. Packet writing is a technique by which a writable medium (typically a
  8. CD or DVD) can be used just like a USB stick or a directory on the
  9. hard disc: Files and directories can be created/renamed/removed
  10. freely, and no separate "burning" step is necessary to write the data
  11. to the medium. Packet writing is possible both with write-once media
  12. (CD-R, DVD+R, DVD-R) and rewritable media (CD-RW, DVD+RW,
  13. DVD-RW). Obviously, with write-once media the free space on the
  14. filesystem will not increase if you delete files.
  15.  
  16. In order to do packet writing under Debian Linux, your kernel needs
  17. both support for UDF (Universal Disc Format) filesystems and for
  18. packet writing. This is the case for kernels later than about 2.6.10.
  19. For earlier kernels, you may have to apply patches from Peter
  20. Osterlund <http://web.telia.com/~u89404340/packet.html>. That site
  21. also has patches for udftools to make them work with recent kernels -
  22. they have been applied to this package. This package tries to support
  23. both old-style packet writing (kernel <2.6.8), and the newer variant
  24. (>=2.6.10), with and without udev. Use a recent 2.6 kernel for optimal
  25. results!
  26.  
  27.  
  28. Formatting and using a UDF DVD-RW or CD-RW for packet writing
  29. -------------------------------------------------------------
  30.  
  31. The commands differ depending on whether you are using DVD or CD
  32. media.
  33.  
  34. 1) Edit /etc/default/udftools and add your drive for packet writing.
  35. For example, if your CD/DVD writer is /dev/hdc and you want it
  36. available as the default /dev/pktcdvd/0, then use the setting
  37. "DEVICES=/dev/hdc". Execute "/etc/init.d/udftools start" afterwards to
  38. register the device.
  39.  
  40. If the device name /dev/hdc differs on your system, adjust the
  41. following commands as appropriate.
  42.  
  43. 2) Prepare the medium in restricted overwrite mode:
  44.  
  45. DVD-RW: dvd+rw-format -force /dev/hdc
  46. CD-RW: Do nothing, skip this step!
  47.  
  48. 3) Write an empty session spanning the whole medium. It seems that
  49. without this step, any attempt to create the UDF filesystem will fail.
  50.  
  51. DVD-RW: growisofs -Z /dev/hdc=/dev/zero
  52. CD-RW: cdrwtool -d /dev/hdc -q
  53.  
  54. 4) Format the packet device in UDF format.
  55.  
  56. DVD-RW: mkudffs --udfrev=0x0150 --spartable=2 --media-type=dvdrw /dev/pktcdvd/0
  57. CD-RW: mkudffs --udfrev=0x0150 --spartable=2 --media-type=cdrw /dev/pktcdvd/0
  58.  
  59. The parameters require some more explanation: For --udfrev, use either
  60. 0x0150 for UDF version 1.50, or 0x0201 for UDF version 2.01. The
  61. version decision has mostly to do with compatibility:
  62. - Windows 98/ME can read up to v1.02
  63. - Windows 2000, Mac OS 9, Linux 2.4 can read up to v1.50
  64. - Windows 2003/XP can read up to v2.01
  65. - Linux 2.6 can read up to v2.60
  66. For normal data, UDF 1.50 is OK. UDF 2.00 and 2.01 introduce
  67. additional functionality for streaming audio/video.
  68.  
  69. Possible values for --media-type are: hd dvdram dvdrw worm mo cdrw cdr.
  70. Use the one appropriate for your medium/device.
  71.  
  72. 5) Mount the disc. The "noatime" option is important: It will reduce
  73. the amount of writes to the device and thus increase its lifetime. You
  74. may first have to create the mount directory using "mkdir
  75. /media/dvd0":
  76.  
  77. mount -t udf -o rw,noatime /dev/pktcdvd/0 /media/dvd0
  78.  
  79. The "sync" mount option might also be useful, but will typically cause
  80. an increased number of write accesses to the medium. From now on, the
  81. root user can access the filesystem under /media/dvd0 using read and
  82. write operations.
  83.  
  84. 6) If regular users should also have write access, modify the
  85. permissions as follows _while the filesystem is mounted_:
  86.  
  87. chgrp plugdev /media/dvd0 # Set group ownership to "plugdev"
  88. chmod g+rwx /media/dvd0 # Give full read/write access to group
  89.  
  90. Now all users who should have access to the disc need to be added to
  91. the "plugdev" group using "adduser <username> plugdev".
  92.  
  93. To also allow these users to mount and unmount/eject the medium, you
  94. can use either of these two routes:
  95.  
  96. - Install the "pmount" package and add the device to the list of
  97. allowed devices using "echo /dev/pktcdvd/0 >>/etc/pmount.allow".
  98. All members of the group "plugdev" will then be able to mount the
  99. disc using "pmount /dev/pktcdvd/0 dvd0" and unmount it using
  100. "pumount /media/dvd0".
  101.  
  102. - Add a line like the following to /etc/fstab:
  103. /dev/pktcdvd/0 /media/dvd0 udf rw,noatime,users,noauto 0 0
  104. This will enable _all_ users to mount the disc using
  105. "mount /media/dvd0" and unmount it with
  106. "umount /media/dvd0". However, with the permissions from step 5)
  107. above, only the members of group "plugdev" ought to be able to
  108. write to it.
  109.  
  110.  
  111. Support for UDF filesystems
  112. ---------------------------
  113.  
  114. UDF (not packet writing) support in Linux 2.4 and later kernels is
  115. sufficient to read from and write to UDF filesystems. For example, you
  116. can create a regular file, "format" it using mkudffs, and then
  117. loop-mount it. To do this, execute the following commands as root:
  118. (After "count=", supply the required size in MB of the filesystem.)
  119.  
  120. dd if=/dev/zero of=udfimage bs=1M count=10
  121. mkudffs udfimage
  122. mkdir udfmnt
  123. mount -o loop -t udf udfimage udfmnt
  124.  
  125. You need Linux 2.4+ with UDF read *and* write support enabled. Now you
  126. can copy data to the "udfmnt" directory. After an "umount udfmnt", the
  127. file "udfimage" could theoretically be written to a CD-R(W) or
  128. DVD-R(W). In practice, you will not want to do that, as the whole
  129. point of using UDF is to do packet writing.
  130.  
  131.  
  132. -- Richard Atterer <atterer@debian.org> Wed, 22 Nov 2006 23:38:16 +0100