A brief overview of Linux file system and LVM

Source: Internet
Author: User
Tags uuid

A brief overview of Linux file system and LVM
Directory
(1) What is a file system
(2) file system basic operation
(3) LVM Logical volume concept and basic operation

(1) What is a file system
Concept:
A file system is the method and data structure used by the operating system to explicitly store files on a device or partition; The method of organizing files on a storage device. The software structure that manages and stores the file information in the operating system is called the file management system, referred to as file system
From the system function point of view, the file system is to organize and distribute the space of the file storage device, which is responsible for the file storage and the system of protecting and retrieving the deposited files. Specifically, it is responsible for creating files for users, depositing, reading, modifying, dumping files, controlling file access, security control, logging, compression, encryption, etc.

Main types:
EXT2,EXT3,EXT4, Xfs,btrfs,reiserfs, JFS,
Ext2: is a scalable, high-performance file system designed to address the shortcomings of the Ext file system. Also known as Level two extended file system
EXT3: is a log file system developed by the open source community. Ext3 is designed to be an upgraded version of Ext2.
EXT4: Log file system, support 1EB (1024*1024TB), maximum single file 16TB, support continuous write can reduce file fragmentation. Rhel6 Default File system
XFS: is an excellent log file system designed by SGI. XFS is known as the industry's most advanced, most scalable file system technology. It is a full 64-bit, fast, stable log file system,
Btrfs: A ext3 file system that replaces Linux, which improves the limitations of ext3, especially the limit of single file size, the total file system size limit, and the addition of file checksum features.
Reiserfs:reiserfs is a new file system that accommodates data in a unique way-fully balanced tree structure-including file data, filenames, and log support. The ReiserFS also supports massive disk and disk arrays, and can continue to maintain fast search speeds and high efficiency on top.
JFS:JFS provides a log-based byte-level file system that is developed for transaction-oriented, high-performance systems.
Classification:
Depending on whether or not it supports the journal (log) feature:
journaled file system: ext3, Ext4, XFS, ...
Non-journaled file system: ext2, VFAT
Part:
Modules in the kernel: Ext4, XFS, VFAT
User space management tools: MKFS.EXT4, Mkfs.xfs,mkfs.vfat
VFS: Virtual file system
The purpose of the VFS (virtual file system) is to use standard UNIX system calls to read and write different file systems on different physical media, which provides a unified interface and application programming interface for various file systems. VFS is an adhesive layer that allows system calls such as open (), read (), write () to work without caring for the underlying storage media and file system types.


(2) file system basic operation
Create File system: MKFS,MKE2FS
The MKFS:MKFS command is used to create a Linux file system on a device (usually a hard disk). The MKFS itself does not perform the work of establishing the filesystem, but rather calls the relevant program to execute it.
The MKE2FS:MKE2FS command is used to create a "ETC2/ETC3" file system on a disk partition.
File system Tags: Blkid,e2label,findfs,
The blkid:blkid command queries the file system type used on the query device. Blkid is primarily used to query the file system type, LABEL, UUID, and other information used by the system's block devices, including swap partitions. To use this command, you must install the E2fsprogs package.
The E2label:e2label command is used to set the volume label for the second extended file system.
The Findfs:findfs command finds the device files for the file system based on the volume label and UUID. The FINDFS command searches the entire disk for any matching tags or uuid, if any, and prints to the callout output. The Findfs command is also part of the E2fsprogs project.
Redefined: TUNE2FS
The TUNE2FS:TUNE2FS command allows the system administrator to adjust the parameters in the "ext2/ext3" file system. Under Windows, if there is an unexpected power outage, the system self-test will appear on the next boot. The Linux system also has a file system self-test, and it is possible to define self-test cycles and methods by TUNE2FS commands.
Query Super BLOCK: DUMPE2FS
The DUMPE2FS:DUMPE2FS command prints the Super block and fast group information for the "EXT2/EXT3" file system.

(3) LVM Logical volume concept and basic operation
Concept:
LVM can flexibly adjust the capacity of the file system! It is not the storage efficiency and security of the data. LVM can integrate multiple partitions together, making these partitions look like a disk, and, in the future, add or remove other entity partitions into this LVM-managed disk, so that the entire disk can be used in a space that is quite resilient.

PV (physical volume): Refers to hard disk partition, is the basic storage logic block of LVM, contains the management parameters related to LVM
VG (Volume Group): Similar to a physical hard disk in a non-LVM system, consisting of a PV (physical volume) that can create one or more "LVM partitions" (logical volumes) on a volume group, and an LVM volume group consists of one or more physical volumes
LV (Logical volume): LVM logical volumes are similar to hard disk partitions in non-LVM systems, and file systems can be created on top of logical volumes
The three-person relationship

Basic operations
Implementation process
Steps: 1. Create a pv-2. Create vg-3. Add PV to vg-4. Create lv-5 in VG. Format the LV partition-6. Mount the LV partition to a directory using
Create PV
PVCREATE/DEV/SDB1 Create PV/DEV/SDB1 The first primary partition of the SCSI second hard drive into PV
PVCREATE/DEV/SDC1 the first primary partition of the SCSI third hard drive into PV (the Linux operating system should be on the first hard drive)
View PV
Pvdisplay
Create a volume group VG
Vgcreate DATAVG/DEV/SDB1/DEV/SDC1 Create a volume group named Datavg, add/dev/sdb1 and/DEV/SDC1 two PV to this volume group
View VG
Vgdisplay
Create a logical volume LV
Vcreate–l 50g–n lv1 Datavg Create a logical volume with a size of 50G in Datavg, named Lv1
View LV
Lvdisplay
LV formatted as ext3 file format
Mkfs. EXT3/DEV/DATAVG/LV1 to format lv1 as ext3 file system type
Partprobe the system is able to recognize these partitions without restarting the machine
Create a Directory
Mkdir/oracle
Mount
Mount/dev/datavg/lv1/oracle mount the LV1 to the/oralce directory
View Capacity LS–LH
Expansion LV
To configure a new partition with the 8e system ID with fdisk
Creating PV with Pvcreate
Add PV to LV1 using Vgextend
Use Lvresize to add PE into the new PV LV1
The capacity of the filesystem is actually increased through RESIZE2FS
The above is my understanding of the file system and LVM and simple, if there is insufficient, please correct me!

A brief overview of Linux file system and LVM

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.