^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) ==============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) Packet writing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) ==============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) Getting started quick
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) ---------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) - Select packet support in the block device section and UDF support in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) the file system section.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) - Compile and install kernel and modules, reboot.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) - You need the udftools package (pktsetup, mkudffs, cdrwtool).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) Download from http://sourceforge.net/projects/linux-udf/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) - Grab a new CD-RW disc and format it (assuming CD-RW is hdc, substitute
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) as appropriate)::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) # cdrwtool -d /dev/hdc -q
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) - Setup your writer::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) # pktsetup dev_name /dev/hdc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) - Now you can mount /dev/pktcdvd/dev_name and copy files to it. Enjoy::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) # mount /dev/pktcdvd/dev_name /cdrom -t udf -o rw,noatime
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) Packet writing for DVD-RW media
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) -------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) DVD-RW discs can be written to much like CD-RW discs if they are in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) the so called "restricted overwrite" mode. To put a disc in restricted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) overwrite mode, run::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) # dvd+rw-format /dev/hdc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) You can then use the disc the same way you would use a CD-RW disc::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) # pktsetup dev_name /dev/hdc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) # mount /dev/pktcdvd/dev_name /cdrom -t udf -o rw,noatime
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) Packet writing for DVD+RW media
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) -------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) According to the DVD+RW specification, a drive supporting DVD+RW discs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) shall implement "true random writes with 2KB granularity", which means
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) that it should be possible to put any filesystem with a block size >=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 2KB on such a disc. For example, it should be possible to do::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) # dvd+rw-format /dev/hdc (only needed if the disc has never
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) been formatted)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) # mkudffs /dev/hdc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) # mount /dev/hdc /cdrom -t udf -o rw,noatime
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) However, some drives don't follow the specification and expect the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) host to perform aligned writes at 32KB boundaries. Other drives do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) follow the specification, but suffer bad performance problems if the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) writes are not 32KB aligned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) Both problems can be solved by using the pktcdvd driver, which always
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) generates aligned writes::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) # dvd+rw-format /dev/hdc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) # pktsetup dev_name /dev/hdc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) # mkudffs /dev/pktcdvd/dev_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) # mount /dev/pktcdvd/dev_name /cdrom -t udf -o rw,noatime
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) Packet writing for DVD-RAM media
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) --------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) DVD-RAM discs are random writable, so using the pktcdvd driver is not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) necessary. However, using the pktcdvd driver can improve performance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) in the same way it does for DVD+RW media.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) Notes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) -----
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) - CD-RW media can usually not be overwritten more than about 1000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) times, so to avoid unnecessary wear on the media, you should always
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) use the noatime mount option.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) - Defect management (ie automatic remapping of bad sectors) has not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) been implemented yet, so you are likely to get at least some
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) filesystem corruption if the disc wears out.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) - Since the pktcdvd driver makes the disc appear as a regular block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) device with a 2KB block size, you can put any filesystem you like on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) the disc. For example, run::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) # /sbin/mke2fs /dev/pktcdvd/dev_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) to create an ext2 filesystem on the disc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) Using the pktcdvd sysfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) ---------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) Since Linux 2.6.20, the pktcdvd module has a sysfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) and can be controlled by it. For example the "pktcdvd" tool uses
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) this interface. (see http://tom.ist-im-web.de/download/pktcdvd )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) "pktcdvd" works similar to "pktsetup", e.g.::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) # pktcdvd -a dev_name /dev/hdc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) # mkudffs /dev/pktcdvd/dev_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) # mount -t udf -o rw,noatime /dev/pktcdvd/dev_name /dvdram
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) # cp files /dvdram
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) # umount /dvdram
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) # pktcdvd -r dev_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) For a description of the sysfs interface look into the file:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) Documentation/ABI/testing/sysfs-class-pktcdvd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) Using the pktcdvd debugfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) -----------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) To read pktcdvd device infos in human readable form, do::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) # cat /sys/kernel/debug/pktcdvd/pktcdvd[0-7]/info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) For a description of the debugfs interface look into the file:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) Documentation/ABI/testing/debugfs-pktcdvd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) Links
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) -----
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) See http://fy.chalmers.se/~appro/linux/DVD+RW/ for more information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) about DVD writing.