FreeBSD cd9660 Operations: Verify and Mount Optical Media Safely
Inspect ISO-9660 discs and images on FreeBSD, mount read-only, verify hashes, diagnose device contention, and release media cleanly.
FreeBSD’s cd9660 kernel filesystem driver reads ISO-9660 optical media. It is useful for installation discs, archival media, and ISO images attached through a memory disk. The format is normally used read-only: it is not a general-purpose writable filesystem, and mount success does not prove that the image is complete or authentic.
Treat physical media and image files as separate sources. A disc device can have transport, read, or tray problems. An image file can be truncated, mislabeled, or altered. Hash verification answers whether bytes match a trusted digest; filesystem inspection answers whether the image can be read; neither alone validates publisher authenticity unless the expected digest or signature came from a trusted source.
Identify the optical device first
For physical optical drives, identify the CAM device and review recent kernel messages:
camcontrol devlist -v
dmesg | tail -80
FreeBSD systems may expose an optical device as /dev/cd0, but the exact unit depends on discovery order and hardware. Do not assume /dev/cd0 exists on a virtual machine, laptop without a drive, or system with multiple devices. If the source is an ISO file rather than a physical disc, verify its path, provenance, and trusted checksum; use the vnode-backed workflow in FreeBSD mdconfig: Build and Operate Memory Disk Devices Safely instead of treating the file as a drive.
Mount a physical disc read-only
Create a dedicated empty mountpoint, then mount the identified optical device:
install -d -m 0755 /mnt/optical
mount_cd9660 -o ro /dev/cd0 /mnt/optical
mount -p | grep /mnt/optical
The mount_cd9660(8) utility mounts the filesystem represented by the specified device. The filesystem is intended for read-only access; do not try to use it as writable scratch storage. Use a mountpoint that is not already in use and confirm which filesystem is mounted before reading or copying files.
If the mount fails, distinguish a missing device from filesystem damage. Check that the drive is visible, the media is inserted, the node has the expected identity, and kernel messages do not report I/O errors. Repeated retries against a failing disc can obscure the first useful error or keep the drive busy. Capture the exact failure, then try a known-good disc or another drive to isolate the layer.
Use a bounded read test rather than copying the entire media set blindly. List the root, read a small known file, and compare a file checksum to a trusted manifest when available. For installation media, verify the expected directory structure and release metadata before using the disc in a recovery procedure.
Interpret ISO extensions and filename conversion
Plain ISO-9660 names have stricter limits than common modern filesystems. Images may also contain Rock Ridge or Joliet extensions. Rock Ridge carries Unix-like names and metadata, while Joliet provides a supplementary directory tree with Unicode names. A disc can therefore mount successfully yet show unexpected names, permissions, or paths if the selected tree differs from what the image author intended.
The mount_cd9660 options select how extensions are interpreted. -j ignores Joliet; -r ignores Rock Ridge; -e enables extended attributes; and -g retains ISO version suffixes in displayed names. Avoid adding these flags as generic fixes. First compare the mounted names and metadata with the media’s intended layout, then test one option at a time on a read-only mount.
For Joliet media whose non-ASCII names render incorrectly, -C charset asks cd9660 to convert names to a local charset. The Handbook notes that this conversion requires the cd9660_iconv kernel module. Confirm the module is available and loaded before diagnosing a missing filename as filesystem damage:
if ! kldstat -v | grep -q cd9660_iconv; then
kldload cd9660_iconv || exit 1
fi
mount_cd9660 -o ro -C UTF-8 /dev/cd0 /mnt/optical
Use the charset name supported by the local system and the conversion module; the example is not a universal setting for every locale. Loading a module changes kernel state and may require administrative privileges. For a persistent boot-time load, follow the installed loader.conf(5) documentation and test recovery access before rebooting. If a different tree exposes the expected spelling, record which extension option and charset produced it so the result is reproducible.
Select a data track on multi-session media
Optical discs can contain multiple tracks or sessions. mount_cd9660 normally tries to identify the last data track on a CD-ROM and mount its filesystem. When the table of contents cannot be examined, or the backing device is not a CD-ROM, the driver starts at sector zero. This default can expose an earlier session or fail to show the files expected from a later session.
cdcontrol -f /dev/cd0 info
mount_cd9660 -v -o ro /dev/cd0 /mnt/optical
cdcontrol info displays the disc table of contents; mount_cd9660 -v reports the starting-sector decision. If a particular data session must be selected, use mount_cd9660 -s startsector with the start sector identified from the device’s table of contents. The value is in 2048-byte CD-ROM blocks, not a track number or byte offset. Record the selected track/session and sector alongside the mount result. Do not guess a sector or use a session’s audio track as a filesystem start.
After reading the intended tree, unmount before ejecting or changing media. If the mount is busy, identify open files and working directories beneath it instead of forcing teardown.
Use fstab only for stable, intentional media
Persistent mount configuration can be useful for fixed optical devices, but removable media and unit numbering create race conditions. An fstab entry must identify the correct device and mountpoint, and boot behavior should not block the system when no disc is present. Test the entry with mount -a in a controlled maintenance window and read the installed fstab(5) and mount_cd9660(8) manuals for supported options on the target release.
Do not confuse an ISO image with a device that should be mounted at every boot. For a one-time recovery or software inspection, an explicit command is easier to review and clean up. If an image is operationally important, manage its checksum, storage path, owner, and change history separately from the mount command.
Diagnose common optical-media failures
When files are missing or unreadable, record the device, disc label, trusted image hash if applicable, kernel messages, and exact path. Compare a second drive or a separately verified disc to determine whether the failure follows the media or the host. Inspect for scratches and retry only after the drive is idle.
If the mount succeeds but expected files are absent, inspect the filesystem tree and volume metadata rather than assuming the wrong directory. ISO-9660 extensions can affect filename representation and directory structure. Tools such as isoinfo from a package may provide additional diagnostics, but their output is supplementary; the FreeBSD kernel’s cd9660 behavior remains the mount contract.
When a release disc fails to boot, separate filesystem readability from bootability. A readable disc does not prove that the firmware, bootloader, writer, or optical drive can boot it. Verify the published image checksum, create media with the project’s documented process, and test on the intended firmware path.
Acceptance checks
For a physical disc, confirm the correct drive, intended data track and extension tree, a successful read of expected files, no unexplained I/O errors, and clean unmount before eject. These observations distinguish a filesystem problem from bad media, a failing transport, or an unrelated mountpoint conflict.
cd9660 is a narrow read path, not an archival guarantee. Preserve verified source images elsewhere, keep their provenance, and never use a successful mount as the sole evidence that a recovery artifact is valid.
Related:
- FreeBSD msdosfs Operations: Mount and Recover FAT Removable Media
- FreeBSD makefs: Build and Validate Filesystem Images from Staged Trees
Sources: