Red Hat Linux LVM configuration key steps

Source: Internet
Author: User

Prerequisites: 1. Mount the physical disk. 2. Install lvm2 software. The disk contains an RPM file. Find the file and use rpm-IVH lvm2xxxxxxxxx. RPM to install the file. 3. Familiar with Linux operations and knowledge of Linux operations. Step: 1. Use the fdisk command to partition the disk. If you already have three primary partitions (/dev/sda1, sda2, sda3), you must first specify an extension score. Partition, and then partition on the extended partition. Otherwise, a primary partition cannot be created until it is deleted.  The system does not report errors when there are four primary partitions.2. Run the command fdisk/dev/SDA to enter the fdisk command mode. Run the "T" command to change the partition type to the LVM type, numbered 8e3, and run the "P" command to check whether the preceding operation is correct, the W command writes the previous action. After the write is completed, the Q command exits. 4. Run the # partbrobe command or the value # init 6 to restart the machine and make the partition take effect. 5. Create a PV and a physical volume: # pvcreate/dev/sdax (X indicates the ID of the partition .)6. Create a VG and a volume group: # vgcreate vg0/dev/sdax (Vg0 is the name of the volume group, X is the same as above .)7. Create LV, logical volume: # lvcreate-l 1024 M-N lv01 vg0 (The given LV is 1024 M,-N lv01 is the LV name  Lv01, vg0, and above)8. format the created LV: # mkfs. ext3/dev/vg0/lv019, create a folder: mkdir/backup10, Mount lV in the target Folder: Mount/dev/vg0/lv01/backup11, and modify the mount file at startup: /etc/fstab Add/dev/vg0/lv01 to the last line /Backup Ext3 Default 0 0For example, after lvextend is completed, execute the command resizefs2 to reload the logical volume to take effect. (Resize2fs/dev/volgroup00/logvol00) Verification: the system can be restarted successfully. Enter # DF-th to check the mounted LVM and enter the/backup directory. If lost + found exists, if you can create a file, it means it is normal. Possible commands: pvcreate (Create physical volume)

Pvdisplay (display physical volume information)

Pvscan (SCAN physical volume)

Pvmove (transfer physical volume information) pvmove
/Dev/hda1/dev/hda2 (transfer/dev/hda1 data to/dev/hda2)
Pvmove/dev/hda1 (go to/dev/hda1 to another physical volume)

Pvremove (delete physical volume)

 

Vgcreate (create a volume group)

Vgdisplay (display volume group information)

Vgscan (SCAN volume group)

Vgextend) Vgextend
Vg0/dev/hda2 (add the physical volume/dev/hda2 to the vg0 volume group)

Vgreduce (delete physical volumes in a volume group) vgreduce
Vg0/dev/hda2 (delete physical volume/dev/hda2 from volume group vg0)

Vgchange (activate volume group)
Vgchange-A y vg0 (activate volume group vg0) vgchange-a n vg0 (opposite)

Vgremove (delete volume group) Vgremove
Vg0 (delete a volume group vg0)

 

Lvcreate (logical volume creation)

Lvdisplay (display logical volume information)

Lvscan (SCAN logical volume)

Lvextend (Extended logical volume) lvextend
-L + 5g/dev/vg0/data (Extended logical volume/dev/vg0/data 5g)

Lvreduce ()

E2fsck ()

Resize2fs ()

Lvremove (delete logical volume)

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.