Use lvm2 logical volume partition in Debian system

Source: Internet
Author: User
To do this experiment, you need to add a new hard disk, and then you can use the hard disk to test how to install and use lvm. For details about how to add a hard disk to vmware, Refer to Appendix 1. prepare a physical hard disk and partition 1. cfdisk/dev/sdb2. make the hard disk into an extended partition, and write the partition table 3. use fdisk-l to view the hard disk. II. install and

To do this experiment, you need to add a new hard disk, and then you can use the hard disk to test how to install and use lvm. For details about how to add a hard disk to vmware, refer to the appendix.

I. prepare physical hard disks and partitions

1. cfdisk/dev/sdb

2. make the hard disk into an extended partition and write the partition table.

3. use fdisk-l to view the hard disk.

II. install and configure lvm

1. aptitude lvm2

2. initialize the physical volume

# Pvcreate/dev/sdb5

3. create a volume Group

# Vgcreate volgrp/dev/sdb5

4. activate the volume Group

# Vgscan

5. create a logical volume

# Lvcreate-n software -- size 500 M volgrp

6. Format and mount the logical volume

# Mkfs. ext3/dev/volgrp/software

# Mkdir/home/software

# Mount-t ext3/dev/volgrp/software/home/software

7. View logical volumes

# Lvdisplay

8. change the logical volume size.

# Umount/home/software

# Lvextended-L + 500 M/dev/volgrp/software

After the change, you can see that the size has changed in lvdisplay, but the actual file system is still 500 M, so you still need to do the following operations

9. change the physical volume size

# E2fsck-f/dev/volgrp/software

# Resize2fs/dev/volgrp/software

10. mount the logical volume again.

# Mount-t ext3/dev/volgrp/software/home/software

# Df-h

Use df-h to view the partition size.

11. remove logical volumes

# Lvremove/dev/volgrp/software

Premise: umount the logical volume first

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.