LVM volume usage in REDTAT

Source: Internet
Author: User
Use the LVM volume in REDTAT-Linux general technology-Linux technology and application information. The following is a detailed description. What is LVM? The disk can be dynamically resized.

The disk system is 8e.

LVM composition:
1. physical volume (PV)
2. Volume group (VG)
3. logical volume (LV)

Create a physical volume (PV ):
Pvcreate/dev/sdb1

View PV: pvdisplay

Create a volume group (VG ):
Vgcreate VG/dev/sdb1
View volume group: vgdisplay

Create logical volume (LV ):
Lvcreate-L 800 M-n LV VG
View logical volumes:
Lvdisplay

Format and mount:
Mkfs. ext3/dev/VG/LV
Mount/dev/VG/LV/ftp
Set automatic mounting upon startup:
Vim/etc/fstab

After a period of use, the disk has no available space. In this case, you need to resize the disk.
1. Create a physical volume (PV ):
Pvcreate/dev/sdc1
2. Add the new physical volume to the volume group VG:
Vgextend VG/dev/sdc1
3. Draw a volume from the volume group to the logical volume:
Lvextend-L + 1G/dev/VG/LV

Note: After the configuration is complete, refresh it with resize2fs/dev/VG/LV. Otherwise, the newly added PV cannot be recognized.

Advanced LVM applications

Volume snapshot: temporarily freeze the content of the logical volume (at this time, the capacity of the VG must be greater than the capacity of the logical volume)
Lvcreate-L 1G-s-n backup/dev/VG/LV
Mount and use:
Mount/dev/VG/backup/mnt
When used, it is directly restored from the snapshot.
Delete a snapshot:
Lvremove/dev/VG/backup
(When the snapshot is deleted, it is not attached)

Mobile volume:
Because three disks have been used for several years and the daily access volume is too large, they are no longer available, but the data is very important. At this time, the company bought a better disk, if you want to replace the three disks, you need to use the mobile volume.
1. Create a new disk as PV
Pvcreate/dev/sde1
2. Add to VG
Vgextend VG/dev/sde1
3. import data from the old PV to the new PV.
Pvmove/dev/sdb1/dev/sde1, pvmove/dev/sdc1/dev/sde1, pvmove/dev/sdd1/dev/sde1
4. Delete the three disks from VG
Vgreduce VG/dev/sdb1, vgreduce VG/dev/sdc1, vgreduce VG/dev/sdd1
5. delete three disks from PV:
Pvremove/dev/sdb1, pvremove/dev/sdc1, and pvremove/dev/sdd1
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.