Detail the linux mnt directory role

  • 2020-05-14 05:54:22
  • OfStack

The mnt directory under linux:

mount English explanation: board; Climb; Climbing; Ride; Ride; Mount mount mount mount mount mount mount mount mount mount mount

Hook the CD drive, USB device directory, after loading, there will be the corresponding device directory in mnt. mnt is short for mount.

Mount command:

Note:

1. The hardpoint must be a directory.

2, 1 partition mounted on an existing directory, the directory can not be empty, but after mounting the previous contents of this directory will not be available. The same is true for mounting file systems established by other operating systems.

3. The file system format used by CD, floppy disk and other operating systems is different from the file system format used by linux. The CD is ISO9660; The floppy disk is fat16 or ext2; windows NT are fat16, NTFS; windows98 is fat16, fat32; windows2000 and windowsXP are fat16, fat32, NTFS. Before mounting, know if linux supports the file system format to be mounted.

Use the mount command when mounting:

Format: mount [- parameter] [device name] [mount point

-t specifies the file system type of the device. Common examples are:

minix linux first used file system

ext2 linux is a file system commonly used today

msdos MS-DOS fat, fat16

vfat windows98 commonly used fat32

nfs network file system

iso9660 CD-ROM cd-rom standard file system

ntfs windows NT 2000 file system

hpfs OS/2 file system

auto automatically detects file systems

-o specifies options when mounting the file system. Some can also be used in /etc/fstab. Common ones are:

codepage = XXX code page

iocharset = XXX character set

ro is mounted read-only

rw is mounted in read-write mode

nouser makes mounting impossible for 1 - like users

user lets you mount devices for 1 - like users

Note: the mount command does not have the ability to create hardpoints, so you should make sure that the hardpoints already exist when you execute the mount command.

Example: windows98 is mounted on the hda1 partition, and there are floppy and optical disks to mount on the computer.


# mk /mnt/winc

# mk /mnt/floppy

# mk /mnt/cdrom

# mount -t vfat /dev/hda1 /mnt/winc

# mount -t msdos /dev/fd0 /mnt/floppy

# mount -t iso9660 /dev/cdrom /mnt/cdrom

If you have a Chinese file name in your windows98 directory, use the command above to mount it, and it will display a heap of gibberish. This is done using the codepage iocharset option in the -o parameter. codepage specified file system code page, simplified Chinese Chinese code is 936; iocharset specified character set, cp936 or gb2312 (simplified Chinese 1), utf8=0. When mounted file system linux is not supported, mount1 must report an error, such as windows2000's ntfs file system. You can recompile the linux kernel to gain support for this file system. I won't talk about recompiling the linux kernel here.


mount -t vfat -o codepage=936,iocharset=cp936,utf8=0 /dev/hda7 /mnt/f

Examples of use:

Mount the cd-rom


mount -t iso9660 /dev/cdrom /mnt/cdrom

Mount CD drive, support Chinese


mount -t iso9660 -o codepage=936,iocharset=cp936 /dev/cdrom /mnt/cdrom

Mount the Windows partition, FAT file system


mount -t vfat /dev/hda3 /mnt/cdrom

Mount the Windows partition, NTFS file system


mount -t ntfs -o iocharset=cp936 /dev/hda7 /mnt/had7

Mount the ISO file


mount -o loop /abc.iso /mnt/cdrom

Mount the floppy drive


mount /dev/fd0 /mnt/floppy

Mount the flash drive


mount /dev/sda1 /mnt/cdrom

Mount the folders Shared by the Windows operating system


mount -t smbfs -o username=guest,password=guest //machine/path /mnt/cdrom

Displays the mounted file system

mount

cat /etc/fstab boot automatically loaded FS

cat /etc/mtab FS currently loaded

==============================================================

/ etc/fstab files:

/etc/fstab is the file system that is automatically mounted to linux at boot time.

For example, this is a normal /etc/fstab:


mount -t vfat -o codepage=936,iocharset=cp936,utf8=0 /dev/hda7 /mnt/f
0

---------------------------------------------------------------------------------------


mount -t vfat -o codepage=936,iocharset=cp936,utf8=0 /dev/hda7 /mnt/f
1

1; /dev/device is the device to mount, and /hda2 is the second partition of the main hard disk on the first IDE slot. If the second IDE slot is the third partition of the main hard disk, it is /dev/hdc3, which can be viewed using fdisk-l under linux.

2; mountpoint is the hardpoint. /, /usr, swap are all default hardpoints in the system installation zone.

If you're going to mount a new device, think about it, because the new device will be a permanent part of the file system, based on FSSTND (file system standard), what it does, and user requirements. If you want to use it as a Shared resource, put it under /home.

3; type refers to the file system class.

4. rules refers to the rules at mount time. Here are some common ones:

auto starts up and mounts automatically

default mounts definitions according to the default values for most permanent file systems

noauto does not mount automatically on startup

nouser can be mounted only by the superuser

ro is mounted with read-only permissions

rw is mounted with readable and writable permissions

The user can be mounted by any user

Note that cd-roms and floppy drives can only be mounted with media installed, so it is noauto

5; dump means the dump system backup tool. If this 1 term is 0, it means never backing up. If you used dump last time, the number of days since the backup is displayed.

6; fsck_order means fsck (the order in which fsck checks at startup). A value of 0 means no check, the (/) partition is always 1, the rest of the partition can only start at 2, and check at the same time when the Numbers are the same (but not two ones).

If I want to attach the windows C area on the second IDE slot to the file system, then the data entry is:

/dev/hdc1 /c vfat defaults 0 0

(/c is a pre-created folder that ACTS as a mount point for the c disk.)

When you modify /etc/fstab, 1 must reboot the system to be effective


Related articles: