CD-R/RWを使う


今更のことですが、CD-ROMをつくる手順をまとめました。

isoイメージを作る

  1. mkisofsコマンドを使う
    ~/cdimage以下にあるディレクトリ・ファイルから1つのCD-Rイメージをつくる
    mkisofs -v -N -D -A '' -r -R -J -P '' -p '' -V 'volume_name' -o cdr.iso ~/cdimage

    CD-ROMのバックアップをつくる
    【FC1】
    mkisofs -v -N -D -A '' -r -R -J -P '' -p '' -V 'volume_name' -o cdr.iso /mnt/cdrom

    【FC5】
    mkisofs -v -N -D -A '' -r -R -J -P '' -p '' -V 'volume_name' -o cdr.iso /media/disk
    options
    -v 処理状況の表示 省略してもよい
    -N ISO9660バージョン情報を省略
    警告が出るが、バージョン番号を必要としないときは問題なし(たぶん誰も使っていない)
    -D 8階層以上のディレクトリ構造を維持
    ISO9660に違反するので、警告が出る。
    -A ボリュームヘッダに記述する文字列(id)で128バイトまで
    シングルクォーテーション(')でくくる
    -r 全ファイルをRead onlyにする(パーミッションを0222)
    -R Rock Rigge拡張
    ISO9660ファイルシステムのファイルを詳細に説明
    -J Joliet拡張 (for MS-windows)
    -P 製作者または会社名
    シングルクォーテーション(')でくくる
    (このオプションは省略してもよい)
    -p 連絡先(e-mailなど)
    シングルクォーテーション(')でくくる
    (このオプションは省略してもよい)
    -V ボリューム名
    シングルクォーテーション(')でくくる
    -o cdr.isoはisoイメージファイルの名称。

    ~/.mkisofsrcにオプションを記述することができる。
    -A APPI=id
    -P PUBL=
    -p PREP=

CD-Rに焼く

  1. ドライブを確認
    cdrecord(dvdrecord) コマンドでドライブを確認する。

    【FC1】

    # cdrecord -scanbus
    Cdrecord-Clone 2.01a19 (i686-redhat-linux-gnu) Copyright (C) 1995-2003 Jorg Schilling
    Linux sg driver version: 3.1.25
    Using libscg version 'schily-0.7'
    cdrecord: Warning: using inofficial libscg transport code version (schily - RedHat-scsi-linux-sg.c-1.75-RH '@(#)scsi-linux-sg.c        1.75 02/10/21 Copyright
    1997 J. Schilling').
    scsibus0:
            0,0,0     0) 'ATAPI   ' 'CD-RW 52X24     ' 'K.VC' Removable CD-ROM
            0,1,0     1) *
            0,2,0     2) *
            0,3,0     3) *
            0,4,0     4) *
            0,5,0     5) *
            0,6,0     6) *
            0,7,0     7) *

    【FC5】

    # cdrecord -scanbus
    Cdrecord-Clone 2.01.01a03-dvd (i686-pc-linux-gnu) Copyright (C) 1995-2005 Jorg Schilling
    NOTE: This version contains the OSS DVD extensions for cdrtools and thus may
          have bugs related to DVD issues that are not present in the original
          cdrtools. Please send bug reports or support requests to
          http://bugzilla.redhat.com/bugzilla The original cdrtools author should
          not be bothered with problems in this version.
    scsidev: 'ATA'
    devname: 'ATA'
    scsibus: -2 target: -2 lun: -2
    Linux sg driver version: 3.5.27
    Using libscg version 'schily-0.8'.
    cdrecord: Warning: using inofficial libscg transport code version (schily - RedHat-scsi-linux-sg.c-1.85-RH '@(#)scsi-linux-sg.c        1.85 05/05/16 Copyright
    1997 J. Schilling').
    scsibus0:
            0,0,0     0) 'HL-DT-ST' 'DVDRAM GSA-4167B' 'DL11' Removable CD-ROM
            0,1,0     1) *
            0,2,0     2) *
            0,3,0     3) *
            0,4,0     4) *
            0,5,0     5) *
            0,6,0     6) *
            0,7,0     7) *

    【FC6】 2006/11/1
    FC6ではdev=ATAが必要でした。

    # cdrecord -scanbus dev=ATA
    Cdrecord-Clone 2.01 (cpu-pc-linux-gnu) Copyright (C) 1995-2004 Jg Schilling
    Note: This version is an unofficial (modified) version with DVD support
    Note: and therefore may have bugs that are not present in the original.
    Note: Please send bug reports or support requests to http://bugzilla.redhat.com/bugzilla
    Note: The author of cdrecord should not be bothered with problems in this version.
    scsidev: 'ATA'
    devname: 'ATA'
    scsibus: -2 target: -2 lun: -2
    Linux sg driver version: 3.5.27
    Using libscg version 'schily-0.8'.
    cdrecord: Warning: using inofficial libscg transport code version (schily - Red Hat-scsi-linux-sg.c-1.83-RH '@(#)scsi-linux-sg.c  1.83 04/05/20 Copyright 1997 J. Schilling').
    scsibus0:
            0,0,0     0) 'HL-DT-ST' 'DVDRAM GSA-H10N ' 'JL10' Removable CD-ROM
            0,1,0     1) *
            0,2,0     2) *
            0,3,0     3) *
            0,4,0     4) *
            0,5,0     5) *
            0,6,0     6) *
            0,7,0     7) *
  2. cdrecordコマンドで書き込む

    【FC1】
    cdrecord -v dev=0,0 speed=48 cdr.iso
    【FC5】
    cdrecord -v dev=ATA:0,0,0 cdr.iso
    【FC6】
    cdrecord -v -sao dev=ATA:0,0,0 driveropt=burnfree cdr.iso

CD-RW

  1. CD-RWがマウントされている場合は、unmntする。
    #unmnt /dev/cdrom
  2. CD-RWをフォーマットする
    # cdrecord dev=0,0 blank=fast
  3. cdrecordコマンドで書き込む
    cdrecord -v dev=0,0 speed=4 cdr.iso



【番外編】isoイメージをマウントする

ディストリビューションからダウンロードしたisoイメージは、CD-Rに焼いた上でOSのインストール作業を始める。CDを焼く手間を省きたくて、ネットワークインストールもすることもある。このようなときはisoイメージを/mnt/cdromにマウントして、"CD-Rを入れたつもり"にする方法が便利だ。

これにはmountコマンドに"-o loop"オプションをつけて
mount -t iso9660 -o loop cdr.iso /mnt/cdrom

とする。これを使っている間、本物のCD-ROMを使用することができなくなるので注意が必要だ。本物のCD-ROMもあわせて使いたいときは、マウントポイントを/mnt/cdrom意外にすればよい。/mnt/cdrom以外であれば、任意のものを使用できるので、/mnt/virtualCD等を用意しておくこともよい。さらに複数のisoイメージを同時に使用することもできる。

mkdir /mnt/virtualCD1 ; mkdir /mnt/virtualCD2 ; mkdir /mnt/virtualCD3 ;
  mount -t iso9660 -o loop cdr1.iso /mnt/virtualCD1
  mount -t iso9660 -o loop cdr2.iso /mnt/virtualCD2
  mount -t iso9660 -o loop cdr3.iso /mnt/virtualCD3

本物のCD-R/ROMに比べるとアクセススピードが速いのもうれしい。


技術資料