When using a CD, floppy disk, or USB flash disk in Linux, you must run the mount command first. The mount command will specify these storage media as a directory in the system, and then directly access the corresponding directory to read and write data on the storage media.
1. Attach a cd
The command for attaching a CD is as follows:
# Mount-T is09660/dev/CDROM/mnt/CDROM
This command mounts the disc to the/mnt/CDROM directory, and uses the "ls/mnt/CDROM" command to display the data and files on the disc.
The command for detaching a CD is as follows:
# Umount/mnt/CDROM
2. mount a floppy disk
Run the following command to mount a floppy disk to the/mnt/Floppy directory:
# Mount/dev/fd0/mnt/floppy
The command to detach a floppy disk is as follows:
# Umount/mnt/floppy
3. Mounting a USB flash disk is relatively complicated.
First, run the "fdisk-L" command to view the device Number of the plug-in flash memory, which is generally/dev/sda1. Then run the "mkdir/mnt/USB" command to create a directory for mounting the USB disk. Run the following command to mount the fat format USB flash drive:
# Mount-T msdos/dev/sda1/mnt/USB
Run the following command to mount a USB flash drive in FAT32 format:
# Mount-T vfat/dev/sda1/mnt/USB
4. Mount external hard disk partitions
To mount the external hard disk partition (FAT32 format), you also need to use "fdisk-1" to view the device Number of the external hard disk partition, which is assumed to be/dev/hda1. Run the following command to mount the/mnt/vfat Mount directory:
# Mount-T vfat/dev/hda1/mnt/vfat
Note: by default, Linux only allows the root user to execute the mount command. To enable general users to mount the disk or floppy disk automatically when the system starts, modify the/etc/fstab configuration file and add the following content:
Label = // ext3 defaults 11
/Dev/CDROM/mnt/CDROM iso9660 auto, owner, kudzu, Ro, user 00
/Dev/fdo/mnt/Floppy auto, owner, kudzu, Ro, user 00
"User" indicates that the mount command is assigned to a general user.
The/etc/fstab file is detailed in the Linux help manual. You may wish to take a look.
CD usage
The mount command is used to mount a file system on a physical device to a directory in the Linux file system. If the mount command does not use any options or parameters, the information about the mounted file system in the current Linux system is displayed.
# Ls-L/Media/CDROM/(/Media/CDROM/is the default mount point in Linux. It can be mounted only when the default mount point is total 0 .)
# Mount-T iso9660/dev/CDROM/Media/CDROM/(Disk mounting)
# Ls/Media/CDROM/(read the content of the disc)
# Cp/dev/CDROM backup. ISO (create a CD image)
# Umount/Media/CDROM/(detach a CD)
# Eject (disc drive tray pop-up)
# Eject-T (reclaim)
# Mount-o loop-T iso9660 backup. ISO/Media/CDROM/(disk image mounting; backup. ISO is the image file of the disk .)
# Umount/Media/CDROM/(image uninstallation)
--------------------------------------------------------------------------
On the Virtual Machine RedHat 5.4 64bit, the device name of the optical drive is :./Dev/HDC
For mounting:
Mkdir-P/mnt/CDROM
Mount/dev/HDC/mnt/CDROM or: Mount-T iso9660/dev/HDC/mnt/CDROM
For uninstallation:
Unmount/mnt/CDROM