BUL CD Tips

Questions or suggestions about this page should be sent to mspisar@flip.eecs.umich.edu

Question Index:

Q: How do I read from a CD?
A: Mount the cdrom drive and cd to it
% cdmount 1
% cd /cdrom
Note that some machines can have more than one CD reader. In that case, use a 1 or a 2 depending on the CD drive of interest. For machines with a single CD reader, "cdmount 1" and "cdmount" are equivalent.

Q: How do I remove a CD?
A: Unmount the cdrom drive and then press the eject button.

% cdumount 1
Make sure that you are no longer in the /cdrom directory or you will get a message saying the the cdrom is busy.
Note that some machines can have more than one CD reader. In that case, use a 1 or a 2 depending on the CD drive of interest. For machines with a single CD reader, "cdumount 1" and "cdumount" are equivalent.

Q: How do see a list of which CD-ROM drives are being used, and which are available?
A: The command "cdtable" (in /usr/coolstuff/bin) will display a list of CD-ROM drives available, and list the user names, dates, and volume names for CD-ROMs which are currently mounted. The table may also be viewed using the command "cat /n/oe800/u/cdtable/*".

Q: How do I create a CD?

  1. Create an index file (optional)
  2. Create a checksum file (optional)
  3. Create the CD-ROM image...
  4. Verify the data
  5. Burn the CD
  6. Verify the CD
  7. Remove your temporary files

Create an index (optional)

The index file is useful for getting full file names when using DOS, because under DOS only the first 8 characters of the file name and the first 3 characters of the extension will be visible.
% cd src_dir
% find . -print > index.txt

Create a checksum (optional)

The checksum file is useful for verifying that the data on the CD has not been corrupted during transfers.
% cd src_dir
% find . -type f -exec md5sum {} \; | sort +2 > MD5SUMS

Lock the precd partition (optional)

To prevent others from overwriting your data before you have a chance to write the CD-ROM, it is advisable to lock the /dev/precd partition for your exclusive use. Once the partition is locked, it will remain locked for up to 10 hours or until you unlock it (using unlock_precd).
% lock_precd
If someone else has the partition locked, you will get an access denied message. Note: this command resides in /usr/local/bin on bulp3427.

Create the CD image ...

