Article Title: Mount command: Linux external storage media mounting method. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
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. attaching 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.