LVM logical volume management commands and lvm logical commands

Source: Internet
Author: User

LVM logical volume management commands and lvm logical commands

# Lvmdiskscan // check all storage devices such as SCSI and IDE
# Lvmchange-R |-reset // reset logical volume manager
# Lvmsadc [full log file path name] // read/write statistics of the receiver logical volume manager, saved to the log file
.
# Full path name of the lvmsar Log File // read and report the logical volume from the log file generated by the lvmsadc command
// Read/write statistics of the manager.

Increase LV in SMSC
Hot_add
Pvcreate/dev/sdj
Vgextend datavg/dev/sdj
Lvcreate-L 60G-n lv_hisdata5 datavg
Lvcreate-L 30G-n lv_index4 datavg
Raw/dev/raw/raw48/dev/datavg/lv_hisdata5
Raw/dev/raw/raw49/dev/datavg/lv_index4
Chown oracle: oinstall/dev/raw/raw48
Chown oracle: oinstall/dev/raw/raw49

Alter tablespace SMSC_CENTER add datafile '/dev/raw/raw48' size 61400 M;
Alter tablespace SMSC_INDEX add datafile '/dev/raw/raw49' size 30700 M;
Modify the VCS script/etc/VRTSvcs/.../main. cf.
 
Modify the dual-machine script and add the raw operation to the dual-machine. The med script is in/opt/App.../bin/oracle/raw. config.


Linux logical volume Management

LVM (logical volume manager) logical volume manager

These concepts are mainly divided
1 physical volume-PV for short
The physical volume is the lowest layer in the logical volume manager. any logical volume and volume group must be created by the physical volume. The physical volume can be a complete hard disk, it can also be a partition in the hard disk.
2 volume group-VG for short
A volume group is built on a physical volume. A volume group can contain one or more physical volume groups.
3 logical volume-LV for short
Logical volumes are created on a volume group. Multiple logical volumes can be created for the space in the volume group, and the logical volumes can be freely increased or decreased from the free space of the volume group, logical volumes can belong to one or multiple volume groups.
4 physical region-PE for short
The physical area is the smallest allocable storage unit in the physical volume.
5. Logical region-LE
The logical zone is the minimum storage unit that can be allocated in the logical volume.
6 volume group description area-VGDA for short
Used to describe the information of physical volumes, Volume groups, and logical volumes.

The process for creating a logical volume is as follows:
PV-VG-LV
Physical Volume includes volume group, volume group includes logical volume

Use logical volume manager in redhat9

1. Use vgscan to generate default configuration files. The configuration files include lvmconf and lvmtab files in/etc.

2. Allocate physical volumes to the logical volume manager
Here I use a partition for/dev/hda9
# Fdisk hda
> T
> 9
> 8e (LVM partition)
> W
Restart
# Pvcreate/dev/hda9
Use
# Pvdisplay/dev/hda9
In this way, the physical volume is created.

3. Create a volume group in a physical volume
# Vgcreate vg0/dev/hda9 where vg0 is the name of the volume group to be created. here, the PE value is 4 MB by default. If you want to increase it, you can use-L to select it. Remember that the PE value cannot be changed once it is set.
# Check whether vgdisplay is successfully created

4. Create a logical volume in the volume group
# Lvcreate-L 100 M-n vg1 vg0
The "-L" option indicates the logical volume size you want. You can run the "-n" command to increase or decrease the logical volume name and volume group name, or use an absolute path to achieve the above purpose.
# Lvdisplay/dev/vg0/vg1
Check whether the creation is successful

5. Create a file system for the logical volume
# Mkfs. ext3/dev/vg0/vg0
Then, check whether the mounting attempt is successfully established.
# Mount/dev/vg0/vg1/home
Such a logical volume is basically formed.

3. logical volume Management

1. Add new physical volumes to the volume group
When the volume group does not have enough space to allocate to the logical volume, you can increase the volume group space by adding a physical volume to the volume group.
# Vgextend vg0/dev/hda8
Note that hda8 must be partitioned by LVM.

2. Expand and reduce the logical volume capacity
# E2fsadm-L + 100 M/dev/vg0/vg1
-L indicates increase or decrease of Space + indicates add-Indicates Creation
# E2fsadm-L-100 M/dev/vg0/vg1
Note that the file system must be ext2 or ext3, and you need to uninstall the file system for execution. To reduce the size, you need to know the size of the cut-off space, otherwise it will cause loss.
Not tested in the reiserfs File System

3. Delete logical volume-volume group-physical volume (delete logical volume in sequence)
# Lvremove/dev/vg0/vg1 Delete logical volume
# Vgremove/... the remaining full text>

What is logical volume Management (LVM )? What are the benefits?

The differences between physical storage devices are hidden under the unified LVM interface.
The advantage is that interfaces are unified, management methods are unified, and dynamic volume scaling can also be performed.

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.