2 Unit 5

Source: Internet
Author: User
Tags hex code

# # #unit. 5 lvm###


# # #1. LVM Setup

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

[Email protected] ~]# FDISK/DEV/VDB

Welcome to Fdisk (Util-linux 2.23.2).


Changes'll remain in memory only, until the decide to write them.

Be careful before using the Write command.


Device does not contain a recognized partition table

Building a new DOS disklabel with disk identifier 0x9546a42c.


Command (M for help): N

Partition Type:

P Primary (0 primary, 0 extended, 4 free)

E Extended

Select (default P):

Using Default Response P

Partition number (1-4, default 1): 1

First sector (2048-20971519, default 2048):

Using Default Value 2048

Last sector, +sectors or +size{k,m,g} (2048-20971519, default 20971519): +500m

Partition 1 of type Linux and of size MiB is set


Command (M for help): N

Partition Type:

P Primary (1 primary, 0 extended, 3 free)

E Extended

Select (default P):

Using Default Response P

Partition number (2-4, default 2): 2

First sector (1026048-20971519, default 1026048):

Using Default Value 1026048

Last sector, +sectors or +size{k,m,g} (1026048-20971519, default 20971519): +500m

Partition 2 of type Linux and of size MiB is set


Command (M for help): t

Partition Number (2, default): 1

Hex code (type L to list all codes): 8e

Changed type of partition ' Linux ' to ' Linux LVM '


Command (M for help): t

Partition Number (2, default): 2

Hex code (type L to list all codes): 8e

Changed type of partition ' Linux ' to ' Linux LVM '


Command (M for help): P


disk/dev/vdb:10.7 GB, 10737418240 bytes, 20971520 sectors

Units = sectors of 1 * MB = bytes

Sector size (logical/physical): bytes/512 bytes

I/O size (minimum/optimal): bytes/512 bytes

Disk label Type:dos

Disk identifier:0x9546a42c


Device Boot Start End Blocks Id System

/DEV/VDB1 2048 1026047 512000 8e Linux LVM

/DEV/VDB2 1026048 2050047 512000 8e Linux LVM


Command (M for help): Wq

The partition table has been altered!


Calling IOCTL () to re-read partition table.

Syncing disks.



Pvs|pvdisplay

Vgs|vgdisplay

Lvs|lvdisplay


Monitoring commands

Watch-n 1 \

' echo ' ===pvinfo=== ' \

;p vs\

; echo "===vginfo===" \

; vgs\

; echo "===lvinfo===" \

; lvs\

;d f-h/mnt '


===pvinfo===

PV VG Fmt Attr PSize pfree

/DEV/VDB1 TBR lvm2 a--496.00m 0

/DEV/VDB2 TBR lvm2 a--496.00m 392.00m

===vginfo===

VG #PV #LV #SN Attr vsize vfree

TBR 2 1 0 wz--n-992.00m 392.00m

===lvinfo===

LV VG Attr lsize Pool Origin data% Move Log cpy%sync Convert

Lv0 Tbr-wi-ao----600.00m


Pvcreate/dev/vdb1

Vgcreate WESTOS/DEV/VDB1

Lvcreate-l 100m-n lv0 Westos

Mkfs.xfs/dev/westos/lv0

Mount/dev/westos/lv0/mnt


Lvextend-l 200m/dev/westos/lv0

Xfs_growfs/dev/westos/lv0


Pvcreate/dev/vdb2

Vgextend WESTOS/DEV/VDB2

Lvextend-l 600m/dev/westos/lv0

Xfs_growfs/dev/westos/lv0

Fdisk/dev/sdb


umount/mnt/

Mkfs.ext4/dev/westos/lv0

E2fsck-f/dev/westos/lv0

Resize2fs/dev/westos/lv0 200M

Mount/dev/westos/lv0/mnt

Lvreduce-l 200m/dev/westos/lv0

Pvmove/dev/vdb1/dev/vdb2

Vgreduce WESTOS/DEV/VDB1



Vgreduce--removemissing# #清除不知道的东西


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


Umount/mnt

Lvremove/dev/westos/lv0-backup

Lvremove/dev/westos/lv0

Vgremove Westos

Pvremove/dev/vdb2

Fdisk/dev/vdb


Fdisk/dev/vdb

#!/bin/bash

Fdisk/dev/vdb << End

N




+1g

Wq

End

Format for file.sh command for SH file.sh


This article is from the "12115084" blog, please be sure to keep this source http://12125084.blog.51cto.com/12115084/1871583

2 Unit 5

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.