The second book unit5. Manage flexible storage with Logical Volume Manager

Source: Internet
Author: User

UNIT5 managing flexible storage using Logical Volume Manager

1.LVM (soluble disk extension)

1). LVM Setup (device can be infinitely expanded, but file system support 18eb)

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

Pvs|pvdisplay vdb1,2/* Display PV

Vgs|vgdisplay Westos/* Display VG Group

Lvs|lvdisplay lv0/* Displays the LV used

Watch-n 1 \/* Monitoring

' echo ' ===pvinfo ' \

;p vs \

; echo "===vginfo" \

; VGS \

; echo "===lvinfo" \

; Lvs;df-h/mnt '

PVCREATE/DEV/VDB1/* Create PV partition

Vgcreate WESTOS/DEV/VDB1/* Create VG Group Westos

Lvcreate-l 100m-n lv0 westos/* Create Lv0

MKFS.EXT4/DEV/WESTOS/LV0/* Format system

mount/dev/westos/lv0/mnt/

2) Delete the LVM disk (uninstall first, then shrink the file system, reduce the device)

umount/mnt/

Mkfs.ext4/dev/westos/lv0/*XFS cannot be flexibly managed

E2fsck-f/dev/westos/lv0/* View File system usage

Resize2fs/dev/westos/lv0 550M

Lvreduce-l 550m/dev/westos/lv0/* Shrink 550M disk

PVMOVE/DEV/VDB1/DEV/VDB2/* Give the first disk something to a second disk

Vgreduce WESTOS/DEV/VDB1/* Remove the first disk from the group

PVREMOVE/DEV/VDB1/* Delete First disk

3) Error and resolution (reduce file system first, so disk error prone)

Lvreduce-l 100m/dev/westos/lv0 (reduced file system)

mount/dev/westos/lv0/mnt/(Mount)

Lvextend-l 200m/dev/westos/lv0 (Extended file system)

Resize2fs/dev/westos/lv0 (Increased use of disk partitions)

mount/dev/westos/lv0/mnt/

If you delete the partition you are using directly, you will also get an error

Pvcreate/dev/vdb1

Vgextend WESTOS/DEV/VDB1

Fdisk/dev/vdb

Partprobe

Vgreduce--removemissing Westos (Delete the file system of the deleted partition)

4) Disk Snapshot

Lvcreate-l 10m-n lv0-backup-s/dev/westos/lv0/* Creating a Snapshot

mount/dev/westos/lv0-backup/mnt/

umount/mnt/

Lvremove/dev/westos/lv0-backup/* Deleting a snapshot

Lvcreate-l 10m-n lv0-backup-s/dev/westos/lv0/* using the snapshot again

**2. Scripts for automatically creating partitions

#! /bin/bash

Fdisk/dev/vdb << End

N

+100m

Wq

End

3. How to restore the startup program when emptying the boot

DD If=/dev/zero Of=/dev/vda bs=446 count=1/* emptying the boot program

File:/run/media/kiosk/ca9c-5ce5/11.11/11.6 Page 3 of 3

Recover files with CD or PXE

Follow the steps to execute Enter,chroot

In the execution: Grub2-install/dev/vda


The second book unit5. Manage flexible storage with Logical Volume Manager

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.