Introduction to Logical Volume (LVM) under Linux

Source: Internet
Author: User

Each partition in a Linux system is a file system.

File system refers to the existence of physical space in a file management software (personally think)

After the Linux 2.4 kernel, it began to support a large number of file systems;

Log file system; Ext3 ReiserFS XFSJFS

Linux2.4 kernel Supported file systems later: JFS, ReiserFs, ext, ext2, ext3, ISO9660, XFS, Minx, MSDOS, Umsdos, VFAT, NTFS, HPFS, NF S, SMB, SysV, PROC, etc.

Ext2/ext3 use block+ Innode method to store files

EXT2/EXT3 has a space called Super block

(superblock) The original data that holds the file system

Include: Volume label name, block number, inode number, etc.

The inode is the data that holds the file metadata, including file permissions, attributes, change times, etc.

An inode is an index node that records the attributes, locations, and other information of a file.

Each inode has a number called the index node number (inode number)

The Linux file system keeps the index node number and file name in the directory at the same time. So the directory is just a table that combines the name of the file with his index point number, and each filename and index point in the mesh is called a connection.

A file has only a corresponding inode number, but an inode can have more than one file name corresponding to it. Therefore, the same file on the disk can be accessed through a different path.

The book says ext2 is not a log file system.

From ext2 to ext3 do not need to format, with TUNE2FS can

From ext3 to Ext2, you don't have to make any changes.

EXT3 characteristics;

1. High efficiency; it takes about 10 seconds to recover ext3 file system after illegal shutdown

2. Data integrity; Avoid illegal shutdown and damage to data integrity

3. Speed of file system; Optimized disk drive reading and writing

4. Conversion of data; EXT2-EXT3, EXT3-EXT2

5. A variety of log mode, all data logging mode, only the metadata to log, but not the data log

Data=journal All data logging mode

Data=writeback on metadata logging mode

Tip metadata is to define the data in the file system, that is, the data in the

Root can be defined according to the actual work situation, in the system's working speed and data integrity to select

Format a new partition as a ext3 file system

# mke2fs-j/dev/hda8

Convert ext2 to ext3 file system

# tune2fs-j/DEV/HDA9

Tip: When you convert the Ext2 file system to ext3, you do not need to uninstall the partition. Direct conversion is OK. Don't forget to change the ext2 in/etc/fstab into ext3.

Repairing Ext3 file system with E2fsck

1. # umount/dev/hda8 Uninstall the partition first.

2. #e2fsck-fy/dev/hda8 Repair the partition

ReiserFS File System

1997 Hans Reiser put the Reserfs file system online

Reserfs is much faster than EXT2FS.

Current reserfs can only be used on Intel architecture

The Reiserfs file system has been used on high-end UNIX systems

Reiserfs characteristics;

1. Advanced Logging Mechanism

The Reiserfs log mechanism writes the corresponding log to disk space before each actual data is modified, thus improving the security of the data

2. Efficient Disk Utilization

ReiserFS does not assign an inode to some small files. Instead, these small files are packaged and stored in the same disk block. The other file system is that each file occupies a block. This means that if you have 1000 small files, you need to occupy 1000 blocks. This is a waste of disk space.

3. Unique Search method

Reserfs is based on the balanced Tree search, which is much faster than ext2. The balance tree is an efficient algorithm.

4. Support Massive hard drive

Reserfs can manage hundreds of g of data. The size of the Rerserfs maximum support file system is 16TB. This is ideal for enterprise-class applications.

5. Excellent performance

Reserfs file system starts x-windows twice times faster than ext2

Additional properties of the file

# chattr +(aadijs)filename Additional properties for the settings file

# lsattr filename View additional properties for a file

A; When the file is changed, the change time of the file is unchanged

A You can only append content to the file, you cannot change the original content

i; files can not be deleted, renamed, changed content

J; In the Ext3 file system, the secondary file must be written to the log

S; When the file is changed, this change is written to the file system synchronously

Upgrade the original ext2 transformation into a ext3 file system

# Tune2fs-j/DEV/HDA1 This is a direct conversion

# Mke2fs-j/dev/hda2 This is a format conversion

Common file Systems

Minix Linux first supported file system, relatively old, now everyone uses the

ISO9660 Standard CDROM file system

NFS, a network file system launched by Sun, allowing multiple computers to share a file system

Hint; Redhat Linux does not support NTFS file systems by default. We can edit kernel to allow the system to support NTFS, but may cause damage to the data

Common Create File System Tools

MKFS can be used to create various file systems, which are specified by the-t parameter

MKE2FS Create Ext2/ext3 File system

# mk2fs-j/dev/hda2

Use of the file system

The device is a specific file system that can be represented by a device name or a volume label name

Mount point: Must be a directory. When a file is in a directory, the original file is temporarily inaccessible after the file system is mounted. Cannot continue access until the currently mounted file is uninstalled

Mount Command Parameters

Use Mount command when mounting

Basic format; mount(-parameter)(device name)(mount point)

MOUNT-T Specifies the type of file system

Umount Uninstall File system

Mount-o Loop disk1.iso mount. iso file

The MOUNT-O option specifies the options for mounting the file system. Sometimes it can be/etc/fstab to specify. Commonly used to have

Ro; Mount in a read-only manner

RW; To mount in a read-write manner

Nouser for general users to be unable to mount the device

User, can let the general users mount the device

Configure/etc/fstab

/etc/fstab This file is the file system mount information

When you mount a file system, if the given parameter is not complete, the system will read the parameters from the/etc/fstab file to complete

When the system starts, the system will automatically load the file system according to the configuration information in this/etc/fstab file.

This file can also be used by fsck, dump, Quotaon, Swapon, and other programs

Format of fstab files

Fs_spec fs_file fs_type fs_options fs_dump fs_pass

/dev/hda1/boot ext2 Defaults 1 1

Fs_spec; This field represents the device or remote file system where the file system is to be loaded

Fs_file indicates the mount point of the file system

Fs_type type of File system

Description; For swap, the field is none; for loading directory names containing spaces, use 40来 to denote spaces

Fs_options because when you load a file system on a specified device, you need to use a specific parameter, and multiple parameters are separated by commas. For most systems, default is enough to satisfy the need.

Loading the file system can specify parameters;

ro; loading in read-only mode

Sync; does not buffer the write operations of the device, which prevents the integrity of the file system and data from being corrupted during an illegal shutdown. But this reduces the efficiency of the computer.

User, allowing ordinary users to mount the file system

Quota, forcing disk quotas on the file system

Noauto the file system is not loaded using the MOUNT-A command (at system startup)

Fs_dump; This option is used by the "Dump" command to check how quickly a file system should be transferred, and set to 0 if no transfer is required

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.