Debian lvm disk management-Linux Release Technology-Debian information. For more information, see the following. Author: moting
Test environment: vmware 6.0 green Lite version, debian4.0 r3 only installs the standard system, adds two ide Hard Disks after installation, sets the cn99 source, and upgrades it to the latest status.
1. lvm Installation Process
1. Install lvm
Apt-get install lvm2
2. New Hard Disk Partition
Because the purpose is to increase the capacity, both hard disks are divided into only one primary partition. fdisk/dev/hdb is divided into the primary partition. Use the t command to change the type to 8e, And the other hard disk is also processed.
3. Create a physical volume
Pvcreate/dev/hdb1
Pvcreate/dev/hdd1
Pvscan searches for physical volumes, and pvdisplay queries details of physical volumes. You can use these two commands to check whether the physical volumes are successfully created.
4. Create a volume group
Vgcreate vgftp/dev/hdb1/dev/hdd1
A volume group named vgftp is created.
Vgscan and vgdisplay commands mean the same as pvscan and pvdisplay in section 3. Check.
5. Create a logical volume
Lvcreate-L 20G-n lvftp vgftp
In this way, a logical volume of 20 GB named lvftp is created. Commands such as lvscan and lvdisplay are also available.
6. Format and mount the logical volume.
Mke2fs-j/dev/vgftp/lvftp
Cd/
Mkdir/newftp
Mount/dev/vgftp/vlftp/newftp
2. Delete vg
Vgchang-a-n vgftp
Remove the active attribute of vg
Vgremove-a-n vgftp
3. Delete pv
Pvremove/dev/hdb1
3. Increase lv capacity
If we add another disk or partition hdc, first convert the new hard disk partition into pv. The detailed steps are not described in detail.
Vgextend vgftp/dev/hdc1
Lvextend-L + 7G-n/dev/vgftp/vlftp
Or use lvresize-L + 7G/dev/vgftp/vlftp
It feels better to use lvresize for lv capacity operation
Resize2fs-f/dev/vgftp/vlftp
4. Other lvm commands
Lvreduce to reduce lv capacity
Vgreduce: Extracts pv from vg
Pvmove: removes the data on the specified pv in the group. It is usually used when pv errors Replace the hard disk.
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