Diff for /wikisrc/guide/rmmedia.mdwn between versions 1.1 and 1.2

version 1.1, 2013/03/10 02:19:55 version 1.2, 2013/03/10 09:55:40
Line 2 Line 2
   
 ## Reading data CDs with NetBSD  ## Reading data CDs with NetBSD
   
 Data CDs can contain anything from programs, sound files (MP3, wav), movies   Data CDs can contain anything from programs, sound files (MP3, wav), movies
 (MP3, QuickTime) to source code, text files, etc. Before accessing these files,   (MP3, QuickTime) to source code, text files, etc. Before accessing these files,
 a CD must be mounted on a directory, much like hard disks are. Just as hard   a CD must be mounted on a directory, much like hard disks are. Just as hard
 disks can use different filesystems (ffs, lfs, ext2fs, ...), CDs have their own   disks can use different filesystems (ffs, lfs, ext2fs, ...), CDs have their own
 filesystem, *cd9660*. The NetBSD cd9660 filesystem can handle filesystems   filesystem, *cd9660*. The NetBSD cd9660 filesystem can handle filesystems
 without and with Rockridge and Joliet extensions.  without and with Rockridge and Joliet extensions.
   
 CD devices are named /dev/cd0a for both SCSI and IDE (ATAPI).  CD devices are named /dev/cd0a for both SCSI and IDE (ATAPI).
Line 21  With this information, we can start: Line 21  With this information, we can start:
              cd0: drive supports PIO mode 4, DMA mode 0               cd0: drive supports PIO mode 4, DMA mode 0
              cd0(pciide0:1:0): using PIO mode 0, DMA mode 0 (using DMA data transfers)               cd0(pciide0:1:0): using PIO mode 0, DMA mode 0 (using DMA data transfers)
   
         We have one drive here, "cd0". It is an IDE/ATAPI drive, as it is found on           We have one drive here, `cd0`. It is an IDE/ATAPI drive, as it is found on
         atapibus0. Of course the drive (rather, its medium) is removable, i.e., you           atapibus0. Of course the drive (rather, its medium) is removable, i.e., you
         can eject it. See below.          can eject it. See below.
   
  2. Insert a CD   2. Insert a CD
Line 31  With this information, we can start: Line 31  With this information, we can start:
   
         # mount -t cd9660 /dev/cd0a /mnt          # mount -t cd9660 /dev/cd0a /mnt
   
         This command shouldn't print anything. It instructs the system to mount the           This command shouldn't print anything. It instructs the system to mount the
         CD found on /dev/cd0a on /mnt, using the "cd9660" filesystem. The mountpoint           CD found on /dev/cd0a on /mnt, using the `cd9660` filesystem. The mountpoint
         "/mnt" must be an existing directory.          `/mnt` must be an existing directory.
   
  4. Check the contents of the CD:   4. Check the contents of the CD:
   
Line 47  With this information, we can start: Line 47  With this information, we can start:
   
         # umount /mnt          # umount /mnt
   
         If the CD is still accessed (e.g. some other shell's still "cd"'d into it),           If the CD is still accessed (e.g. some other shell's still "cd"'d into it),
         this will not work. If you shut down the system, the CD will be unmounted           this will not work. If you shut down the system, the CD will be unmounted
         automatically for you, there's nothing to worry about there.          automatically for you, there's nothing to worry about there.
   
  6. Making an entry in /etc/fstab:   6. Making an entry in /etc/fstab:
   
         If you don't want to type the full "mount" command each time, you can put           If you don't want to type the full "mount" command each time, you can put
         most of the values into a line in /etc/fstab:          most of the values into a line in /etc/fstab:
   
         # Device        mountpoint      filesystem  mount options          # Device        mountpoint      filesystem  mount options
