18ea61889SMauro Carvalho Chehab============== 28ea61889SMauro Carvalho ChehabPacket writing 38ea61889SMauro Carvalho Chehab============== 48ea61889SMauro Carvalho Chehab 58ea61889SMauro Carvalho ChehabGetting started quick 68ea61889SMauro Carvalho Chehab--------------------- 78ea61889SMauro Carvalho Chehab 88ea61889SMauro Carvalho Chehab- Select packet support in the block device section and UDF support in 98ea61889SMauro Carvalho Chehab the file system section. 108ea61889SMauro Carvalho Chehab 118ea61889SMauro Carvalho Chehab- Compile and install kernel and modules, reboot. 128ea61889SMauro Carvalho Chehab 138ea61889SMauro Carvalho Chehab- You need the udftools package (pktsetup, mkudffs, cdrwtool). 14*013ebb6dSPali Rohár Download from https://github.com/pali/udftools 158ea61889SMauro Carvalho Chehab 168ea61889SMauro Carvalho Chehab- Grab a new CD-RW disc and format it (assuming CD-RW is hdc, substitute 178ea61889SMauro Carvalho Chehab as appropriate):: 188ea61889SMauro Carvalho Chehab 198ea61889SMauro Carvalho Chehab # cdrwtool -d /dev/hdc -q 208ea61889SMauro Carvalho Chehab 218ea61889SMauro Carvalho Chehab- Setup your writer:: 228ea61889SMauro Carvalho Chehab 238ea61889SMauro Carvalho Chehab # pktsetup dev_name /dev/hdc 248ea61889SMauro Carvalho Chehab 258ea61889SMauro Carvalho Chehab- Now you can mount /dev/pktcdvd/dev_name and copy files to it. Enjoy:: 268ea61889SMauro Carvalho Chehab 278ea61889SMauro Carvalho Chehab # mount /dev/pktcdvd/dev_name /cdrom -t udf -o rw,noatime 288ea61889SMauro Carvalho Chehab 298ea61889SMauro Carvalho Chehab 308ea61889SMauro Carvalho ChehabPacket writing for DVD-RW media 318ea61889SMauro Carvalho Chehab------------------------------- 328ea61889SMauro Carvalho Chehab 338ea61889SMauro Carvalho ChehabDVD-RW discs can be written to much like CD-RW discs if they are in 348ea61889SMauro Carvalho Chehabthe so called "restricted overwrite" mode. To put a disc in restricted 358ea61889SMauro Carvalho Chehaboverwrite mode, run:: 368ea61889SMauro Carvalho Chehab 378ea61889SMauro Carvalho Chehab # dvd+rw-format /dev/hdc 388ea61889SMauro Carvalho Chehab 398ea61889SMauro Carvalho ChehabYou can then use the disc the same way you would use a CD-RW disc:: 408ea61889SMauro Carvalho Chehab 418ea61889SMauro Carvalho Chehab # pktsetup dev_name /dev/hdc 428ea61889SMauro Carvalho Chehab # mount /dev/pktcdvd/dev_name /cdrom -t udf -o rw,noatime 438ea61889SMauro Carvalho Chehab 448ea61889SMauro Carvalho Chehab 458ea61889SMauro Carvalho ChehabPacket writing for DVD+RW media 468ea61889SMauro Carvalho Chehab------------------------------- 478ea61889SMauro Carvalho Chehab 488ea61889SMauro Carvalho ChehabAccording to the DVD+RW specification, a drive supporting DVD+RW discs 498ea61889SMauro Carvalho Chehabshall implement "true random writes with 2KB granularity", which means 508ea61889SMauro Carvalho Chehabthat it should be possible to put any filesystem with a block size >= 518ea61889SMauro Carvalho Chehab2KB on such a disc. For example, it should be possible to do:: 528ea61889SMauro Carvalho Chehab 538ea61889SMauro Carvalho Chehab # dvd+rw-format /dev/hdc (only needed if the disc has never 548ea61889SMauro Carvalho Chehab been formatted) 558ea61889SMauro Carvalho Chehab # mkudffs /dev/hdc 568ea61889SMauro Carvalho Chehab # mount /dev/hdc /cdrom -t udf -o rw,noatime 578ea61889SMauro Carvalho Chehab 588ea61889SMauro Carvalho ChehabHowever, some drives don't follow the specification and expect the 598ea61889SMauro Carvalho Chehabhost to perform aligned writes at 32KB boundaries. Other drives do 608ea61889SMauro Carvalho Chehabfollow the specification, but suffer bad performance problems if the 618ea61889SMauro Carvalho Chehabwrites are not 32KB aligned. 628ea61889SMauro Carvalho Chehab 638ea61889SMauro Carvalho ChehabBoth problems can be solved by using the pktcdvd driver, which always 648ea61889SMauro Carvalho Chehabgenerates aligned writes:: 658ea61889SMauro Carvalho Chehab 668ea61889SMauro Carvalho Chehab # dvd+rw-format /dev/hdc 678ea61889SMauro Carvalho Chehab # pktsetup dev_name /dev/hdc 688ea61889SMauro Carvalho Chehab # mkudffs /dev/pktcdvd/dev_name 698ea61889SMauro Carvalho Chehab # mount /dev/pktcdvd/dev_name /cdrom -t udf -o rw,noatime 708ea61889SMauro Carvalho Chehab 718ea61889SMauro Carvalho Chehab 728ea61889SMauro Carvalho ChehabPacket writing for DVD-RAM media 738ea61889SMauro Carvalho Chehab-------------------------------- 748ea61889SMauro Carvalho Chehab 758ea61889SMauro Carvalho ChehabDVD-RAM discs are random writable, so using the pktcdvd driver is not 768ea61889SMauro Carvalho Chehabnecessary. However, using the pktcdvd driver can improve performance 778ea61889SMauro Carvalho Chehabin the same way it does for DVD+RW media. 788ea61889SMauro Carvalho Chehab 798ea61889SMauro Carvalho Chehab 808ea61889SMauro Carvalho ChehabNotes 818ea61889SMauro Carvalho Chehab----- 828ea61889SMauro Carvalho Chehab 838ea61889SMauro Carvalho Chehab- CD-RW media can usually not be overwritten more than about 1000 848ea61889SMauro Carvalho Chehab times, so to avoid unnecessary wear on the media, you should always 858ea61889SMauro Carvalho Chehab use the noatime mount option. 868ea61889SMauro Carvalho Chehab 878ea61889SMauro Carvalho Chehab- Defect management (ie automatic remapping of bad sectors) has not 888ea61889SMauro Carvalho Chehab been implemented yet, so you are likely to get at least some 898ea61889SMauro Carvalho Chehab filesystem corruption if the disc wears out. 908ea61889SMauro Carvalho Chehab 918ea61889SMauro Carvalho Chehab- Since the pktcdvd driver makes the disc appear as a regular block 928ea61889SMauro Carvalho Chehab device with a 2KB block size, you can put any filesystem you like on 938ea61889SMauro Carvalho Chehab the disc. For example, run:: 948ea61889SMauro Carvalho Chehab 958ea61889SMauro Carvalho Chehab # /sbin/mke2fs /dev/pktcdvd/dev_name 968ea61889SMauro Carvalho Chehab 978ea61889SMauro Carvalho Chehab to create an ext2 filesystem on the disc. 988ea61889SMauro Carvalho Chehab 998ea61889SMauro Carvalho Chehab 1008ea61889SMauro Carvalho ChehabUsing the pktcdvd sysfs interface 1018ea61889SMauro Carvalho Chehab--------------------------------- 1028ea61889SMauro Carvalho Chehab 1038ea61889SMauro Carvalho ChehabSince Linux 2.6.20, the pktcdvd module has a sysfs interface 1048ea61889SMauro Carvalho Chehaband can be controlled by it. For example the "pktcdvd" tool uses 105*013ebb6dSPali Rohárthis interface. (see http://tom.ist-im-web.de/linux/software/pktcdvd ) 1068ea61889SMauro Carvalho Chehab 1078ea61889SMauro Carvalho Chehab"pktcdvd" works similar to "pktsetup", e.g.:: 1088ea61889SMauro Carvalho Chehab 1098ea61889SMauro Carvalho Chehab # pktcdvd -a dev_name /dev/hdc 1108ea61889SMauro Carvalho Chehab # mkudffs /dev/pktcdvd/dev_name 1118ea61889SMauro Carvalho Chehab # mount -t udf -o rw,noatime /dev/pktcdvd/dev_name /dvdram 1128ea61889SMauro Carvalho Chehab # cp files /dvdram 1138ea61889SMauro Carvalho Chehab # umount /dvdram 1148ea61889SMauro Carvalho Chehab # pktcdvd -r dev_name 1158ea61889SMauro Carvalho Chehab 1168ea61889SMauro Carvalho Chehab 1178ea61889SMauro Carvalho ChehabFor a description of the sysfs interface look into the file: 1188ea61889SMauro Carvalho Chehab 1198ea61889SMauro Carvalho Chehab Documentation/ABI/testing/sysfs-class-pktcdvd 1208ea61889SMauro Carvalho Chehab 1218ea61889SMauro Carvalho Chehab 1228ea61889SMauro Carvalho ChehabUsing the pktcdvd debugfs interface 1238ea61889SMauro Carvalho Chehab----------------------------------- 1248ea61889SMauro Carvalho Chehab 1258ea61889SMauro Carvalho ChehabTo read pktcdvd device infos in human readable form, do:: 1268ea61889SMauro Carvalho Chehab 1278ea61889SMauro Carvalho Chehab # cat /sys/kernel/debug/pktcdvd/pktcdvd[0-7]/info 1288ea61889SMauro Carvalho Chehab 1298ea61889SMauro Carvalho ChehabFor a description of the debugfs interface look into the file: 1308ea61889SMauro Carvalho Chehab 1318ea61889SMauro Carvalho Chehab Documentation/ABI/testing/debugfs-pktcdvd 1328ea61889SMauro Carvalho Chehab 1338ea61889SMauro Carvalho Chehab 1348ea61889SMauro Carvalho Chehab 1358ea61889SMauro Carvalho ChehabLinks 1368ea61889SMauro Carvalho Chehab----- 1378ea61889SMauro Carvalho Chehab 1388ea61889SMauro Carvalho ChehabSee http://fy.chalmers.se/~appro/linux/DVD+RW/ for more information 1398ea61889SMauro Carvalho Chehababout DVD writing. 140