This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.
Please visit our production wiki at https://wiki.gentoo.org
CD/DVD/BD Writing
- Describe how to write UDF images to CDs
- Add systemd replacement for the /etc/init.d/pktcdvd init script
Installation
Kernel
Configure the kernel to support the filesystems necessary for reading and writing ISO disks.
File systems ---> CD-ROM/DVD Filesystems ---> <*> ISO 9660 CDROM file system support [*] Microsoft Joliet CDROM extensions [*] Transparent decompression extension <*> UDF file system support
Emerge
Follow the CDROM page for hardware driver kernel configuration, along with including UDF write support.
Install the app-cdr/cdrtools or app-cdr/dvd+rw-tools packages, for writing CD/DVD/BD media:
root #
emerge --ask app-cdr/cdrtools
Or:
root #
emerge --ask app-cdr/dvd+rw-tools
For UDF writing, ensure included the above mentioned UDF kernel drivers and the following package:
root #
emerge --ask sys-fs/udftools
Best practice is to use read write (RW/RE) media for testing writing ISO9660/UDF filesystem images. If a command fails to work, or the hardware or media fails, you can try again.
Usage
Usage for the ISO9660/UDF filesystem.
Determine the size of media
First, find the maximum size the media can contain.
user $
dvd+rw-mediainfo /dev/sr0
Track Size: 24438784*2KB
Or 24438784*2KB = 48877568 KB for 50GB BD-R DL (Blu-ray dual layer) media.
user $
truncate --size=48877568KB test.udf
Or you can use the following with disabling defect management:
user $
truncate --size=50GB ./test.udf
Defect management sets aside 256MB aside during formatting and also reduces write to half-speed. See the writing section below for specifics.
Create and populate filesystem
Create either a ISO9660 or a UDF filesystem. Microsoft Windows uses lvid for optical media title:
user $
mkudffs --lvid="MY_VOLUME" --utf8 ./test.udf
Mount the filesystem:
user $
sudo mount -oloop,rw ./test.udf /mnt/tmp/
Populate filesystem:
user $
rsync -ax --delete /home/larry/Documents/ /mnt/tmp/
Verify proper permissions are preserved:
user $
chown -R larry.larry /mnt/tmp
user $
chmod -R a+r /mnt/tmp
user $
chmod -R go-w /mnt/tmp
Writing
CD-RW media
CD-RW media requires the packet device driver and starting the /etc/init.d/pktcdvd service and the following line within fstab:
/etc/fstab
/dev/pktcdvd/0 /mnt/udfwrite udf user,noauto,noatime,utf8 0 0
DVD/Blu-ray (RW/RE) media
DVD-RW, DVD+RW, and Blu-ray Recordable Erasable (BD-RE) media can be easily written by simply mounting the media and writing to the media as a normal filesystem, as these devices and media allow random writing, versus CD-RW only allowing sequential writing.
Image writing
CD writing
ISO
user $
cdrecord -scanbus
user $
cdrecord -speed=40 dev=2,0,0 -eject -dao driveropts=burnfree test.iso
UDF
TODO
DVD/Blu-ray
BD defect management
By default growisofs uses defect management which requires 256MB extra space and uses reduced write speeds. This may be disabled via:
user $
dvd+rw-format /dev/dvd -ssa=none
And use the following after writing to ensure files are properly written:
user $
diff -r /home/larry/Documents/ /mnt/tmp/
ISO
user $
growisofs -Z /dev/sr0=test.iso
UDF
Atypically, you can write with the following as long as you are within the limits of your DVD/BD media's size limitations:
user $
growisofs -dvd-compat -Z /dev/sr0=test.udf
If you have used the above truncate with 25GB/50GB, specifying the top limits of BD media, you will need to disable Defect Management requiring 256MB extra space:
user $
growisofs -use-the-force-luke=spare:none -dvd-compat -speed=4 -Z /dev/sr0=test.udf