Line 69  With this information, we can start: Line 69  With this information, we can start:
   
     Access and unmount as before.      Access and unmount as before.
   
         The CD is not mounted at boot time due to the "noauto" mount option - this           The CD is not mounted at boot time due to the "noauto" mount option - this
         is useful as you'll probably not have a CD in the drive all the time. See           is useful as you'll probably not have a CD in the drive all the time. See
         [mount(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mount+8+NetBSD-5.0.1+i386)           [mount(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mount+8+NetBSD-5.0.1+i386)
         and           and
         [mount\_cd9660(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mount_cd9660+8+NetBSD-5.0.1+i386)           [mount\_cd9660(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mount_cd9660+8+NetBSD-5.0.1+i386)
         for some other useful options.          for some other useful options.
   
 7.  Eject the CD:  7.  Eject the CD:
   
         # eject cd0          # eject cd0
   
         If the CD is still mounted, it will be unmounted if possible, before being           If the CD is still mounted, it will be unmounted if possible, before being
         ejected.          ejected.
   
 ## Reading multi-session CDs with NetBSD  ## Reading multi-session CDs with NetBSD
   
 Use   Use
 [mscdlabel(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mscdlabel+8+NetBSD-5.0.1+i386)   [mscdlabel(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mscdlabel+8+NetBSD-5.0.1+i386)
 to add all sessions to the CDs disklabel, and then use the appropriate device   to add all sessions to the CDs disklabel, and then use the appropriate device
 node to mount the session you want. You might have to create the corresponding   node to mount the session you want. You might have to create the corresponding
 device nodes in `/dev` manually. For example:  device nodes in `/dev` manually. For example:
   
     # mscdlabel cd1      # mscdlabel cd1
Line 104  device nodes in `/dev` manually. For exa Line 104  device nodes in `/dev` manually. For exa
     brw-r-----  1 root  operator       6, 11 Mar 18 21:55 cd1d      brw-r-----  1 root  operator       6, 11 Mar 18 21:55 cd1d
     # mknod cd1b b 6 9      # mknod cd1b b 6 9
   
 to create `/dev/cd1b`. Make sure you fix the permissions of any new device nodes   to create `/dev/cd1b`. Make sure you fix the permissions of any new device nodes
 you create:  you create:
   
     # ls -l cd1*      # ls -l cd1*
Line 113  you create: Line 113  you create:
     brw-r-----  1 root  operator       6, 11 Mar 18 21:55 cd1d      brw-r-----  1 root  operator       6, 11 Mar 18 21:55 cd1d
     # chgrp operator cd1b      # chgrp operator cd1b
     # chmod 640 cd1b      # chmod 640 cd1b
     # ls -l cd1*       # ls -l cd1*
     brw-r-----  1 root  operator       6,  8 Mar 18 21:55 cd1a      brw-r-----  1 root  operator       6,  8 Mar 18 21:55 cd1a
     brw-r-----  1 root  operator       6,  9 Mar 18 22:24 cd1b      brw-r-----  1 root  operator       6,  9 Mar 18 22:24 cd1b
     brw-r-----  1 root  operator       6, 11 Mar 18 21:55 cd1d      brw-r-----  1 root  operator       6, 11 Mar 18 21:55 cd1d
Line 124  Now you should be able to mount it. Line 124  Now you should be able to mount it.
   
 ## Allowing normal users to access CDs  ## Allowing normal users to access CDs
   
 By default, NetBSD only allows "root" to mount a filesystem. If you want any   By default, NetBSD only allows "root" to mount a filesystem. If you want any
 user to be able to do this, perform the following steps:  user to be able to do this, perform the following steps:
   
  * Give groups and other the access rights to the device.   * Give groups and other the access rights to the device.
Line 135  user to be able to do this, perform the  Line 135  user to be able to do this, perform the 
   
         # sysctl -w vfs.generic.usermount=1          # sysctl -w vfs.generic.usermount=1
   
         Note that this works for any filesystem and device, not only for CDs with a           Note that this works for any filesystem and device, not only for CDs with a
         ISO 9660 filesystem.          ISO 9660 filesystem.
   
 To perform the mount operation after these commands, the user must own the mount   To perform the mount operation after these commands, the user must own the mount
 point. So, for example:  point. So, for example:
   
     $ cd $HOME      $ cd $HOME
     $ mkdir cdrom      $ mkdir cdrom
     $ mount -t cd9660 -o nodev,nosuid /dev/cd0a `pwd`/cdrom      $ mount -t cd9660 -o nodev,nosuid /dev/cd0a `pwd`/cdrom
   
 *Note*: The mount options `nodev` and `nosuid` are mandatory from NetBSD 4.0 on.   *Note*: The mount options `nodev` and `nosuid` are mandatory from NetBSD 4.0 on.
 They are not necessary on NetBSD 3.x systems.  They are not necessary on NetBSD 3.x systems.
   
 Please also see   Please also see
 [mount(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mount+8+NetBSD-5.0.1+i386) and   [mount(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mount+8+NetBSD-5.0.1+i386) and
 as an alternative the *auto mount daemon*   as an alternative the *auto mount daemon*
 [amd(8)](http://netbsd.gw.com/cgi-bin/man-cgi?amd+8+NetBSD-5.0.1+i386), for   [amd(8)](http://netbsd.gw.com/cgi-bin/man-cgi?amd+8+NetBSD-5.0.1+i386), for
 which example config files can be found in `/usr/share/examples/amd`.  which example config files can be found in `/usr/share/examples/amd`.
   
 ## Mounting an ISO image  ## Mounting an ISO image
   
 Sometimes, it is interesting to mount an ISO9660 image file before you burn the   Sometimes, it is interesting to mount an ISO9660 image file before you burn the
 CD; this way, you can examine its contents or even copy files to the outside. If   CD; this way, you can examine its contents or even copy files to the outside. If
 you are a Linux user, you should know that this is done with the special *loop*   you are a Linux user, you should know that this is done with the special *loop*
 filesystem. NetBSD does it another way, using the *vnode* pseudo-disk.  filesystem. NetBSD does it another way, using the *vnode* pseudo-disk.
   
 We will illustrate how to do this with an example. Suppose you have an ISO image   We will illustrate how to do this with an example. Suppose you have an ISO image
 in your home directory, called `mycd.iso`:  in your home directory, called `mycd.iso`:
   
  1. Start by setting up a new vnode, "pointing" to the ISO file:   1. Start by setting up a new vnode, "pointing" to the ISO file:
Line 172  in your home directory, called `mycd.iso Line 172  in your home directory, called `mycd.iso
   
         # mount -t cd9660 /dev/vnd0a /mnt          # mount -t cd9660 /dev/vnd0a /mnt
   
  3. Yeah, image contents appear under `/mnt`! Go to that directory and explore    3. Yeah, image contents appear under `/mnt`! Go to that directory and explore
     the image.      the image.
   
  4. When you are happy, you have to umount the image:   4. When you are happy, you have to umount the image:
Line 183  in your home directory, called `mycd.iso Line 183  in your home directory, called `mycd.iso
   
         # vnconfig -u vnd0          # vnconfig -u vnd0
   
 Note that these steps can also be used for any kind of file that contains a   Note that these steps can also be used for any kind of file that contains a
 filesystem, not just ISO images.  filesystem, not just ISO images.
   
 See the [vnd(4)](http://netbsd.gw.com/cgi-bin/man-cgi?vnd+4+NetBSD-5.0.1+i386)   See the [vnd(4)](http://netbsd.gw.com/cgi-bin/man-cgi?vnd+4+NetBSD-5.0.1+i386)
 and   and
 [vnconfig(8)](http://netbsd.gw.com/cgi-bin/man-cgi?vnconfig+8+NetBSD-5.0.1+i386)   [vnconfig(8)](http://netbsd.gw.com/cgi-bin/man-cgi?vnconfig+8+NetBSD-5.0.1+i386)
 man pages for more information.  man pages for more information.
   
 ## Using video CDs with NetBSD  ## Using video CDs with NetBSD
   
 To play MPEG Video streams as many DVD players can play them under NetBSD, mount   To play MPEG Video streams as many DVD players can play them under NetBSD, mount
 the CD as you would do with any normal (data) CD (see [[Reading data CDs with   the CD as you would do with any normal (data) CD (see [[Reading data CDs with
 NetBSD|guide/rmmedia#cdrom]]), then use the   NetBSD|guide/rmmedia#cdrom]]), then use the
 [`multimedia/xine-ui`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/xine-ui/README.html),   [`multimedia/xine-ui`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/xine-ui/README.html),
 [`multimedia/mplayer`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/mplayer/README.html)   [`multimedia/mplayer`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/mplayer/README.html)
 or   or
 [`multimedia/gmplayer`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/gmplayer/README.html)   [`multimedia/gmplayer`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/gmplayer/README.html)
 package to play the mpeg files stored on the CD.  package to play the mpeg files stored on the CD.
   
 ## Using audio CDs with NetBSD  ## Using audio CDs with NetBSD
   
 There are two ways to handle audio CDs:  There are two ways to handle audio CDs:
   
  1. Tell the CD drive to play to the headphone or to a soundcard, to which    1. Tell the CD drive to play to the headphone or to a soundcard, to which
         CDROMs are usually connected internally. Use programs like           CDROMs are usually connected internally. Use programs like
         [cdplay(1)](http://netbsd.gw.com/cgi-bin/man-cgi?cdplay+1+NetBSD-5.0.1+i386),           [cdplay(1)](http://netbsd.gw.com/cgi-bin/man-cgi?cdplay+1+NetBSD-5.0.1+i386),
         [`audio/xmcd`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/xmcd/README.html),           [`audio/xmcd`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/xmcd/README.html),
         "kscd" from the           "kscd" from the
         [`multimedia/kdemultimedia3`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/kdemultimedia3/README.html)           [`multimedia/kdemultimedia3`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/kdemultimedia3/README.html)
         package, mixer programs like           package, mixer programs like
         [mixerctl(1)](http://netbsd.gw.com/cgi-bin/man-cgi?mixerctl+1+NetBSD-5.0.1+i386),           [mixerctl(1)](http://netbsd.gw.com/cgi-bin/man-cgi?mixerctl+1+NetBSD-5.0.1+i386),
         [`audio/xmix`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/xmix/README.html),           [`audio/xmix`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/xmix/README.html),
         [`audio/xmmix`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/xmmix/README.html),           [`audio/xmmix`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/xmmix/README.html),
         the Curses based           the Curses based
         [`audio/cam`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/cam/README.html),           [`audio/cam`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/cam/README.html),
         or kmix, which is part of           or kmix, which is part of
         [`multimedia/kdemultimedia3`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/kdemultimedia3/README.html).          [`multimedia/kdemultimedia3`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/kdemultimedia3/README.html).
   
         This usually works well on both SCSI and IDE (ATAPI) CDROMs, CDRW and DVD           This usually works well on both SCSI and IDE (ATAPI) CDROMs, CDRW and DVD
         drives.          drives.
   
  2. To read ("rip") audio tracks in binary form without going through    2. To read ("rip") audio tracks in binary form without going through
         digital-\>analog conversion and back. There are several programs available           digital-\>analog conversion and back. There are several programs available
         to do this:          to do this:
   
          * For most ATAPI, SCSI and several proprietary CDROM drives, the            * For most ATAPI, SCSI and several proprietary CDROM drives, the
            [`audio/cdparanoia`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/cdparanoia/README.html)              [`audio/cdparanoia`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/cdparanoia/README.html)
            package can be used. With cdparanoia the data can be saved to a file or              package can be used. With cdparanoia the data can be saved to a file or
            directed to standard output in WAV, AIFF, AIFF-C or raw format. Currently              directed to standard output in WAV, AIFF, AIFF-C or raw format. Currently
            the -g option is required by the NetBSD version of cdparanoia. A              the -g option is required by the NetBSD version of cdparanoia. A
            hypothetical example of how to save track 2 as a WAV file is as follows:             hypothetical example of how to save track 2 as a WAV file is as follows:
   
            $ cdparanoia -g /dev/rcd0d 2 track-02.wav             $ cdparanoia -g /dev/rcd0d 2 track-02.wav
Line 241  There are two ways to handle audio CDs: Line 241  There are two ways to handle audio CDs:
   
            $ cdparanoia -g /dev/rcd0d -B             $ cdparanoia -g /dev/rcd0d -B
   
          * For ATAPI or SCSI CD-ROMs the            * For ATAPI or SCSI CD-ROMs the
            [`audio/cdd`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/cdd/README.html)              [`audio/cdd`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/cdd/README.html)
            package can be used. To extract track 2 with cdd, type:             package can be used. To extract track 2 with cdd, type:
   
            # cdd -t 2 `pwd`             # cdd -t 2 `pwd`
   
        This will put a file called `track-02.cda` in the current directory.         This will put a file called `track-02.cda` in the current directory.
   
          * For SCSI CD-ROMS the            * For SCSI CD-ROMS the
            [`audio/tosha`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/tosha/README.html)              [`audio/tosha`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/tosha/README.html)
            package can be used. To extract track 2 with tosha, you should be able to              package can be used. To extract track 2 with tosha, you should be able to
            type:             type:
   
            # tosha -d CD-ROM-device -t 2 -o track-02.cda             # tosha -d CD-ROM-device -t 2 -o track-02.cda
   
         The data can then be post-processed e.g. by encoding it into MP3 streams           The data can then be post-processed e.g. by encoding it into MP3 streams
         (see [[Creating an MP3 (MPEG layer 3) file from an audio           (see [[Creating an MP3 (MPEG layer 3) file from an audio
         CD|guide/rmmedia#create-mpeg3]]) or by writing them to CD-Rs (see [[Using a           CD|guide/rmmedia#create-mpeg3]]) or by writing them to CD-Rs (see [[Using a
         CD-R writer to create audio CDs|guide/rmmedia#cdr-audio]]).          CD-R writer to create audio CDs|guide/rmmedia#cdr-audio]]).
   
 ## Creating an MP3 (MPEG layer 3) file from an audio CD  ## Creating an MP3 (MPEG layer 3) file from an audio CD
   
 The basic steps in creating an MPEG layer 3 (MP3) file from an audio CD (using   The basic steps in creating an MPEG layer 3 (MP3) file from an audio CD (using
 software from the [NetBSD packages   software from the [NetBSD packages
 collection](http://www.NetBSD.org/docs/pkgsrc/)) are:  collection](http://www.NetBSD.org/docs/pkgsrc/)) are:
   
  1. Extract (*rip*) the audio data of the CD as shown in   1. Extract (*rip*) the audio data of the CD as shown in
     [[Using audio CDs with NetBSD|guide/rmmedia#cdrom-audio]].      [[Using audio CDs with NetBSD|guide/rmmedia#cdrom-audio]].
   
  2. Convert the CD audio format file to WAV format. You only need to perform    2. Convert the CD audio format file to WAV format. You only need to perform
         this job if your ripping program (e.g. tosha, cdd) didn't already do the job           this job if your ripping program (e.g. tosha, cdd) didn't already do the job
         for you!          for you!
   
      * Using the [`audio/sox`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/sox/README.html) package, type:       * Using the [`audio/sox`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/sox/README.html) package, type:
   
            $ sox -s -w -c 2 -r 44100 -t cdr track-02.cda track-02.wav             $ sox -s -w -c 2 -r 44100 -t cdr track-02.cda track-02.wav
   
            This will convert `track-02.cda` in raw CD format to `track-02.wav` in              This will convert `track-02.cda` in raw CD format to `track-02.wav` in
            WAV format, using **s**igned 16-bit **w**ords with 2 **c**hannels at a              WAV format, using **s**igned 16-bit **w**ords with 2 **c**hannels at a
            sampling **r**ate of 44100kHz.             sampling **r**ate of 44100kHz.
   
  3. Encode the WAV file into MP3 format.   3. Encode the WAV file into MP3 format.
Line 288  collection](http://www.NetBSD.org/docs/p Line 288  collection](http://www.NetBSD.org/docs/p
   
            $ bladeenc -128 -QUIT track-02.wav             $ bladeenc -128 -QUIT track-02.wav
   
            This will encode `track-02.wav` into `track-02.mp3` in MP3 format, using              This will encode `track-02.wav` into `track-02.mp3` in MP3 format, using
            a bit rate if **128**kBit/sec. The documentation for bladeenc describes              a bit rate if **128**kBit/sec. The documentation for bladeenc describes
            bit-rates in more detail.             bit-rates in more detail.
   
          * Using the            * Using the
            [`audio/lame`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/lame/README.html)              [`audio/lame`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/lame/README.html)
            package, type:             package, type:
   
            $ lame -p -o -v -V 5 -h track-02.wav track-02.mp3             $ lame -p -o -v -V 5 -h track-02.wav track-02.mp3
   
            You may wish to use a lower quality, depending on your taste and              You may wish to use a lower quality, depending on your taste and
            hardware.             hardware.
   
 The resultant MP3 file can be played with any of the   The resultant MP3 file can be played with any of the
 [`audio/gqmpeg`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/gqmpeg/README.html),   [`audio/gqmpeg`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/gqmpeg/README.html),
 [`audio/maplay`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/maplay/README.html),   [`audio/maplay`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/maplay/README.html),
 [`audio/mpg123`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/mpg123/README.html)   [`audio/mpg123`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/mpg123/README.html)
 or   or
 [`audio/splay`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/splay/README.html)   [`audio/splay`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/splay/README.html)
 packages.  packages.
   
 ## Using a CD-R writer with data CDs  ## Using a CD-R writer with data CDs
   
 The process of writing a CD consists of two steps: First, a "image" of the data   The process of writing a CD consists of two steps: First, a "image" of the data
 must be generated, which can then be written to CD-R in a second step.  must be generated, which can then be written to CD-R in a second step.
   
  1. Reading an pre-existing ISO image   1. Reading an pre-existing ISO image
Line 322  must be generated, which can then be wri Line 322  must be generated, which can then be wri
   
  2. 2. 2.ating the ISO image   2. 2. 2.ating the ISO image
   
         Put all the data you want to put on CD into one directory. Next you need to           Put all the data you want to put on CD into one directory. Next you need to
         generate a disk-like ISO image of your data. The image stores the data in           generate a disk-like ISO image of your data. The image stores the data in
         the same form as they're later put on CD, using the ISO 9660 format. The           the same form as they're later put on CD, using the ISO 9660 format. The
         basic ISO9660 format only understands 8+3 filenames (max. eight letters for           basic ISO9660 format only understands 8+3 filenames (max. eight letters for
         filename, plus three more for an extension). As this is not practical for           filename, plus three more for an extension). As this is not practical for
         Unix filenames, a so-called "Rockridge Extension" needs to be employed to           Unix filenames, a so-called "Rockridge Extension" needs to be employed to
         get longer filenames. (A different set of such extension exists in the           get longer filenames. (A different set of such extension exists in the
         Microsoft world, to get their long filenames right; that's what's known as           Microsoft world, to get their long filenames right; that's what's known as
         Joliet filesystem).          Joliet filesystem).
   
         The ISO image is created using the mkisofs command, which is part of the           The ISO image is created using the mkisofs command, which is part of the
         [`sysutils/cdrtools`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/cdrtools/README.html)           [`sysutils/cdrtools`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/cdrtools/README.html)
         package.          package.
   
         Example: if you have your data in /usr/tmp/data, you can generate a ISO           Example: if you have your data in /usr/tmp/data, you can generate a ISO
         image file in /usr/tmp/data.iso with the following command:          image file in /usr/tmp/data.iso with the following command:
   
         $ cd /usr/tmp          $ cd /usr/tmp
Line 357  must be generated, which can then be wri Line 357  must be generated, which can then be wri
         Max brk space used 153c4          Max brk space used 153c4
         84625 extents written (165 Mb)          84625 extents written (165 Mb)
   
         Please see the mkisofs(8) man page for other options like noting publisher           Please see the mkisofs(8) man page for other options like noting publisher
         and preparer. The [Bootable CD ROM           and preparer. The [Bootable CD ROM
         How-To](http://www.NetBSD.org/docs/bootcd.html) explains how to generate a           How-To](http://www.NetBSD.org/docs/bootcd.html) explains how to generate a
         bootable CD.          bootable CD.
   
  3. Writing the ISO image to CD-R   3. Writing the ISO image to CD-R
   
         When you have the ISO image file, you just need to write it on a CD. This is           When you have the ISO image file, you just need to write it on a CD. This is
         done with the "cdrecord" command from the           done with the "cdrecord" command from the
         [`sysutils/cdrtools`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/cdrtools/README.html)           [`sysutils/cdrtools`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/cdrtools/README.html)
         package. Insert a blank CD-R, and off we go:          package. Insert a blank CD-R, and off we go:
   
         # cdrecord -v dev=/dev/rcd0d data.iso          # cdrecord -v dev=/dev/rcd0d data.iso
         ...          ...
   
         After starting the command, 'cdrecord' shows you a lot of information about           After starting the command, 'cdrecord' shows you a lot of information about
         your drive, the disk and the image you're about to write. It then does a 10           your drive, the disk and the image you're about to write. It then does a 10
         seconds countdown, which is your last chance to stop things - type \^C if           seconds countdown, which is your last chance to stop things - type \^C if
         you want to abort. If you don't abort, the process will write the whole           you want to abort. If you don't abort, the process will write the whole
         image to the CD and return with a shell prompt.          image to the CD and return with a shell prompt.
   
         Note that cdrecord(8) works on both SCSI and IDE (ATAPI) drives.          Note that cdrecord(8) works on both SCSI and IDE (ATAPI) drives.
   
  4. Test   4. Test
   
         Mount the just-written CD and test it as you would do with any "normal" CD,           Mount the just-written CD and test it as you would do with any "normal" CD,
         see [[Reading data CDs with NetBSD|guide/rmmedia#cdrom]].          see [[Reading data CDs with NetBSD|guide/rmmedia#cdrom]].
   
 ## Using a CD-R writer to create audio CDs  ## Using a CD-R writer to create audio CDs
   
 If you want to make a backup copy of one of your audio CDs, you can do so by   If you want to make a backup copy of one of your audio CDs, you can do so by
 extracting ("ripping") the audio tracks from the CD, and then writing them back   extracting ("ripping") the audio tracks from the CD, and then writing them back
 to a blank CD. Of course this also works fine if you only extract single tracks   to a blank CD. Of course this also works fine if you only extract single tracks
 from various CDs, creating your very own mix CD!  from various CDs, creating your very own mix CD!
   
 The steps involved are:  The steps involved are:
Line 398  The steps involved are: Line 398  The steps involved are:
     [[Using audio CDs with NetBSD|guide/rmmedia#cdrom-audio]]      [[Using audio CDs with NetBSD|guide/rmmedia#cdrom-audio]]
         to get a couple of .wav files.          to get a couple of .wav files.
   
  2. Write the .wav files using cdrecord command from the    2. Write the .wav files using cdrecord command from the
     [`sysutils/cdrtools`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/cdrtools/README.html)       [`sysutils/cdrtools`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/cdrtools/README.html)
     package:      package:
   
         # cdrecord -v dev=/dev/rcd0d -audio -pad *.wav          # cdrecord -v dev=/dev/rcd0d -audio -pad *.wav
   
 ## Creating an audio CD from MP3s  ## Creating an audio CD from MP3s
   
 If you have converted all your audio CDs to MP3 and now want to make a mixed CD   If you have converted all your audio CDs to MP3 and now want to make a mixed CD
 for your (e.g.) your car, you can do so by first converting the .mp3 files back   for your (e.g.) your car, you can do so by first converting the .mp3 files back
 to .wav format, then write them as a normal audio CD.  to .wav format, then write them as a normal audio CD.
   
 The steps involved here are:  The steps involved here are:
Line 416  The steps involved here are: Line 416  The steps involved here are:
   
         $ mpg123 -w foo.wav foo.mp3          $ mpg123 -w foo.wav foo.mp3
   
         Do this for all of the MP3 files that you want to have on your audio CD. The           Do this for all of the MP3 files that you want to have on your audio CD. The
         .wav filenames you use don't matter.          .wav filenames you use don't matter.
   
  2. Write the .wav files to CD as described under [[Using a CD-R writer to    2. Write the .wav files to CD as described under [[Using a CD-R writer to
     create audio CDs|guide/rmmedia#cdr-audio]].      create audio CDs|guide/rmmedia#cdr-audio]].
   
 ## Copying an audio CD  ## Copying an audio CD
   
 To copy an audio CD while not introducing any pauses as mandated by the CDDA   To copy an audio CD while not introducing any pauses as mandated by the CDDA
 standard, you can use cdrdao for that:  standard, you can use cdrdao for that:
   
     # cdrdao read-cd --device /dev/rcd0d data.toc      # cdrdao read-cd --device /dev/rcd0d data.toc
Line 432  standard, you can use cdrdao for that: Line 432  standard, you can use cdrdao for that:
   
 ## Copying a data CD with two drives  ## Copying a data CD with two drives
   
 If you have both a CD-R and a CD-ROM drive in your machine, you can copy a data   If you have both a CD-R and a CD-ROM drive in your machine, you can copy a data
 CD with the following command:  CD with the following command:
   
     # cdrecord dev=/dev/rcd1d /dev/rcd0d      # cdrecord dev=/dev/rcd1d /dev/rcd0d
   
 Here the CD-ROM (cd0) contains the CD you want to copy, and the CD-R (cd1)   Here the CD-ROM (cd0) contains the CD you want to copy, and the CD-R (cd1)
 contains the blank disk. Note that this only works with computer disks that   contains the blank disk. Note that this only works with computer disks that
 contain some sort of data, it does *not* work with audio CDs! In practice you'll   contain some sort of data, it does *not* work with audio CDs! In practice you'll
 also want to add something like `speed=8` to make things a bit faster.  also want to add something like `speed=8` to make things a bit faster.
   
 ## Using CD-RW rewritables  ## Using CD-RW rewritables
   
 You can treat a CD-RW drive like a CD-R drive (see [[Using a CD-R writer with   You can treat a CD-RW drive like a CD-R drive (see [[Using a CD-R writer with
 data CDs|guide/rmmedia#cdr]]) in NetBSD, creating images with mkisofs(8) and   data CDs|guide/rmmedia#cdr]]) in NetBSD, creating images with mkisofs(8) and
 writing them on a CD-RW medium with cdrecord(8).  writing them on a CD-RW medium with cdrecord(8).
   
 If you want to blank a CD-RW, you can do this with cdrecord's `blank` option:  If you want to blank a CD-RW, you can do this with cdrecord's `blank` option:
   
     # cdrecord dev=/dev/rcd0d blank=fast      # cdrecord dev=/dev/rcd0d blank=fast
   
 There are several other ways to blank the CD-RW, call cdrecord(8) with   There are several other ways to blank the CD-RW, call cdrecord(8) with
 `blank=help` for a list. See the cdrecord(8) man page for more information.  `blank=help` for a list. See the cdrecord(8) man page for more information.
   
 ## DVD support  ## DVD support
   
 Currently, NetBSD supports DVD media through the ISO 9660 also used for CD-ROMs.   Currently, NetBSD supports DVD media through the ISO 9660 also used for CD-ROMs.
 The new UDF filesystem also present on DVDs has been supported since NetBSD 4.0.   The new UDF filesystem also present on DVDs has been supported since NetBSD 4.0.
 Information about mounting ISO 9660 and UDF filesystems can be found in the   Information about mounting ISO 9660 and UDF filesystems can be found in the
 [mount\_cd9660(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mount_cd9660+8+NetBSD-5.0.1+i386)   [mount\_cd9660(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mount_cd9660+8+NetBSD-5.0.1+i386)
 and   and
 [mount\_udf(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mount_udf+8+NetBSD-5.0.1+i386)   [mount\_udf(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mount_udf+8+NetBSD-5.0.1+i386)
 manual pages respectively. DVDs, DivX and many avi files be played with   manual pages respectively. DVDs, DivX and many avi files be played with
 [`multimedia/ogle`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/ogle/README.html)   [`multimedia/ogle`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/ogle/README.html)
 or   or
 [`multimedia/gmplayer`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/gmplayer/README.html).  [`multimedia/gmplayer`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/gmplayer/README.html).
   
 For some hints on creating DVDs, see this [postings about   For some hints on creating DVDs, see this [postings about
 growisofs](http://mail-index.NetBSD.org/current-users/2004/01/06/0021.html) and   growisofs](http://mail-index.NetBSD.org/current-users/2004/01/06/0021.html) and
 [this article about recording CDs and DVDs with   [this article about recording CDs and DVDs with
 NetBSD](http://www.mreriksson.net/blog/archive/15/).  NetBSD](http://www.mreriksson.net/blog/archive/15/).
   
 ## Creating ISO images from a CD  ## Creating ISO images from a CD
Line 515  You can read the table of contents of an Line 515  You can read the table of contents of an
   
 ## Initializing and using floppy disks  ## Initializing and using floppy disks
   
 PC-style floppy disks work mostly like other disk devices like hard disks,   PC-style floppy disks work mostly like other disk devices like hard disks,
 except that you need to low-level format them first. To use an common 1440 KB   except that you need to low-level format them first. To use an common 1440 KB
 floppy in the first floppy drive, first (as root) format it:  floppy in the first floppy drive, first (as root) format it:
   
     # fdformat -f /dev/rfd0a      # fdformat -f /dev/rfd0a
   
 Then create a single partition on the disk using   Then create a single partition on the disk using
 [disklabel(8)](http://netbsd.gw.com/cgi-bin/man-cgi?disklabel+8+NetBSD-5.0.1+i386):  [disklabel(8)](http://netbsd.gw.com/cgi-bin/man-cgi?disklabel+8+NetBSD-5.0.1+i386):
   
     # disklabel -rw /dev/rfd0a floppy3      # disklabel -rw /dev/rfd0a floppy3
Line 530  Creating a small filesystem optimized fo Line 530  Creating a small filesystem optimized fo
   
     # newfs -m 0 -o space -i 16384 -c 80 /dev/rfd0a      # newfs -m 0 -o space -i 16384 -c 80 /dev/rfd0a
   
 Now the floppy disk can be mounted like any other disk. Or if you already have a   Now the floppy disk can be mounted like any other disk. Or if you already have a
 floppy disk with an MS-DOS filesystem on it that you just want to access from   floppy disk with an MS-DOS filesystem on it that you just want to access from
 NetBSD, you can just do something like this:  NetBSD, you can just do something like this:
   
     # mount -t msdos /dev/fd0a /mnt      # mount -t msdos /dev/fd0a /mnt
   
 However, rather than using floppies like normal (bigger) disks, it is often more   However, rather than using floppies like normal (bigger) disks, it is often more
 convenient to bypass the filesystem altogether and just splat an archive of   convenient to bypass the filesystem altogether and just splat an archive of
 files directly to the raw device. E.g.:  files directly to the raw device. E.g.:
   
     # tar cvfz /dev/rfd0a file1 file2 ...      # tar cvfz /dev/rfd0a file1 file2 ...
   
 A variation of this can also be done with MS-DOS floppies using the   A variation of this can also be done with MS-DOS floppies using the
 [`sysutils/mtools`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/mtools/README.html)   [`sysutils/mtools`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/mtools/README.html)
 package which has the benefit of not going through the kernel buffer cache and   package which has the benefit of not going through the kernel buffer cache and
 thus not being exposed to the danger of the floppy being removed while a   thus not being exposed to the danger of the floppy being removed while a
 filesystem is mounted on it.  filesystem is mounted on it.
   

Removed from v.1.1  
changed lines
  Added in v.1.2


CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb