Linux operating system file BASICS (3)

Source: Internet
Author: User

The following is a detailed description of the basic knowledge of the Linux operating system file system. It should be useful to many friends who do not have full knowledge of the Linux operating system. Therefore, you can learn from the following. Hope to help you.

The following is an introduction to Linux File System Basics.

2. A partition is mounted to an existing Directory. The directory cannot be empty, but the contents in the directory are unavailable.
This is also true for mounting file systems created by other operating systems. However, you need to understand that the formats of the file systems used by CD, floppy disk, and other operating systems are different from those used by linux. The disk is ISO9660, the disk is fat16 or ext2, the windows NT is fat16 and NTFS, the windows 98 is fat16 and fat32, And the windows2000 and windows XP are fat16, fat32, and NTFS. Before mounting, check whether linux supports the file system format to be mounted.
Run the mount command during mounting:
Format: mount [-parameter] [device name] [mount point]
Common parameters include:
-T specifies the file system type of the device. Common types include:
Minix linux's earliest File System
Ext2 common file systems in linux
Msdos MS-DOS fat, is fat16
Fat32 commonly used in vfat windows98
Nfs Network File System
ISO CD-ROM CD standard file system
Ntfs windows NT 2000 File System
Hpfs OS/2 File System
Auto automatically detects the File System
-O specifies the option for mounting a file system. Some of them are also available in/etc/fstab. Commonly used
Codepage = XXX code page
Iocharset = XXX Character Set
Ro mounting in read-only mode
Rw mounting in read/write mode
Nouser makes the general user unable to mount
The user allows general users to mount devices.
Note that the mount command does not provide the mount point function. Therefore, make sure that the mount point already exists when you execute the mount command. Don't you understand? To put it bluntly, you must first create a directory where you want to mount the file system. So OK ?)
For example, Windows 98 is installed in the hda1 partition, and the disk and disk need to be mounted 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
Now you can access/mnt/winc and other directories to read and write these file systems.
Make sure that the last two lines of commands are correct. Make sure that the drive and the drive have disks. I don't think I will make such a mistake if I can change the disk at any time:->)
If your Windows 98 directory contains a Chinese file name, after mounting the file with the above command, a bunch of garbled characters are displayed. This requires the codepage iocharset option in the-o parameter. Codepage specifies the code page of the file system. The Chinese code in simplified Chinese is 936. iocharset specifies the character set. cp936 or gb2312 is generally used for simplified Chinese.
When the mounted file system is not supported by linux, mount must report an error, for example, Windows ntfs file system. You can re-compile the Linux kernel to obtain support for the file system. I will not recompile the Linux kernel here.

Iv. automatic mounting
It is too cumbersome to run the mount command every time you access windows partitions at startup. Why not use the mount command to access other linux partitions?
In fact, during each boot, linux automatically mounts the linux partition to be mounted. So can we set the partitions we want to mount when linux is started, such as windows partitions, to realize automatic mounting of the file system?
This is completely possible. There is a fstab file in the/etc directory, which lists the file systems automatically mounted when linux is started. My/etc/fstab file is as follows:
/Dev/hda2/ext3 defaults 1 1
/Dev/hda1/boot ext3 defaults 1 2
None/dev/pts devpts gid = 5, mode = 620 0 0
None/proc defaults 0 0
None/dev/shm tmpfs defaults 0 0
/Dev/hda3 swap defaults 0 0
/Dev/cdrom/mnt/cdrom iso9660 noauto, codepage = 936, iocharset = gb2312 0 0
/Dev/fd0/mnt/floppy auto noauto, owner, kudzu 0 0
/Dev/hdb1/mnt/winc vfat defaults, codepage = 936, iocharset = cp936 0 0
/Dev/hda5/mnt/wind vfat defaults, codepage = 936, iocharset = cp936 0 0
In the/etc/fstab file, the first column is the device name of the mounted file system, the second column is the mount point, and the third column is the mounted file system type, the fourth column is the mounting option, which is separated by commas. The fifth and sixth columns do not know what they mean. They also look at their fingers.
In the last two lines, I manually added the C; D Drive in windows, and added the codepage = 936 and iocharset = cp936 parameters to support Chinese file names. The defaults parameter actually contains a set of default parameters:
Rw mounting in read/write mode
Enable User ID and group ID settings for suid
Dev can interpret characters or block devices on the file system
Exec executable binary file
Auto mount
Nouser makes the general user unable to mount
Async executes the input and output operations of the file system in non-synchronous Mode
You can see that in the basic knowledge of Linux operating system file system, the optical drive and the soft drive are not automatically mounted, and the parameter is set to noauto. If you want to enable automatic mounting, make sure that you have disks in your drive and drive every time you start the system .)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.