[Information Coding Laboratory]

Using Removable Media on Linux Machines


CDs

In order to use a data CD in the Linux machines you first need to "mount" the filesystem. This is only necessary for data CDs - for music CDs use a program like workman or xmcd.

To mount the cd (after inserting the disk in the drive):
% mount /mnt/cdrom

Once the CD is mounted, the files can be accessed under the directory /mnt/cdrom. Note: this only mounts ISO9660 format disks (the most common type). If you need to mount something else then send mail to help@code.

To unmount the cd:

% umount /mnt/cdrom

Note: you cannot unmount any device if some process is using it. You will get a 'device busy' error in that case. if this happens, make sure you are not underneath the /mnt/cdrom directory in one of your shells or other programs. You can also use the program 'fuser' to try to determine which process is using the resource. Please unmount the CD when you are finished. The CD cannot be removed from the drive unless the filesystem has been unmounted. You can eject the CD using the command (or just press the button on the drive):

% eject


Floppies

You have a few options for dealing with floppies depending on the format you would like.


Reading/Writing MS-DOS format

For reading/writing MS-DOS format, you don't need to mount the disk. Use the mtools family of commands to access the disk. More info is available on these with the command
man mtools

Mounting ext2 format disks

This section relates to accessing floppy disks with the ext2 filesystem (i.e., the native Linux filesystem). If you need to create a floppy with the ext2 filesystem use the mke2fs command on the device /dev/fd0.

To mount the floppy:

% mount /mnt/floppy

Once the floppy is mounted, the files can be accessed under the directory /mnt/floppy.

To unmount the floppy:

% umount /mnt/floppy
Make sure you unmount the floppy before removing it or you may not have the changes recorded.

See the discussion above on unmounting CDs if you have trouble unmounting a floppy.


Using tar format

You can also tar directly to the floppy device. Only one tar file can be written to the device. Subsequent tar commands will overwrite any previous data. No need to mount or unmount the device.

To create a tar file on the disk:

tar cvzf /dev/fd0 file1 file2 ...
To extract the data (assuming it's compressed - that's the 'z' option):
tar xvzf /dev/fd0 







Welcome · Projects · People · Papers · Calendar · Links · Internal
© 1997 Information Coding Laboratory
Send comments to www@code.ucsd.edu

Last modified: Thu Dec 3 16:29:46 PST