Editor's note: This article describes how to control the installation and uninstallation of Linux file systems, as well as the principles and precautions to be understood.
To make the most effective use of the articles in this series, you should have basic Linux knowledge and need to prepare a Linux system for using the commands described in this article. Unless otherwise stated, most examples in this article) Use Fedora 13 with 2.6.32 kernel. Sometimes the output formats of different versions of the program are different, so the results you get may not always be the same as the list and diagram shown here.
You should also be familiar with the content in our article "Learn Linux, 101: Create partitions and file systems.
Linux File System is a big directory tree that uses/to divide the root directory, but we also have a file system on different devices and partitions. How can we solve this obvious inconsistency? Root/) The file system is installed as part of the installation process. Each other file system you create cannot be used in your Linux system until it is installed inMount point.
In the currently installed file system set, the mount point is only a path, and the file system on the device is transplanted to the tree. Installation is a process that makes the file system on the device accessible. For example, you can install the file system as/boot,/tmp, or/home to the hard drive, or you can install the file system as/mnt/floppy to the floppy drive, you can also install it on the CD-ROM as/media/cdrom1, as you can see, the mount point may be in the root directory, or a further subdirectory.
In addition to the partition, floppy disk, and CD file systems, there are other types of file systems. Tmpfs is a virtual memory file system. You can also use a network file system such as NFS or AFS to install a file system from one system to another. You can even create a file on an existing file system and format it as a file system. This is usually done using an optical media image, where you seem to need to download an iso cd or DVD image and then install the file instead of burning it into a real media. The swap space in the file is not a dedicated swap space) is another example.
The installation process is actually installed on a device or other resources.File SystemGenerally referred to as "install a device", which can be understood as "installing a file system on a device ".
Root permission is usually required to install and uninstall a file system. If you log on as an ordinary user, you can usesu -Switch to the root directory orsudo. In our example, when the command prompts to end with #, as shown in Listing 1 below, you will need the root permission.
mountThe command format includes two parameters: the device that contains the file system to be installed or other resources) and the mount point. For example, we have installed our FAT32 partition/dev/sda9 on the mount point/dos, as shown in Listing 1.
List 1. Mount/dos
[root@echidna ~]# mount /dev/sda9 /dos |
Before installing a mount point, a mount point must exist. If no, you will receive an error message. You need to create a mount point or use another mount point, as shown in Listing 2.
Listing 2. Installation Error
[root@echidna ~]# mount /dev/sda9 /dosmount: mount point /dos does not exist[root@echidna ~]# mkdir /dos[root@echidna ~]# mount /dev/sda9 /dos |
When you install a file system in an existing directory, the files on the file system you want to install become subdirectories and files of the mount point. If the mount point directory already contains files or subdirectories, they will not be lost but will no longer be available until the installed file system is uninstalled. To avoid such problems, a better way is to use only empty directories as Mount Points.
After a file system is installed, any files or directories created or copied to the mount point or under any directory will be created on the installed file system. In our example, the file/dos/sampdir/file.txt will be created on the FAT32 file system we installed under/dos.
Generally,mountCommand to automatically detect the type of the installed file system. Occasionally, you may need to use-tSpecify the file system type, as shown in listing 3.
Listing 3. Installation with an explicit file system type
[root@echidna ~]# mount -t vfat /dev/sda9 /dos |
To view which file system is installed, use a file system without ParametersmountCommand. Listing 4 shows our example system. Note: you only need to list the installed file systems without the root permission.
Listing 4. display the installed File System
[ian@echidna ~]$ mount/dev/sda6 on / type ext4 (rw)proc on /proc type proc (rw)sysfs on /sys type sysfs (rw)devpts on /dev/pts type devpts (rw,gid=5,mode=620)tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")/dev/sda2 on /grubfile type ext3 (rw)none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)gvfs-fuse-daemon on /home/ian/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=ian)dw.raleigh.ibm.com:/vol/vol1/dwcontent on /mnt/dwcontent type nfs (rw,addr=9.42.155.6)/dev/sdb9 on /mnt/sdb9 type ext3 (rw)/dev/sda9 on /dos type vfat (rw)/dev/sr0 on /media/KNOPPIX type iso9660 (ro,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500) |
You can also view similar information by displaying/proc/mounts or/etc/mtab, both of which contain information about the installed file system.