Linux File System

Source: Internet
Author: User
In an operating system, everything can be viewed as a file, and a file is the basic unit of the operating system's logical organization. ForUNIXAndLinuxFor file systems, the hierarchical standards of file systems (FHS) Is the main reference of its organization specifications. Anyone who knows a little about the file directory structure knows that the file system is usually composed of the root directory (/. ★InLinuxCommon first-level sub-directories include:
Directory Name Description
/Bin Store some necessary command tools in a centralized manner. It is best not to mount them separately. Otherwise, you will not find the practical tools you need.Program.
/Boot IncludeLinux. By default100 m, This is the preparationRhceThe exam is sufficient.
/Dev Stores drivers of various devices in a centralized manner. Do not mount the partitions separately.
/Etc Store basic configuration files in a centralized manner
/Home Centralized storage of users' Home Directories
/Lib Compile the library file of the kernel and utility. Do not mount this partition separately.
/Media Mount point of removable media
/Misc UseAutomounterStandard mount point for local directory mounting
/Mnt Old mount point for mobile media
/Net UseAutomounterStandard mount point for the mounted network directory
/OPT Common locations for storing third-party Application Files
/Proc Stores the current kernel-related processes and Kernel configuration information in a centralized manner.
/Root RootUser's home directory
/Sbin Store system management commands in a centralized manner. Do not mount the partition separately.
/SELinux And security upgradeLinuxRelated current configuration
/SMB UseAutomounterMount Remote sharingMicrosoftStandard mount point of the network directory
/Srv It is often used in various non-RedHatVersion of network server
/Tftpboot WhenTFTPThe server exists.
/Tmp Centralized storage of temporary files. By default,RedHatThe directory is automatically cleared periodically.
/Usr Stores small programs available to all users in a centralized manner, including many system management commands and utilities
/Var Centralized storage of variable data, such as logs and printer Buffer files
★Device Files Many media devicesLinuxThe system is managed in the form of files, such as hard drive, soft drive, and optical drive. In additionPCDevices accessed by slots or ports, such as serial ports,USB, Parallel port,IEEE 1, 1394There are also dedicated device files. The vast majority of peripheral devices can be automatically detected. A typical device file is as follows:
Device Device Files
Soft drive First soft drive (A:):/Dev/fd0; 2. Soft drive (B:):/Dev/fd1
PATA (IDE)Hard drivePATA (IDE)Optical Drive First drive:/Dev/hda; Drive 2:/Dev/HDB; Drive 3:/Dev/HDC; Drive 4:/Dev/HDD
SATAOrSCSIHard driveSATAOrSCSIOptical Drive First drive:/Dev/SDA; Drive 2:/Dev/SDB;......; 27th drive:/Dev/sdaa;......
Parallel Port First:/Dev/pd1; First tape drive:/Dev/pt1
USBDrive Depends on the specific connection device
IEEE 1, 1394Device ActuallySCSIStandard, referSCSIDevice File rules
Note: In/DevMany files under are just references to standard device files, which are often used for easier identification. For example/Dev/CDROMAnd/Dev/DVD. ★File System Tools LinuxThe file system can be created, checked, or repaired using three tools:Fdisk,MkfsAndFsck. Of course,LinuxMore than three file system tools, suchPartedBut these three are undoubtedly the most commonly used ones, which will be briefly introduced below (for specific help information, referManPage ): 1) Fdisk:FdiskWe are no stranger, because inWindowsThis is a basic tool in the system. In fact, althoughLinuxInFdiskAndWindowsInFdiskSome are similar, but the function support is much larger. In useFdiskBefore that, you must first specify the hard disk to be processed. For exampleIDEHard Disk, you can enter:# Fdisk/dev/hda.FdiskCommon Commands include:
Option Description
A Specify bootableLinuxPartition
D Delete a partition
L Display available partition types,FdiskYou can create file systems of the listed types
N Create a new partition (when free space is sufficient)
P Show existing partitions
Q Exit Without saving the changes
T Modify the System ID (type) of a partition)
W Save changes and exit
2) Mkfs: Mainly used for formattingLinuxPartition. For example, if you want to format/Dev/hda1IsExt3File system, you can directly enter:# Mkfs-T ext3/dev/hda1. If the partition has been usedExt3The file system has been formatted. Now you need to format it again.MkfsThe file system type can be automatically recognizedExt3, Enter:# Mkfs/dev/hda1You can. 3) Fsck: This command is similarWindowsOnChkdskCommand, which is mainly used to check and repair the file system. Note: before running this command, you must first detach the checked partition, and then re-mount the partition after the repair is completed. For example: # Umount/var # Fsck-T ext3/dev/sda6 # Mount/dev/sda6/var If the partition has been usedExt2OrExt3The file system has been formatted. Now you need to check the partition.FsckAutomatic CallE2fsckCommand, you do not need to specify the partition type, enter:# Fsck/dev/sda6You can. ★LVM Logical Volume Manager (LVM) Is a tool that allows you to create a file system across partitions. Its introduction draws onUNIXThe advantages of the file system can be used and configured flexibly, thus greatly improvingLinuxSystem reliability and availability. UseLVMYou can easily resize disk partitions. A file system can even span multiple hard disks. The following describes how to createLVMPartitioning process: 1) Add a new hard disk 2) Create a new partition and specify one or more partitionsLVMFile System Type (available FdiskTool) 3) Backup/HomeDirectory to specify its partitionLVMFile System Type 4) Use VgscanTool ScanningLinuxOfLVMFile System to create backup information library 5) Use Pvcreate/dev/ PartitionCommand to create a (physical) volume. 6) Add a volume to the specified volume group: Vgcreate groupname/dev/Partition1/Dev/ Partition2... 7) Create logical volume: Lvcreate-lXYM-n Volname groupname, HereXYVolume size 8) Use MkfsFormat the logical volume as the specified file system 9) Use Pvdisplay, VgdisplayAnd LvdisplayCommand to check the created volume, volume group, and logical volume information respectively ★AboutMount MountIs a common command closely related to file system operations. It is mainly used to mount local or network partitions at a specified location. The mount point is not fixed and can be specified by the system administrator. Of course, the Administrator must have sufficient operation permissions on the Mount directory.FHSSpecifies some standard mount points, such as/Mnt/floppyAnd/Mnt/CDROMAnd so on. The Mount operation is as follows: # Mount-T vfat/dev/fd0/mnt/floppy # Mount-T iso9660/dev/CDROM/mnt/CDROM Some mount points can beAutomounterTo automatically determine.

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.