Annotation of wikisrc/guide/rmmedia.mdwn, revision 1.1

1.1     ! jdf         1: # Using removable media
        !             2: 
        !             3: ## Reading data CDs with NetBSD
        !             4: 
        !             5: Data CDs can contain anything from programs, sound files (MP3, wav), movies 
        !             6: (MP3, QuickTime) to source code, text files, etc. Before accessing these files, 
        !             7: a CD must be mounted on a directory, much like hard disks are. Just as hard 
        !             8: disks can use different filesystems (ffs, lfs, ext2fs, ...), CDs have their own 
        !             9: filesystem, *cd9660*. The NetBSD cd9660 filesystem can handle filesystems 
        !            10: without and with Rockridge and Joliet extensions.
        !            11: 
        !            12: CD devices are named /dev/cd0a for both SCSI and IDE (ATAPI).
        !            13: 
        !            14: With this information, we can start:
        !            15: 
        !            16:  1. See if your system has some CD drive:
        !            17: 
        !            18:         # dmesg | grep ^cd
        !            19:              cd0 at atapibus0 drive 0: <CD-R/RW RW8040A, , 1.12> type 5 cdrom removable
        !            20:              cd0: 32-bit data port
        !            21:              cd0: drive supports PIO mode 4, DMA mode 0
        !            22:              cd0(pciide0:1:0): using PIO mode 0, DMA mode 0 (using DMA data transfers)
        !            23: 
        !            24:        We have one drive here, "cd0". It is an IDE/ATAPI drive, as it is found on 
        !            25:        atapibus0. Of course the drive (rather, its medium) is removable, i.e., you 
        !            26:        can eject it. See below.
        !            27: 
        !            28:  2. Insert a CD
        !            29: 
        !            30:  3. Mount the CD manually:
        !            31: 
        !            32:         # mount -t cd9660 /dev/cd0a /mnt
        !            33: 
        !            34:        This command shouldn't print anything. It instructs the system to mount the 
        !            35:        CD found on /dev/cd0a on /mnt, using the "cd9660" filesystem. The mountpoint 
        !            36:        "/mnt" must be an existing directory.
        !            37: 
        !            38:  4. Check the contents of the CD:
        !            39: 
        !            40:         # ls /mnt
        !            41:         INSTALL.html INSTALL.ps   TRANS.TBL    boot.catalog
        !            42:         INSTALL.more INSTALL.txt  binary       installation
        !            43: 
        !            44:     Everything looks fine! This is a NetBSD CD, of course. :)
        !            45: 
        !            46:  5. Unmount the CD:
        !            47: 
        !            48:         # umount /mnt
        !            49: 
        !            50:        If the CD is still accessed (e.g. some other shell's still "cd"'d into it), 
        !            51:        this will not work. If you shut down the system, the CD will be unmounted 
        !            52:        automatically for you, there's nothing to worry about there.
        !            53: 
        !            54:  6. Making an entry in /etc/fstab:
        !            55: 
        !            56:        If you don't want to type the full "mount" command each time, you can put 
        !            57:        most of the values into a line in /etc/fstab:
        !            58: 
        !            59:         # Device        mountpoint      filesystem  mount options
        !            60:         /dev/cd0a       /cdrom          cd9660      ro,noauto    
        !            61: 
        !            62:        Make sure that the mountpoint, `/cdrom` in our example, exists:
        !            63: 
        !            64:         # mkdir /cdrom
        !            65: 
        !            66:        Now you can mount the cd with the following command:
        !            67: 
        !            68:         # mount /cdrom
        !            69: 
        !            70:     Access and unmount as before.
        !            71: 
        !            72:        The CD is not mounted at boot time due to the "noauto" mount option - this 
        !            73:        is useful as you'll probably not have a CD in the drive all the time. See 
        !            74:        [mount(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mount+8+NetBSD-5.0.1+i386) 
        !            75:        and 
        !            76:        [mount\_cd9660(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mount_cd9660+8+NetBSD-5.0.1+i386) 
        !            77:        for some other useful options.
        !            78: 
        !            79: 7.  Eject the CD:
        !            80: 
        !            81:         # eject cd0
        !            82: 
        !            83:        If the CD is still mounted, it will be unmounted if possible, before being 
        !            84:        ejected.
        !            85: 
        !            86: ## Reading multi-session CDs with NetBSD
        !            87: 
        !            88: Use 
        !            89: [mscdlabel(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mscdlabel+8+NetBSD-5.0.1+i386) 
        !            90: to add all sessions to the CDs disklabel, and then use the appropriate device 
        !            91: node to mount the session you want. You might have to create the corresponding 
        !            92: device nodes in `/dev` manually. For example:
        !            93: 
        !            94:     # mscdlabel cd1
        !            95:     track (ctl=4) at sector 142312
        !            96:      adding as 'a'
        !            97:     track (ctl=4) at sector 0
        !            98:      adding as 'b'
        !            99:     # ls -l /dev/cd1b
        !           100:     ls: /dev/cd1b: No such file or directory
        !           101:     # cd /dev
        !           102:     # ls -l cd1*
        !           103:     brw-r-----  1 root  operator       6,  8 Mar 18 21:55 cd1a
        !           104:     brw-r-----  1 root  operator       6, 11 Mar 18 21:55 cd1d
        !           105:     # mknod cd1b b 6 9
        !           106: 
        !           107: to create `/dev/cd1b`. Make sure you fix the permissions of any new device nodes 
        !           108: you create:
        !           109: 
        !           110:     # ls -l cd1*
        !           111:     brw-r-----  1 root  operator       6,  8 Mar 18 21:55 cd1a
        !           112:     brw-r--r--  1 root  wheel          6,  9 Mar 18 22:23 cd1b
        !           113:     brw-r-----  1 root  operator       6, 11 Mar 18 21:55 cd1d
        !           114:     # chgrp operator cd1b
        !           115:     # chmod 640 cd1b
        !           116:     # ls -l cd1* 
        !           117:     brw-r-----  1 root  operator       6,  8 Mar 18 21:55 cd1a
        !           118:     brw-r-----  1 root  operator       6,  9 Mar 18 22:24 cd1b
        !           119:     brw-r-----  1 root  operator       6, 11 Mar 18 21:55 cd1d
        !           120: 
        !           121: Now you should be able to mount it.
        !           122: 
        !           123:     # mount /dev/cd1b /mnt
        !           124: 
        !           125: ## Allowing normal users to access CDs
        !           126: 
        !           127: By default, NetBSD only allows "root" to mount a filesystem. If you want any 
        !           128: user to be able to do this, perform the following steps:
        !           129: 
        !           130:  * Give groups and other the access rights to the device.
        !           131: 
        !           132:         # chmod go+rw /dev/cd0a
        !           133: 
        !           134:  * Ask NetBSD to let users mounting filesystems.
        !           135: 
        !           136:         # sysctl -w vfs.generic.usermount=1
        !           137: 
        !           138:        Note that this works for any filesystem and device, not only for CDs with a 
        !           139:        ISO 9660 filesystem.
        !           140: 
        !           141: To perform the mount operation after these commands, the user must own the mount 
        !           142: point. So, for example:
        !           143: 
        !           144:     $ cd $HOME
        !           145:     $ mkdir cdrom
        !           146:     $ mount -t cd9660 -o nodev,nosuid /dev/cd0a `pwd`/cdrom
        !           147: 
        !           148: *Note*: The mount options `nodev` and `nosuid` are mandatory from NetBSD 4.0 on. 
        !           149: They are not necessary on NetBSD 3.x systems.
        !           150: 
        !           151: Please also see 
        !           152: [mount(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mount+8+NetBSD-5.0.1+i386) and 
        !           153: as an alternative the *auto mount daemon* 
        !           154: [amd(8)](http://netbsd.gw.com/cgi-bin/man-cgi?amd+8+NetBSD-5.0.1+i386), for 
        !           155: which example config files can be found in `/usr/share/examples/amd`.
        !           156: 
        !           157: ## Mounting an ISO image
        !           158: 
        !           159: Sometimes, it is interesting to mount an ISO9660 image file before you burn the 
        !           160: CD; this way, you can examine its contents or even copy files to the outside. If 
        !           161: you are a Linux user, you should know that this is done with the special *loop* 
        !           162: filesystem. NetBSD does it another way, using the *vnode* pseudo-disk.
        !           163: 
        !           164: We will illustrate how to do this with an example. Suppose you have an ISO image 
        !           165: in your home directory, called `mycd.iso`:
        !           166: 
        !           167:  1. Start by setting up a new vnode, "pointing" to the ISO file:
        !           168: 
        !           169:         # vnconfig -c vnd0 ~/mycd.iso
        !           170: 
        !           171:  2. Now, mount the vnode:
        !           172: 
        !           173:         # mount -t cd9660 /dev/vnd0a /mnt
        !           174: 
        !           175:  3. Yeah, image contents appear under `/mnt`! Go to that directory and explore 
        !           176:     the image.
        !           177: 
        !           178:  4. When you are happy, you have to umount the image:
        !           179: 
        !           180:         # umount /mnt
        !           181: 
        !           182:  5. And at last, deconfigure the vnode:
        !           183: 
        !           184:         # vnconfig -u vnd0
        !           185: 
        !           186: Note that these steps can also be used for any kind of file that contains a 
        !           187: filesystem, not just ISO images.
        !           188: 
        !           189: See the [vnd(4)](http://netbsd.gw.com/cgi-bin/man-cgi?vnd+4+NetBSD-5.0.1+i386) 
        !           190: and 
        !           191: [vnconfig(8)](http://netbsd.gw.com/cgi-bin/man-cgi?vnconfig+8+NetBSD-5.0.1+i386) 
        !           192: man pages for more information.
        !           193: 
        !           194: ## Using video CDs with NetBSD
        !           195: 
        !           196: To play MPEG Video streams as many DVD players can play them under NetBSD, mount 
        !           197: the CD as you would do with any normal (data) CD (see [[Reading data CDs with 
        !           198: NetBSD|guide/rmmedia#cdrom]]), then use the 
        !           199: [`multimedia/xine-ui`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/xine-ui/README.html), 
        !           200: [`multimedia/mplayer`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/mplayer/README.html) 
        !           201: or 
        !           202: [`multimedia/gmplayer`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/gmplayer/README.html) 
        !           203: package to play the mpeg files stored on the CD.
        !           204: 
        !           205: ## Using audio CDs with NetBSD
        !           206: 
        !           207: There are two ways to handle audio CDs:
        !           208: 
        !           209:  1. Tell the CD drive to play to the headphone or to a soundcard, to which 
        !           210:        CDROMs are usually connected internally. Use programs like 
        !           211:        [cdplay(1)](http://netbsd.gw.com/cgi-bin/man-cgi?cdplay+1+NetBSD-5.0.1+i386), 
        !           212:        [`audio/xmcd`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/xmcd/README.html), 
        !           213:        "kscd" from the 
        !           214:        [`multimedia/kdemultimedia3`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/kdemultimedia3/README.html) 
        !           215:        package, mixer programs like 
        !           216:        [mixerctl(1)](http://netbsd.gw.com/cgi-bin/man-cgi?mixerctl+1+NetBSD-5.0.1+i386), 
        !           217:        [`audio/xmix`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/xmix/README.html), 
        !           218:        [`audio/xmmix`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/xmmix/README.html), 
        !           219:        the Curses based 
        !           220:        [`audio/cam`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/cam/README.html), 
        !           221:        or kmix, which is part of 
        !           222:        [`multimedia/kdemultimedia3`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/kdemultimedia3/README.html).
        !           223: 
        !           224:        This usually works well on both SCSI and IDE (ATAPI) CDROMs, CDRW and DVD 
        !           225:        drives.
        !           226: 
        !           227:  2. To read ("rip") audio tracks in binary form without going through 
        !           228:        digital-\>analog conversion and back. There are several programs available 
        !           229:        to do this:
        !           230: 
        !           231:         * For most ATAPI, SCSI and several proprietary CDROM drives, the 
        !           232:           [`audio/cdparanoia`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/cdparanoia/README.html) 
        !           233:           package can be used. With cdparanoia the data can be saved to a file or 
        !           234:           directed to standard output in WAV, AIFF, AIFF-C or raw format. Currently 
        !           235:           the -g option is required by the NetBSD version of cdparanoia. A 
        !           236:           hypothetical example of how to save track 2 as a WAV file is as follows:
        !           237: 
        !           238:            $ cdparanoia -g /dev/rcd0d 2 track-02.wav
        !           239: 
        !           240:        If you want to grab all files from a CD, cdparanoia's batch mode is useful:
        !           241: 
        !           242:            $ cdparanoia -g /dev/rcd0d -B
        !           243: 
        !           244:         * For ATAPI or SCSI CD-ROMs the 
        !           245:           [`audio/cdd`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/cdd/README.html) 
        !           246:           package can be used. To extract track 2 with cdd, type:
        !           247: 
        !           248:            # cdd -t 2 `pwd`
        !           249: 
        !           250:        This will put a file called `track-02.cda` in the current directory.
        !           251: 
        !           252:         * For SCSI CD-ROMS the 
        !           253:           [`audio/tosha`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/tosha/README.html) 
        !           254:           package can be used. To extract track 2 with tosha, you should be able to 
        !           255:           type:
        !           256: 
        !           257:            # tosha -d CD-ROM-device -t 2 -o track-02.cda
        !           258: 
        !           259:        The data can then be post-processed e.g. by encoding it into MP3 streams 
        !           260:        (see [[Creating an MP3 (MPEG layer 3) file from an audio 
        !           261:        CD|guide/rmmedia#create-mpeg3]]) or by writing them to CD-Rs (see [[Using a 
        !           262:        CD-R writer to create audio CDs|guide/rmmedia#cdr-audio]]).
        !           263: 
        !           264: ## Creating an MP3 (MPEG layer 3) file from an audio CD
        !           265: 
        !           266: The basic steps in creating an MPEG layer 3 (MP3) file from an audio CD (using 
        !           267: software from the [NetBSD packages 
        !           268: collection](http://www.NetBSD.org/docs/pkgsrc/)) are:
        !           269: 
        !           270:  1. Extract (*rip*) the audio data of the CD as shown in
        !           271:     [[Using audio CDs with NetBSD|guide/rmmedia#cdrom-audio]].
        !           272: 
        !           273:  2. Convert the CD audio format file to WAV format. You only need to perform 
        !           274:        this job if your ripping program (e.g. tosha, cdd) didn't already do the job 
        !           275:        for you!
        !           276: 
        !           277:      * Using the [`audio/sox`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/sox/README.html) package, type:
        !           278: 
        !           279:            $ sox -s -w -c 2 -r 44100 -t cdr track-02.cda track-02.wav
        !           280: 
        !           281:           This will convert `track-02.cda` in raw CD format to `track-02.wav` in 
        !           282:           WAV format, using **s**igned 16-bit **w**ords with 2 **c**hannels at a 
        !           283:           sampling **r**ate of 44100kHz.
        !           284: 
        !           285:  3. Encode the WAV file into MP3 format.
        !           286: 
        !           287:      * Using the [`audio/bladeenc`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/bladeenc/README.html) package, type:
        !           288: 
        !           289:            $ bladeenc -128 -QUIT track-02.wav
        !           290: 
        !           291:           This will encode `track-02.wav` into `track-02.mp3` in MP3 format, using 
        !           292:           a bit rate if **128**kBit/sec. The documentation for bladeenc describes 
        !           293:           bit-rates in more detail.
        !           294: 
        !           295:         * Using the 
        !           296:           [`audio/lame`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/lame/README.html) 
        !           297:           package, type:
        !           298: 
        !           299:            $ lame -p -o -v -V 5 -h track-02.wav track-02.mp3
        !           300: 
        !           301:           You may wish to use a lower quality, depending on your taste and 
        !           302:           hardware.
        !           303: 
        !           304: The resultant MP3 file can be played with any of the 
        !           305: [`audio/gqmpeg`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/gqmpeg/README.html), 
        !           306: [`audio/maplay`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/maplay/README.html), 
        !           307: [`audio/mpg123`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/mpg123/README.html) 
        !           308: or 
        !           309: [`audio/splay`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/audio/splay/README.html) 
        !           310: packages.
        !           311: 
        !           312: ## Using a CD-R writer with data CDs
        !           313: 
        !           314: The process of writing a CD consists of two steps: First, a "image" of the data 
        !           315: must be generated, which can then be written to CD-R in a second step.
        !           316: 
        !           317:  1. Reading an pre-existing ISO image
        !           318: 
        !           319:         # dd if=/dev/rcd0a of=filename.iso bs=2k
        !           320: 
        !           321:     Alternatively, you can create a new ISO image yourself:
        !           322: 
        !           323:  2. 2. 2.ating the ISO image
        !           324: 
        !           325:        Put all the data you want to put on CD into one directory. Next you need to 
        !           326:        generate a disk-like ISO image of your data. The image stores the data in 
        !           327:        the same form as they're later put on CD, using the ISO 9660 format. The 
        !           328:        basic ISO9660 format only understands 8+3 filenames (max. eight letters for 
        !           329:        filename, plus three more for an extension). As this is not practical for 
        !           330:        Unix filenames, a so-called "Rockridge Extension" needs to be employed to 
        !           331:        get longer filenames. (A different set of such extension exists in the 
        !           332:        Microsoft world, to get their long filenames right; that's what's known as 
        !           333:        Joliet filesystem).
        !           334: 
        !           335:        The ISO image is created using the mkisofs command, which is part of the 
        !           336:        [`sysutils/cdrtools`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/cdrtools/README.html) 
        !           337:        package.
        !           338: 
        !           339:        Example: if you have your data in /usr/tmp/data, you can generate a ISO 
        !           340:        image file in /usr/tmp/data.iso with the following command:
        !           341: 
        !           342:         $ cd /usr/tmp
        !           343:         $ mkisofs -o data.iso -r data
        !           344:         Using NETBS000.GZ;1 for  data/binary/kernel/netbsd.INSTALL.gz (netbsd.INSTALL_TINY.gz)
        !           345:         Using NETBS001.GZ;1 for  data/binary/kernel/netbsd.GENERIC.gz (netbsd.GENERIC_TINY.gz)
        !           346:           5.92% done, estimate finish Wed Sep 13 21:28:11 2000
        !           347:          11.83% done, estimate finish Wed Sep 13 21:28:03 2000
        !           348:          17.74% done, estimate finish Wed Sep 13 21:28:00 2000
        !           349:          23.64% done, estimate finish Wed Sep 13 21:28:03 2000
        !           350:          ...
        !           351:          88.64% done, estimate finish Wed Sep 13 21:27:55 2000
        !           352:          94.53% done, estimate finish Wed Sep 13 21:27:55 2000
        !           353:         Total translation table size: 0
        !           354:         Total rockridge attributes bytes: 5395
        !           355:         Total directory bytes: 16384
        !           356:         Path table size(bytes): 110
        !           357:         Max brk space used 153c4
        !           358:         84625 extents written (165 Mb)
        !           359: 
        !           360:        Please see the mkisofs(8) man page for other options like noting publisher 
        !           361:        and preparer. The [Bootable CD ROM 
        !           362:        How-To](http://www.NetBSD.org/docs/bootcd.html) explains how to generate a 
        !           363:        bootable CD.
        !           364: 
        !           365:  3. Writing the ISO image to CD-R
        !           366: 
        !           367:        When you have the ISO image file, you just need to write it on a CD. This is 
        !           368:        done with the "cdrecord" command from the 
        !           369:        [`sysutils/cdrtools`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/cdrtools/README.html) 
        !           370:        package. Insert a blank CD-R, and off we go:
        !           371: 
        !           372:         # cdrecord -v dev=/dev/rcd0d data.iso
        !           373:         ...
        !           374: 
        !           375:        After starting the command, 'cdrecord' shows you a lot of information about 
        !           376:        your drive, the disk and the image you're about to write. It then does a 10 
        !           377:        seconds countdown, which is your last chance to stop things - type \^C if 
        !           378:        you want to abort. If you don't abort, the process will write the whole 
        !           379:        image to the CD and return with a shell prompt.
        !           380: 
        !           381:        Note that cdrecord(8) works on both SCSI and IDE (ATAPI) drives.
        !           382: 
        !           383:  4. Test
        !           384: 
        !           385:        Mount the just-written CD and test it as you would do with any "normal" CD, 
        !           386:        see [[Reading data CDs with NetBSD|guide/rmmedia#cdrom]].
        !           387: 
        !           388: ## Using a CD-R writer to create audio CDs
        !           389: 
        !           390: If you want to make a backup copy of one of your audio CDs, you can do so by 
        !           391: extracting ("ripping") the audio tracks from the CD, and then writing them back 
        !           392: to a blank CD. Of course this also works fine if you only extract single tracks 
        !           393: from various CDs, creating your very own mix CD!
        !           394: 
        !           395: The steps involved are:
        !           396: 
        !           397:  1. Extract ("rip") the audio tracks as described as in
        !           398:     [[Using audio CDs with NetBSD|guide/rmmedia#cdrom-audio]]
        !           399:        to get a couple of .wav files.
        !           400: 
        !           401:  2. Write the .wav files using cdrecord command from the 
        !           402:     [`sysutils/cdrtools`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/cdrtools/README.html) 
        !           403:     package:
        !           404: 
        !           405:         # cdrecord -v dev=/dev/rcd0d -audio -pad *.wav
        !           406: 
        !           407: ## Creating an audio CD from MP3s
        !           408: 
        !           409: If you have converted all your audio CDs to MP3 and now want to make a mixed CD 
        !           410: for your (e.g.) your car, you can do so by first converting the .mp3 files back 
        !           411: to .wav format, then write them as a normal audio CD.
        !           412: 
        !           413: The steps involved here are:
        !           414: 
        !           415:  1. Create .wav files from your .mp3 files:
        !           416: 
        !           417:         $ mpg123 -w foo.wav foo.mp3
        !           418: 
        !           419:        Do this for all of the MP3 files that you want to have on your audio CD. The 
        !           420:        .wav filenames you use don't matter.
        !           421: 
        !           422:  2. Write the .wav files to CD as described under [[Using a CD-R writer to 
        !           423:     create audio CDs|guide/rmmedia#cdr-audio]].
        !           424: 
        !           425: ## Copying an audio CD
        !           426: 
        !           427: To copy an audio CD while not introducing any pauses as mandated by the CDDA 
        !           428: standard, you can use cdrdao for that:
        !           429: 
        !           430:     # cdrdao read-cd --device /dev/rcd0d data.toc
        !           431:     # cdrdao write   --device /dev/rcd1d data.toc
        !           432: 
        !           433: ## Copying a data CD with two drives
        !           434: 
        !           435: If you have both a CD-R and a CD-ROM drive in your machine, you can copy a data 
        !           436: CD with the following command:
        !           437: 
        !           438:     # cdrecord dev=/dev/rcd1d /dev/rcd0d
        !           439: 
        !           440: Here the CD-ROM (cd0) contains the CD you want to copy, and the CD-R (cd1) 
        !           441: contains the blank disk. Note that this only works with computer disks that 
        !           442: contain some sort of data, it does *not* work with audio CDs! In practice you'll 
        !           443: also want to add something like `speed=8` to make things a bit faster.
        !           444: 
        !           445: ## Using CD-RW rewritables
        !           446: 
        !           447: You can treat a CD-RW drive like a CD-R drive (see [[Using a CD-R writer with 
        !           448: data CDs|guide/rmmedia#cdr]]) in NetBSD, creating images with mkisofs(8) and 
        !           449: writing them on a CD-RW medium with cdrecord(8).
        !           450: 
        !           451: If you want to blank a CD-RW, you can do this with cdrecord's `blank` option:
        !           452: 
        !           453:     # cdrecord dev=/dev/rcd0d blank=fast
        !           454: 
        !           455: There are several other ways to blank the CD-RW, call cdrecord(8) with 
        !           456: `blank=help` for a list. See the cdrecord(8) man page for more information.
        !           457: 
        !           458: ## DVD support
        !           459: 
        !           460: Currently, NetBSD supports DVD media through the ISO 9660 also used for CD-ROMs. 
        !           461: The new UDF filesystem also present on DVDs has been supported since NetBSD 4.0. 
        !           462: Information about mounting ISO 9660 and UDF filesystems can be found in the 
        !           463: [mount\_cd9660(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mount_cd9660+8+NetBSD-5.0.1+i386) 
        !           464: and 
        !           465: [mount\_udf(8)](http://netbsd.gw.com/cgi-bin/man-cgi?mount_udf+8+NetBSD-5.0.1+i386) 
        !           466: manual pages respectively. DVDs, DivX and many avi files be played with 
        !           467: [`multimedia/ogle`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/ogle/README.html) 
        !           468: or 
        !           469: [`multimedia/gmplayer`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/multimedia/gmplayer/README.html).
        !           470: 
        !           471: For some hints on creating DVDs, see this [postings about 
        !           472: growisofs](http://mail-index.NetBSD.org/current-users/2004/01/06/0021.html) and 
        !           473: [this article about recording CDs and DVDs with 
        !           474: NetBSD](http://www.mreriksson.net/blog/archive/15/).
        !           475: 
        !           476: ## Creating ISO images from a CD
        !           477: 
        !           478: To create an ISO image and save the checksum do this:
        !           479: 
        !           480:     # readcd dev=/dev/cd0d f=/tmp/cd.iso
        !           481: 
        !           482: Here is an alternative using dd(1):
        !           483: 
        !           484:     # dd if=/dev/cd0d of=/tmp/cd.iso bs=2048
        !           485: 
        !           486: If the CD has errors you can recover the rest with this:
        !           487: 
        !           488:     # dd if=/dev/cd0d of=/tmp/cd.iso bs=2048 conv=noerror
        !           489: 
        !           490: To create an ISO image from a mounted data CD first, mount the CD disk by:
        !           491: 
        !           492:     # mount -t cd9660 -r /dev/cd0d /mnt/cdrom
        !           493: 
        !           494: Second, get the image:
        !           495: 
        !           496:     # mkhybrid -v -l -J -R -o /tmp/my_cd.iso /mnt/cdrom/
        !           497: 
        !           498: ## Getting volume information from CDs and ISO images
        !           499: 
        !           500: You can read the volume data from an unmounted CD with this command:
        !           501: 
        !           502:     # file -s /dev/cd0d
        !           503: 
        !           504: You can read the volume data from an ISO image with this command:
        !           505: 
        !           506:     # isoinfo -d -i /tmp/my_cd.iso
        !           507: 
        !           508: You can get the unique disk number from an unmounted CD with this:
        !           509: 
        !           510:     # cd-discid /dev/cd0d
        !           511: 
        !           512: You can read the table of contents of an unmounted CD with this command:
        !           513: 
        !           514:     # cdrecord -v dev=/dev/cd0d -toc
        !           515: 
        !           516: ## Initializing and using floppy disks
        !           517: 
        !           518: PC-style floppy disks work mostly like other disk devices like hard disks, 
        !           519: except that you need to low-level format them first. To use an common 1440 KB 
        !           520: floppy in the first floppy drive, first (as root) format it:
        !           521: 
        !           522:     # fdformat -f /dev/rfd0a
        !           523: 
        !           524: Then create a single partition on the disk using 
        !           525: [disklabel(8)](http://netbsd.gw.com/cgi-bin/man-cgi?disklabel+8+NetBSD-5.0.1+i386):
        !           526: 
        !           527:     # disklabel -rw /dev/rfd0a floppy3
        !           528: 
        !           529: Creating a small filesystem optimized for space:
        !           530: 
        !           531:     # newfs -m 0 -o space -i 16384 -c 80 /dev/rfd0a
        !           532: 
        !           533: Now the floppy disk can be mounted like any other disk. Or if you already have a 
        !           534: floppy disk with an MS-DOS filesystem on it that you just want to access from 
        !           535: NetBSD, you can just do something like this:
        !           536: 
        !           537:     # mount -t msdos /dev/fd0a /mnt
        !           538: 
        !           539: However, rather than using floppies like normal (bigger) disks, it is often more 
        !           540: convenient to bypass the filesystem altogether and just splat an archive of 
        !           541: files directly to the raw device. E.g.:
        !           542: 
        !           543:     # tar cvfz /dev/rfd0a file1 file2 ...
        !           544: 
        !           545: A variation of this can also be done with MS-DOS floppies using the 
        !           546: [`sysutils/mtools`](http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/sysutils/mtools/README.html) 
        !           547: package which has the benefit of not going through the kernel buffer cache and 
        !           548: thus not being exposed to the danger of the floppy being removed while a 
        !           549: filesystem is mounted on it.
        !           550: 

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