Install and use lvm2 In debian

Source: Internet
Author: User
Install and use the lvm2-Linux Release Technology-debian information In Debian. The following is a detailed description. 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

Appendix: how to add a hard disk for debian in vmware?
1. Disable debian
Shutdown-h now
2. in vmware's edit virtual machines settings
3. Add a hard disk and select scsi.

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.