起因是使用Finder刻录的DVD-R(DVD+R)光盘,会在刻录完成后封盘,无法进行续刻。

像Windows操作系统会在首次插入空白光盘时询问磁盘刻录方式,Mac中没有相关的工具能够完成。

最终寻找到了两个可以使用的工具,cdrtoos以及dvd+rw-tools,这两个工具包是Linux上刻录CD/DVD的工具,macOS上也可以使用,可能稍微有些许区别,本文以macOS系统为例。

安装需要使用的工具

brew install cdrtools dvd+rw-tools

https://cdrtools.sourceforge.net/private/cdrecord.html
https://fy.chalmers.se/~appro/linux/DVD+RW/

CD的续刻

首次刻录制作track1.iso

mkisofs -o track1.iso -Jrv -V "MyCD" /path/to/data1

首次刻录

cdrecord -scanbus 获取设备

cdrecord dev=1,0,0 fs=8m speed=8 -multi driveropts=burnfree -data track1.iso
driveropts=burnfree是刻录DVD时需要的参数。

续刻数据

cdrecord dev=1,0,0 -msinfo

mkisofs -o track2.iso -Jrv -V "MyCD" -C  0,13145 -M 1,0,0 /path/to/data2

cdrecord dev=1,0,0 fs=8m speed=8 -multi -data track2.iso

最后一次刻录,去掉-multi参数将会在刻录完成后封盘

cdrecord -v -eject显示详情并在刻录完成后推出光盘

警告, 'diskarbitrationd'正在运行,并且不允许我们向驱动器发送SCSI命令。
为了允许我们发送SCSI命令,需要如下操作:

推出所有可移动设备,使用root执行:

kill -STOP `(ps -ef | grep -v grep | grep diskarbitrationd | awk '{ print $2 }')`

重新运行执行失败的命令后,使用root用户恢复'diskarbitrationd':

kill -CONT `(ps -ef | grep -v grep | grep diskarbitrationd | awk '{ print $2 }')`

DVD的续刻

首次刻录:

growisofs -Z /dev/rdisk6 -Jrv -V "DVD" /path/to/data

附加刻录:

growisofs -M /dev/rdisk6 -V dvdname -Jrv -V "DVD" /path/to/newdata

macOS中dvd+rw-tools需要的补丁

在dvd+rw-tools源码中需要对cdrtools添加这个补丁,才能将标准输入提供给mkisofs指令。

#define PASS_STDIN_TO_MKISOFS
#define CANNOT_PASS_DEV_FD_N_TO_MKISOFS
#if !defined(CANNOT_PASS_DEV_FD_N_TO_MKISOFS)
#error "CANNOT_PASS_DEV_FD_N_TO_MKISOFS has to be defined"
/*
 * Even though /dev/fd/N is present on Mac OS X we can't pass it
 * to mkisofs for following reason. The trouble is that in order
 * to ObtainExclusiveAccess, which is required for raw SCSI, no
 * /dev/[r]diskN descriptors may be open by that time. Now, if
 * I pass /dev/fd/N, mkisofs would reopen it and close only this
 * duplicate descriptor leaving original N open. Therefore I
 * pass -M - to allow mkisofs to simply take stdin and close it
 * when it's done with previous session directory scructure.
 * Needless to mention that mkisofs has to be patched to accept
 * dash as -M argument:

--- mkisofs/multi.c.orig        2004-05-15 18:59:40.000000000 +0200
+++ mkisofs/multi.c     2006-09-11 23:50:23.000000000 +0200
@@ -1137,6 +1137,14 @@
 open_merge_image(path)
        char    *path;
 {
+       if (path[0]=='-' && path[1]=='\0') {
+#ifdef NEED_O_BINARY
+               setmode(fileno(stdin),O_BINARY);
+#endif
+               in_image = stdin;
+               return (0);
+       }
+
 #ifndef        USE_SCG
        in_image = fopen(path, "rb");
        if (in_image == NULL) {
---
 */
#endif
最后修改:2024 年 06 月 09 日
如果觉得我的文章对你有用,请随意赞赏