Q: How do I create a CD image using Gear
A: This is done using the following steps:

  1. Setup GEAR
    If you do not have a .gearrc file in your home directory, create one. A good place to start is:
    % cp /n/colt45/usr/gear/.gearrc ~
    Make sure to set the GEARDIR environmental variable:
    % setenv GEARDIR ~
  2. Go to a /tmp directory
    Telnet to a machine with a lots of empty space in the /tmp directory ( you can check space using the "df" command ). Some machines to check are blatz, mickeys and keystone.
    Make a subdirectory with your username and cd to it, i.e.,
    % mkdir /tmp/your_username
    % cd /tmp/your_username
  3. Run Gear program
    % msgen
    This should return the following, and you want to continue
    ERROR: No CD-Recording units found.
    QUESTION: Do you want to continue anyway? Y/N (N) Y
  4. Edit preferences (optional, but probably want to check)
    CD> editprefs
    Use defaults if you have proper .gearrc
    Only really important one is:
    Please enter non-ISO9660 name handling level:
    1 = Ignore non-ISO9660 names
    2 = Translate non-ISO9660 names to upper case only
    ...
    4 = Translate completely to A-Z, 0-9, '_' and length 8+3.
    5 = Rockridge (with complete translation to A-Z, 0-9, '_' and length 8+3).
    Choosing option 1 will create a CD which contains up to 32-character long file names. Such a CD will operate fine in Unix and Windows95 as long as no file names exist which are longer than 32 characters. However, in DOS (using mscdex.exe) only the first 8 characters of the file name will be visible, which may make some files inaccessible.
    Choosing option 4 will use DOS names exclusively, and will work everywhere. However if you have names longer than 8.3 characters, the file names will be mangled.
    Choosing option 5 uses both Unix and DOS filenames, so under DOS/Windows95 the names will be mangled, but under Unix the full file names will be available. This option also stores the file permissions and user IDs, so be sure to make all of the files world readable, else you may end up with files only a superuser can access.
  5. Setup writing (optional, but probably want to check)
    CD> setup
    QUESTION: Use physical image file(s)? Y/N (N) N
    QUESTION: Enable recording of disc? Y/N (N) N
    (Y here will burn the CD)
    Write method (1 = disc at once, 2 = track at once, 3 = fixed packets):
    (1 <= value <= 3)(2) 2
    Number of copies to write? (1 <= value <= 1000)(1) 1
    Recording speed (x real-time)? (1 <= value <= 6)(4) 4
    QUESTION: Enable multi-session writing? Y/N (Y) Y
    QUESTION: Do you want to save this setup in the .gearrc file? Y/N (Y) Y
  6. Create the volume
    If the CD blank is a 550MB blank, the volume capacity should be 63 minutes; use 74 minutes for 650MB blanks.
    VOLNAME below is the name you want to give to the CD volume
    CD> newvol
    Please enter name of volume to create: VOLNAME
    Please enter volume capacity as 18, 63, 74 or 80 minutes: (74) 63
    Volume VOLNAME created.
    Please enter type of track to create as ISO, XA or DA : (ISO) iso
  7. Select volume (if necessary)
    You may have to do this step if you have more than 1 volume in the directory that you've already created, and you want to select a different one
    CD> selvol
    Please enter name of volume to select: VOLNAME
    Volume VOLNAME selected.
    Please enter number of track to select: (1 <= value <= 99)(1) 1
    Track 1 selected.
  8. Copy files into image
    Use either
    CD> cp -r src_dir
    which copies files IN src_dir into current directory of image, OR,
    CD> cp -r src_dir .
    which copies src_dir (including the directory name) into the current directory.
    **IMPORTANT**
    When using file format type (5) from editprefs (Rockridge and DOS), the cp -r src_dir . form seems to substitute _____AAA for src_dir if that is your root directory, so even if src_dir is 8.3, it will NOT show up correctly when using DIR in DOS. However, the other form of cp -r seems to work fine (cp -r src_dir), and all the directories beneath src_dir show up just fine in your root image directory when using DIR (only, of course, the ones which are <= 8.3 in length). You can do a DIR in gear from the root directory to test this.
  9. Show images (optional)
    CD> vdir
  10. Create physical volume
    CD> physvol
    This can take a long time.
    The physical volume is an iso9660 format 'partition' that will be dumped to the CD. This is the huge file with the name VOLNAME.p01
  11. Verify the volume (if desired)
  12. Exit GEAR
    CD> exit
  13. FTP the VOLNAME.p01 file to drive /d on bulp3427
    The machine bulp3427 is the PC with the CDR burner.
    You may want to create a subdirectory on drive /d using your username so it is easier to find your files (and others to see who is using file space or the CDR recorder).
    FTP seems to be the way which has the least errors in transferring.
    Note that bulp3427 has to be in Linux (not Windows95 or DOS) mode to ftp into it.
    Remember to transfer as binary.
  14. Create the partition using the saverawcd program/script After logging into bulp3427 (locally or remotely) run the saverawcd command as a background job. Again note that the machine must be in Linux mode.
    % (cat /d/your_username/VOLNAME.p01 | /home/cdr/saverawcd) &
