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