LVM Management of Linux learning experience and installation of Linux system

Source: Internet
Author: User

LVM Management and Linux system installation

1. Preface

2.LVM Introduction and terminology

3.LVM use

4.Linux Partitioning

5.Linux Installation Considerations

First, preface

This blog post records the learning experience of Linux, with a focus on the application of Logical Volume Manager (LVM, logical volume management) technology, and the basic scenarios for partitioning the Linux installation.

This blog post most of the content is based on the following articles, and even some pictures from the following blog, this article to a certain extent, can be said to the following articles reproduced and learning;

http://www.cnblogs.com/gaojun/archive/2012/08/22/2650229.html (Linux LVM HDD Management and LVM expansion)

http://www.litvip.com/361/(use of LVM five-delete logical volume LV)

Https://linux.cn/article-3218-1.html (Linux LVM Concise tutorial)

http://m.blog.csdn.net/article/details?id=17143163 (how Ubuntu is partitioned)

Ii. Introduction and terminology of LVM

Logical Volume Manager (English: Logical Volume Manager, abbreviated to LVM), also translated as logical File Manager, logical Sector Manager, Logical Disk Manager, is the logical volume management (Logical Volume Management) functionality provided by the Linux core. It creates a logical layer on top of the hard disk partition to facilitate system management of the hard disk partition system--wikipedia

The core terminology of LVM:

Physical Volume (PV): Physical volume

Volume Group (VG): Volume group

Logical Volume (LV): Logical Volume

PV, VG, LV three relations:

An example logic diagram for LVM management is as follows:

* For a simple summary of LVM management , Baidu knows the following answers:
"First, create a new partition physical volume (PV), then set the partition type to LVM, then you can create a volume group (VG) on the PV, and then divide the logical volume (LV) in the VG, each logical volume is equivalent to a new partition. If you need to adjust the partition (LV) size, if you expand the LV, you need to have the remaining unallocated space (free PE), otherwise it is necessary to reduce the other LV to obtain available PE. “

(HTTP://ZHIDAO.BAIDU.COM/QUESTION/1111074967141468379.HTML?FR=IKS&WORD=LVM&IE=GBK)

Iii. use of LVM 3.1 creating PV and VG

1. Create a partition with Fdisk

Note: The partition format is Linux LVM

2. Creating PV and VG

To create PV and VG, you need to use the following command:

Partprobe//partition in effect
Pvcreate/dev/sda2//Create PV

Pvdisplay//View PV
Vgcreate vgname/dev/sda2//Create VG

Vgdisplay//View VG

3.2 Creating a LV and mounting

The corresponding command is as follows:

Lvcreate-l 10g-n lvname vgname//Create LV
Lvdisplay//View LV
Mount/dev/vgname/lvname/root/test//Mount LV to/root/test

Note: If you want to start the LV when the system starts, it is best to write lvdata to the/etc/fstab file

3.3 Expansion operation

The corresponding command is as follows:

Pvcreate/dev/sda3//Create new PV

Vgextend vgname/dev/sda3//Extension vgname

Lvextend–l 1g/dev/vgname/lvname//Extended LV

Resize2fs/dev/vgname/lvname//performs this reset size for LogVol01 that are currently in use

3.4 Reduction Operations

The corresponding command is as follows:

Umount/dev/vgname/lvname//Unload LV
E2fsck-f/dev/vgname/lvname//detecting disk errors
Resize2fs/dev/vgname/lvname 100M//Shrink file system, update EXT4 information
Lvresize-l 100m/dev/vgname/lvname//Reduce Logical volume size

Note: File backups prior to reduced operations

3.5 Delete Operations

The corresponding command is as follows:

Umount/dev/vgname/lvname//Unload LV
Lvremove/dev/vgname/lvname//Delete LV
Vgremove/dev/vgname//Delete VG
Pvremove/dev/sda2//Remove PV

Iv. Linux Partitioning

1./swap swap partition, typically twice times the memory of your machine (<8g)
Note that a large amount of processing audio, video, and pictures requires more than 3GB of swap space.

2./root partition, the general choice of 15G, the default EXT4,
If you do not separate the partitions described below, they are attributed to this partition, even if the most recent novice can also consider the upper limit of 30GB-usually do not use this

3./boot partition recommended ext2, default EXT4.

This partition contains the kernel of the operating system and the files to be used in booting the system, it is necessary to build this partition, because most of the current PC is limited by the BIOS, and if there is a separate/boot boot partition, even if the main root partition problems, the computer can still boot. The size of this partition is about 60MB-120MB, not exceeding 150MB. 1G is enough to study the kernel.
Note: The EFI problem file format may need to be modified


4./home partition, default EXT4, private file, just put the rest of the space here.

These are the basic requirements.

/usr partition 100G default ext4, where the system and personal software are stored.

/var/log partition 1G default EXT4, System logging partition, if this separate partition is set up, this will not affect the primary partition of the operating system even if there is a problem with the system's log files.

/tmp partition 5G The default ext4,tmp partition is used to hold temporary files. is necessary for a Web server. This allows the other parts of the file system to be secure even if the program is running with a large number of temporary files, or if the user is doing something wrong with the system. Because this part of the filesystem still has read and write operations, it usually has problems faster than the rest of the system.

/OPT partition 1G Add-on storage place

Five, Linux installation considerations

An EFI error occurred while installing Linux.
There are two types of solutions available online:
1. Use legacy mode in BIOS setup to disable EFI mode
2. Allocating space for/boot/efi

Practical Solutions:

The system was successfully installed with the 200M EFI partition assigned and the/boot partition assigned.

LVM Management of Linux learning experience and installation of Linux system

Related Article

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.