Q: How do I create a CD image using mkisofs
A: This is done using the following steps:
  1. Setup mkisofs (optional)
    To set up the mkisofs program, create a file called .mkisofs in your home directory containing the following fields. Not all fields must be present. Some have default value, others default to blank, and others (most importantly, the volume identifier) may be specified on the command line.

    The application name, preparer name, publisher name, and other settings in the .mkisofsrc file are just comment fields in the CDROM header, and really have little value. It is best to include a full description in a description.txt file in the root directory of the CDROM.

    APPI
    The application identifier should describe the application that will be on the disc. There is space on the disc for 128 characters of information. May be overridden using the -A command line option.
    COPY
    The copyright information, often the name of a file on the disc containing the copyright notice. There is space in the disc for 37 characters of information.
    ABST
    The abstract information, often the name of a file on the disc containing an abstract. There is space in the disc for 37 characters of information.
    BIBL
    The bibliographic information, often the name of a file on the disc containing a bibliography. There is space in the disc for 37 characters of information.
    PREP
    This should describe the preparer of the CDROM, usually with a mailing address and phone number. There is space on the disc for 128 characters of information. May be overridden using the -p command line option.
    PUBL
    This should describe the publisher of the CDROM, usually with a mailing address and phone number. There is space on the disc for 128 characters of information. May be overridden using the -P command line option.
    SYSI
    The System Identifier. There is space on the disc for 32 characters of information.
    VOLI
    The Volume Identifier. There is space on the disc for 32 characters of information. May be overridden using the -V command line option.
    VOLS
    The Volume Set Name. There is space on the disc for 278 characters of information.

    For example, the following is a useful starting point:

    APPI=Ultrasound data sets
    COPY=Univerisity of Michigan, 1997
    ABST=description.txt
    BIBL=md5sums
    PREP=Philip VanBaren
    PUBL=Biomedical Ultrasonics Lab, University of Michigan, 3304 G.G. Brown, 2350 Hayward Rd., Ann Arbor, MI 48109
    SYSI=mkisofs/cdwrite
    VOLS=This CD contains the data from experiments performed in the Biomedical Ultrasonics Lab at the University of Michigan
  2. Log in to bulp3427 (the machine with the CD-Writer) and run the mkisofs program using the command:
    mkisofs -o /dev/precd -a -D -L -r -J -v -V "August 1997 data set" /n/pabst/u/var/tmp/cdrom
    This will take the directory structure under /n/pabst/u/var/tmp/cdrom and copy it into a CD image on the precd device on bulp3427. The options for this command are as follows
    -o /dev/precd
    specifies the output file. /dev/precd on bulp3427 is the disk partition reserved for CD-ROM images, and which may be mounted (using the "cdmount 0" command) under /precd. Any file name may be used here (e.g. /d/cdimage.iso) and then later copied to the /dev/precd partition, however it is fastest to write directly to /dev/precd.
    -a
    specifies that all files should be written. If this option is not specified, filenames containing '~' or '#' will be skipped.
    -D
    allows deeply nested directories (no remapping to shallow directories). The ISO-9660 standard specifies a maximum directory nesting level. However, most systems are able to handle CD-ROMs which are nested to arbitrary depths, so there is no need to remap deeply nested subdirectories.
    -L
    allows use of filenames beginning with a period
    -r
    says use Rock Ridge extensions, which stores case sensitive long file names, user ids, group ids, and permissions on the CD-ROM. The lowercase -r causes all uid/gid's to be mapped to 0/0, and enables world read permissions on all files. This is generally the way to go with CDs since user permissions are generally not relevent on data CDs. Using -R instead of -r will retain file ownership and permissions exactly as they are in the original file system.
    -J
    Create the Joliet extensions to be used in Windows 95/98/NT, which provides up to 64-character Unicode filenames to be used. By selecting both this option and Rock Ridge extensions (-r), you will get a CD-ROM that has long filenames in both Unix and Windows.
    -v
    gives verbose messages while the image is being written.
    -V "August 1997 data set"
    specifies the volume name (up to 32 bytes) which will appear as the disk name under Windows 95 and when using the cdtable command in Linux.
    /n/pabst/u/var/tmp/cdrom
    specifies the root of the directory tree to use. This directory will appear as the root of the directory structure on the CDROM, so the subdirectories of /n/pabst/u/var/tmp/cdrom will appear in the base directory of the CDROM.

    Also, the .mkisofsrc settings may be overridden using:

    -A "Application identifier"
    specifies the application name put in the header (128 bytes)
    -P "Publisher name"
    specifies the publisher name for the header (128 bytes)
    -p "Preparer name"
    specifies the preparer name for the header (128 bytes)

    Note: It is possible to set up the entire contents of the CDROM image using symbolic links so that the data need not be all moved from its original location. If you do this, add the switch "-f" to the mkisofs command line to force it to dereference (follow) symbolic links. Beware, though, that when doing this that ALL symbolic links will be deferenced, so you lose the ability to use symbolic links on the CDROM. When using md5sum to verify the image, it will be necessary to use the "-follow" option to have it follow symbolic links as well. This is also necessary when performing the md5sum on the CDROM image (which no longer has symbolic links) because of a bug in mkisofs which does not set the directory link count properly when symbolic links are used.

    Note: The /d directory on Bulp3427 is a Windows (VFAT) partition which may be used as temporary storage for data to be written to CDs. Since it is a VFAT filesystem, any files put there will lose their Unix attributes such as ownership, permissions, and symbolic links. If you wish use this temporary space as a Unix filesystem, run the following commands:

    Then you may cd to /x, and copy files into that directory, and have them retain their proper Unix attributes. When finished with this directory (after you have created your CD image, and written the CD), run the following commands:

  3. Verify the size of the image
    The mkisofs command will create any size of CD-ROM image, so it is up to you to verify that the data will fit on the CD-ROM which you are using. When the -v (verbose) option is used with mkisofs, the program will report (near the end of the output)
    Total extents scheduled to be written = 255630
    Total extents actually written = 255630
    An "extent" is a 2048 byte sector on the CD-ROM disc, which are stored at a rate of 75 per second. The number of extents that can fit on a CD-ROM depends on the length of the disc; discs come in 63 minute, 74 minute, and 80 minute varieties. The number of extents that can fit on these disks is as follows:
