"Linux Rookie 2" LVM

Source: Internet
Author: User


● LVM Build

1. Divide the physical partition and change the partition ID to 8e

Pvs|pvdisplay Viewing physical volumes

Vgs|vgdisplay Viewing physical volume groups

Lvs|lvdisplay to view logical volume devices

Monitoring commands

Watch-n 1 \

' echo ' = = = Pvinfo = = = "\

;p vs\

; echo "= = = Vginfo = = =" \

; vgs\

; echo "= = = Lvinfo = = =" \

; lvs\

;d f-h/mnt '

Create

PVCREATE/DEV/VDB1 physical partitions into physical volumes

Vgcreate WESTOS/DEV/VDB1 to make a physical volume group of/DEV/VDB1 This physical volume vg0

Lvcreate-l 100m-n lv0 Westos set up vg0 device in lv0 This group-l specify device size-n Specify device name

Mkfs.xfs/dev/westos/lv0

mount/dev/westos/lv0/mnt/

Expansion

Lvextend-l 200m/dev/westos/lv0 Extended LVM device to 200M

Xfs_growfs/dev/westos/lv0 enlarge XFS File system to device size

PVCREATE/DEV/VDB2 add a piece of equipment to PV/DEV/VDB2

Vgextend WESTOS/DEV/VDB2 Add the newly created/DEV/VDB2 to the Westos

Lvextend-l 600m/dev/westos/lv0 Extended LVM device to 600M

Xfs_growfs/dev/westos/lv0 enlarge XFS File system to device size

Capacity reduction

umount/mnt/Uninstalling the device

Mkfs.ext4/dev/westos/lv0 Modify the file system type to Ext

E2fsck-f/dev/westos/lv0 Detection File system

Resize2fs/dev/westos/lv0 100M file system reduced to 100M

mount/dev/westos/lv0/mnt/Mount




Snapshot

umount/mnt/

Lvcreate-l 10m-n lv0-backup-s/dev/westos/lv0

Create a snapshot for/dev/vg0/lv0

-L Specify Snapshot size

-n Specifies the snapshot name

-s Specifies the snapshot template device

mount/dev/westos/lv0-backup/mnt/hanging in the mirror

Delete Step

umount/mnt/

Lvremove/dev/westos/lv0-backup

Lvremove/dev/westos/lv0

Vgremove Westos

Pvremove/dev/vdb1

Fdisk/dev/vdb

D+enter

D+enter

Wq

Partprobe

Script New partition

Vim 1

#!/bin/bash

Fdisk/dev/vdb << End

N

+1g

Wq

End


This article from the "12147236" blog, reproduced please contact the author!

"Linux Rookie 2" 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.