162306a36Sopenharmony_ci==============
262306a36Sopenharmony_ciPacket writing
362306a36Sopenharmony_ci==============
462306a36Sopenharmony_ci
562306a36Sopenharmony_ciGetting started quick
662306a36Sopenharmony_ci---------------------
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci- Select packet support in the block device section and UDF support in
962306a36Sopenharmony_ci  the file system section.
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci- Compile and install kernel and modules, reboot.
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci- You need the udftools package (pktsetup, mkudffs, cdrwtool).
1462306a36Sopenharmony_ci  Download from https://github.com/pali/udftools
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci- Grab a new CD-RW disc and format it (assuming CD-RW is hdc, substitute
1762306a36Sopenharmony_ci  as appropriate)::
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci	# cdrwtool -d /dev/hdc -q
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci- Setup your writer::
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci	# pktsetup dev_name /dev/hdc
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci- Now you can mount /dev/pktcdvd/dev_name and copy files to it. Enjoy::
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci	# mount /dev/pktcdvd/dev_name /cdrom -t udf -o rw,noatime
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ciPacket writing for DVD-RW media
3162306a36Sopenharmony_ci-------------------------------
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ciDVD-RW discs can be written to much like CD-RW discs if they are in
3462306a36Sopenharmony_cithe so called "restricted overwrite" mode. To put a disc in restricted
3562306a36Sopenharmony_cioverwrite mode, run::
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci	# dvd+rw-format /dev/hdc
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ciYou can then use the disc the same way you would use a CD-RW disc::
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci	# pktsetup dev_name /dev/hdc
4262306a36Sopenharmony_ci	# mount /dev/pktcdvd/dev_name /cdrom -t udf -o rw,noatime
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ciPacket writing for DVD+RW media
4662306a36Sopenharmony_ci-------------------------------
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ciAccording to the DVD+RW specification, a drive supporting DVD+RW discs
4962306a36Sopenharmony_cishall implement "true random writes with 2KB granularity", which means
5062306a36Sopenharmony_cithat it should be possible to put any filesystem with a block size >=
5162306a36Sopenharmony_ci2KB on such a disc. For example, it should be possible to do::
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci	# dvd+rw-format /dev/hdc   (only needed if the disc has never
5462306a36Sopenharmony_ci	                            been formatted)
5562306a36Sopenharmony_ci	# mkudffs /dev/hdc
5662306a36Sopenharmony_ci	# mount /dev/hdc /cdrom -t udf -o rw,noatime
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ciHowever, some drives don't follow the specification and expect the
5962306a36Sopenharmony_cihost to perform aligned writes at 32KB boundaries. Other drives do
6062306a36Sopenharmony_cifollow the specification, but suffer bad performance problems if the
6162306a36Sopenharmony_ciwrites are not 32KB aligned.
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ciBoth problems can be solved by using the pktcdvd driver, which always
6462306a36Sopenharmony_cigenerates aligned writes::
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci	# dvd+rw-format /dev/hdc
6762306a36Sopenharmony_ci	# pktsetup dev_name /dev/hdc
6862306a36Sopenharmony_ci	# mkudffs /dev/pktcdvd/dev_name
6962306a36Sopenharmony_ci	# mount /dev/pktcdvd/dev_name /cdrom -t udf -o rw,noatime
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ciPacket writing for DVD-RAM media
7362306a36Sopenharmony_ci--------------------------------
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ciDVD-RAM discs are random writable, so using the pktcdvd driver is not
7662306a36Sopenharmony_cinecessary. However, using the pktcdvd driver can improve performance
7762306a36Sopenharmony_ciin the same way it does for DVD+RW media.
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ciNotes
8162306a36Sopenharmony_ci-----
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci- CD-RW media can usually not be overwritten more than about 1000
8462306a36Sopenharmony_ci  times, so to avoid unnecessary wear on the media, you should always
8562306a36Sopenharmony_ci  use the noatime mount option.
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci- Defect management (ie automatic remapping of bad sectors) has not
8862306a36Sopenharmony_ci  been implemented yet, so you are likely to get at least some
8962306a36Sopenharmony_ci  filesystem corruption if the disc wears out.
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci- Since the pktcdvd driver makes the disc appear as a regular block
9262306a36Sopenharmony_ci  device with a 2KB block size, you can put any filesystem you like on
9362306a36Sopenharmony_ci  the disc. For example, run::
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci	# /sbin/mke2fs /dev/pktcdvd/dev_name
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci  to create an ext2 filesystem on the disc.
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ciUsing the pktcdvd sysfs interface
10162306a36Sopenharmony_ci---------------------------------
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ciSince Linux 2.6.20, the pktcdvd module has a sysfs interface
10462306a36Sopenharmony_ciand can be controlled by it. For example the "pktcdvd" tool uses
10562306a36Sopenharmony_cithis interface. (see http://tom.ist-im-web.de/linux/software/pktcdvd )
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci"pktcdvd" works similar to "pktsetup", e.g.::
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci	# pktcdvd -a dev_name /dev/hdc
11062306a36Sopenharmony_ci	# mkudffs /dev/pktcdvd/dev_name
11162306a36Sopenharmony_ci	# mount -t udf -o rw,noatime /dev/pktcdvd/dev_name /dvdram
11262306a36Sopenharmony_ci	# cp files /dvdram
11362306a36Sopenharmony_ci	# umount /dvdram
11462306a36Sopenharmony_ci	# pktcdvd -r dev_name
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ciFor a description of the sysfs interface look into the file:
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci  Documentation/ABI/testing/sysfs-class-pktcdvd
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ciUsing the pktcdvd debugfs interface
12362306a36Sopenharmony_ci-----------------------------------
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ciTo read pktcdvd device infos in human readable form, do::
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ci	# cat /sys/kernel/debug/pktcdvd/pktcdvd[0-7]/info
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ciFor a description of the debugfs interface look into the file:
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci  Documentation/ABI/testing/debugfs-pktcdvd
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci
13562306a36Sopenharmony_ciLinks
13662306a36Sopenharmony_ci-----
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ciSee http://fy.chalmers.se/~appro/linux/DVD+RW/ for more information
13962306a36Sopenharmony_ciabout DVD writing.
140