Q: How do I create a CD image using mkhybrid
A: The program mkhybrid creates an hybrid CD which contains long filename support for Windows 95/98/NT (up to 64 characters) and Unix, as is the case with mkisofs, but also provides support for the Mac HFS (up to 32 character filenames). This program is an extension of mkisofs, and takes that same options and uses that same preparation procedure as that program, as described above. The recommended command line for this program is (the -f option for following symlinks may also be useful):
mkhybrid -o /dev/precd -a -D -L -r -J -h -v -V "August 1997 data set" /n/pabst/u/var/tmp/cdrom
This will take the directory structure under /n/pabst/u/var/tmp/cdrom and copy it into a CD image on the precd device on bulp3427. The options for this command are as described above, with the following addition
-h
Create an additional HFS directory structure to be used on the Mac.

Verify the data (optional)

  1. Mount the volume /precd and go into it
    % cdmount 0
    % cd /precd
  2. Verify the data, using ls, or diff or checksum. To use the md5sums generated above, use the commands
    % find . -type f -exec md5sum {} \; | sort +2 > /tmp/md5sums.precd
    % diff -u /precd/MD5SUMS /tmp/md5sums.precd
  3. Unmout the volume /precd
    Make sure that you cd out of the /precd directory so that you don't get a device busy error.
    % cd ~
    % cdumount 0

Burn the CD

  1. Get a CDR
    REMEMBER TO SIGN IT OUT!!
  2. Make sure bulp3427 is in Linux mode
    If it isn't, reboot and start in Linux mode (menu option 2 when booting up)
  3. Turn off the X display (optional)
    This will make sure that no other CPU is going on when you're writing the CD
    Do this by pressing CTRL-ALT-F1
  4. Change directory to /home/cdr; then, type cdwtools.
    This will start the CDR writing program automatically
  5. Be sure that Network is OFF
    Use the arrow keys to move down to the Network option, then press return.
  6. Be sure that Dummy Write is OFF
    Use the arrow keys to move down to the Dummy Write option, then press return.
  7. Select the Copy Data CD option
  8. Select Write Data CD
    /precd is source image on /dev/precd - don't mess with the setting
    CD-R is destination on /dev/sga - don't mess with the setting
  9. Put CD into caddy when prompted. Wait until the lights on the front of the CD-ROM drive stop flashing before you select OK, else the program will report that the CD-ROM drive is not ready.
  10. CD will be written
    Do NOT bump desk AT ALL, or laser may lose tracking!!!
    Do NOT use disk on bulp3427 for any other activities or write buffer may empty and recording will be garbage (CD will eject).
  11. When CD writing is done, exit the CD-writer program, and you will be logged out. The network will automatically be restarted on logout.

Verify the cd (optional)

You can now mount the cdrom and verify the files if desired.
  1. Mount the volume /cdrom and go into it
    % cdmount
    % cd /cdrom
  2. Verify the data, using ls, or diff or checksum. To use the md5sums generated above, use the commands
    % find . -type f -exec md5sum {} \; | sort +2 > /tmp/md5sums.cdrom
    % diff -u /cdrom/MD5SUMS /tmp/md5sums.cdrom
  3. Unmout the volume /cdrom
    Make sure that you cd out of the /cdrom directory so that you don't get a device busy error.
    % cd ~
    % cdumount

Unlock the precd partition

If you locked the precd partition before creating your CD-ROM image, you must remember to unlock it when you are finished so that others can use the partition.
% unlock_precd
If someone else has the partition locked, you will get an access denied message. Note: this command resides in /usr/local/bin on bulp3427.

DELETE your temporary files

Remember to delete the files you created to get the CD, e.g., the directories If you keep data in these directories, someone else has the right to delete it to make their own volume! They are not a storage locations!

Back to Internal Use Page