|
Physical Volume Management
pvchange
pvchange command allows the administrator to assign permission to change the physical volumes. If the physical volume fails, you can use pvchange order prohibiting PE allocation of physical volume.
Syntax pvchange (option) (arguments)
Options
-u: generate a new UUID;
-x: whether to allow the allocation of PE.
parameter
Physical volume: Specify To modify the properties of the physical volume of the corresponding device file.
Examples
Use pvchange order prohibiting distribution of the specified PE physical volume.
PE pvchange -x n / dev / sdb1 # prohibit assignment "/ dev / sdb1" on: Enter the following command at the command line
Output information is as follows:
Physical volume "/ dev / sdb1" changed
1 physical volume changed / 0 physical volumes not changed
pvcreate
pvcreate command to initialize a physical disk partition as a physical volume for LVM to use.
Syntax pvcreate (option) (arguments)
Options
-f: Force the creation of the physical volumes, without user confirmation;
-u: UUID specified equipment;
-y: all questions are answered "yes";
-Z: Whether the use of the first four sectors.
Parameters of the physical volume: the physical volumes to be created corresponding device file name.
Will turn into 6-9 partition pv, note the use of curly braces:
[Root @ localhost ~] # pvcreate / dev / hda {6,7,8,9}
Physical volume "/ dev / hda6" successfully
created Physical volume "/ dev / hda7" successfully created
Physical volume "/ dev / hda8" successfully created
Physical volume "/ dev / hda9" successfully created
pvremove
pvremove command is used to delete an existing physical volume. Use pvremove command removes the physical volume,
Physical volume information will LVM partition deleted, it will not be seen as a physical volume.
grammar:
pvremove (Option) (arguments)
Options
-d: debug mode;
-f: Force Delete;
-y: to answer questions "yes".
parameter
Physical volume: device file name corresponding to the physical volume to be deleted.
Examples
Use pvremove command removes the physical volume / dev / sdb2.
Enter the following command at the command line: pvremove / dev / sdb2 # remove the physical volume
Labels on physical volume "/ dev / sdb2" successfully wiped
From: http://man.linuxde.net/pvremove
pvs
pvs command is used to report the physical volume information formatted output. The pvs command only to give brief information about the physical volumes,
If you want to get more detailed information can be used pvdisplay command.
grammar
pvs (Option) (arguments)
Options
--noheadings: The title is not output head;
--nosuffix: no output space units.
parameter
Physical volume: Physical volume list for a report to be displayed.
Examples
The pvs command to display information about all reports of physical volumes.
Enter the following command at the command line: pvs
# Output physical volume information report output information is as follows:
PV VG fmt Attr PSize PFree / dev / sdb1 vg1000 lvm2 - 100.00M 100.00M / dev / sdb2 lvm2 - 101.98M 101.98M
pvresize
pvdisplay
pvscan
Command scans all hard pvscan connected in the system, a list of physical volumes are listed found.
Use pvscan command -n option to display the hard disk does not belong to any volume group physical volume, these physical volumes are not in use.
grammar
pvscan (option) Options
-d: debug mode;
-e: display only part of the physical volume output volume group;
-n: Display only the physical volume does not belong to any volume group;
-s: short format output; -u: display UUID.
Examples
Use pvscan command scans all hard drives in the current system of physical volumes,
Enter the following command at the command line:
[Root @ localhost ~] # pvscan # Scan all physical volumes on the hard disk
Output information is as follows:
PV / dev / sdb1 lvm2 [101.94 MB] PV / dev / sdb2 lvm2 [101.98 MB]
Total: 2 [203.92 MB] / in use: 0 [0] / in no VG: 2 [203.92 MB]
Volume Group Management
vgcreate
vgcreate command to create LVM volume group. Volume group (Volume Group) will organize multiple physical volumes into one whole,
Shielding the details of the underlying physical volumes. On the volume group without regard to the specific physical volume information when you create a logical volume.
grammar
vgcreate (Option) (arguments)
Options
-l: maximum number of logical volumes created on a volume group;
-p: volume group maximum number of physical volumes allowed to be added;
-s: PE size of the volume group on the physical volumes.
parameter
Volume group name to be created; list of physical volumes:: The volume group name to be added to the volume group physical volume list.
Examples
Use vgcreate command to create a volume group "vg1000", and adds the physical volume / dev / sdb1 and / dev / sdb2 to the volume group.
Enter the following command at the command line:
[Root @ localhost ~] # vgcreate vg1000 / dev / sdb1 / dev / sdb2 # Create volume group "vg1000"
Output information is as follows:
Volume group "vg1000" successfully created
vgremove
vgremove commands for users to delete LVM volume group. When you want to delete the logical volume group has been created, vgremove command is required to confirm the deletion,
Prevent accidental deletion of data.
grammar
vgremove (Option) (arguments)
Options
-f: Force deleted.
parameter
Volume group: Specifies the volume group name to be deleted.
Examples
Use vgremove command to delete the LVM volume group "vg1000".
Enter the following command at the command line:
[Root @ localhost ~] # vgremove vg1000 # delete volume group
"Vg1000" Volume group "vg1000" successfully removed
vgextend
vgextend command for dynamic expansion of the LVM volume group it by adding physical volumes to the volume group to increase the capacity of the volume group.
LVM volume group physical volume when you create a volume group using vgcreate command to add, you can also use vgextend command to dynamically add.
Grammar
vgextend (Option) (arguments)
Options
-d: debug mode;
-t: test only.
Parameters
Volume group: Specifies the volume group name to be operated; list of physical volumes: specify the volume group to be added to the list of physical volumes.
Examples
Use vgextend command to add a physical volume to a volume group "vg2000" in.
Enter the following command at the command line:
[Root @ localhost ~] # vgextend vg2000 / dev / sdb2 # physical volume "/ dev / sdb2" added volume group "vg2000"
Output information is as follows:
Volume group "vg2000" successfully extended
vgreduce
vgreduce command to reduce capacity by removing LVM volume group volume group physical volume. LVM volume group can not delete the last remaining physical volumes.
grammar
vgreduce (Option) (arguments)
Options
-a: If you do not specify a command line to remove the physical volumes, remove all empty physical volumes;
--removemissing: Delete volume group missing physical volume, volume group to make a return to normalcy.
parameter
Volume group: Specifies the volume group name to be operated; physical volume list: a list of physical volumes to be deleted.
Examples
Use vgreduce command to remove the physical volume / dev / sdb2 from the volume group "vg2000" in.
Enter the following command at the command line:
[Root @ localhost ~] # vgreduce vg2000 / dev / sdb2 # physical volume "/ dev / sdb2" remove from the volume group "vg2000" in
Output information is as follows: Removed "/ dev / sdb2" from volume group "vg2000"
vgchange
vgchange command is used to modify the properties of the volume group is often used to set the volume group is active or inactive. Active volume group can not be deleted,
You must use the vgchange command to set the volume group can be deleted inactive.
grammar
vgchange (Option) (arguments)
Options
-a: the active state of the volume group.
parameter
Volume Group: To set the properties of the specified volume group.
Examples
Volume group using vgchange command to change the status of activities.
Enter the following command at the command line:
[Root @ localhost ~] # vgchange -ay vg1000 # volume group "vg1000" set as active
Output information is as follows:
1 logical volume (s) in volume group "vg1000" now active
vgscan vgdisplay
Logical Volume Management
lvcreate
lvcreate command is used to create an LVM logical volume. It is to create a logical volume on a volume group. Logical device file saved in the volume group directory,
For example: Create a Logical Volume "lvol0" volume group "vg1000" on this logical volume corresponding device file "/ dev / vg1000 / lvol0".
grammar
lvcreate (Option) (arguments)
Options
-L: Specifies the size of the logical unit is "kKmMgGtT" byte;
-l: Specifies the size of the logical volume (LE number).
parameter
Logical Volume: Specifies the logical volume name to create.
Examples
Use lvcreate command to create a 200MB logical volume in volume group "vg1000" on.
Enter the following command at the command line:
[Root @ localhost ~] # lvcreate -L 200M vg1000 # Create a logical volume size of 200M
Output information is as follows:
Logical volume "lvol0" created
lvremove
lvremove command to delete the specified LVM logical volume. If the logical volume is already using the mount command to load, you can not use the delete command lvremove.
You must use the command umount unloading only logical volume is deleted.
grammar
lvremove (Option) (arguments)
Options
-f: Force deleted.
parameter
Logical Volume: Specifies to delete the logical volume.
Examples
Use lvremove command deletes the specified logical volume.
Enter the following command at the command line:
[Root @ localhost ~] # lvremove / dev / vg1000 / lvol0 # Removing a Logical Volume "lvol0"
Output information is as follows:
Do you really want to remove active logical volume "lvol0" [y / n]:? Y # Confirm Delete Logical volume "lvol0" successfully removed
lvextend
lvextend command disk space management lvextend command line extended logical volume without interrupting the application access to the logical volume.
Use lvextend command-line dynamic expansion of disk space, spatial expansion process for the entire application is completely transparent.
Grammar
lvextend (Option) (arguments)
Options
-L: Specifies the size of the logical unit is "kKmMgGtT" byte;
-l: Specifies the size of the logical volume (LE number).
Parameters
Logical Volume: Specifies the extended space of the logical volume.
Examples
Lvextend command using the logical volume / dev / vg1000 / lvol0 increase 100M space.
Enter the following command at the command line:
[Root @ localhost ~] # lvextend -L + 100M / dev / vg1000 / lvol0 # To address space to increase 100M
Output information is as follows:
Extending logical volume lvol0 to 300.00 MB Logical volume lvol0 successfully resized
lvresize
lvresize command is used to adjust the LVM logical volume size of the space, the space can be increased and reduced space. When using lvresize command to adjust the size of the logical volume space and narrow space need to be careful,
Because it could lead to data loss.
Syntax lvresize (option) (arguments)
Options
-L: Specifies the size of the logical unit is "kKmMgGtT" byte;
-l: Specifies the size of the logical volume (LE number).
parameter
Logical Volume: Specifies to delete the logical volume.
Examples
Use lvresize command to adjust the maximum logical volume size.
Enter the following command at the command line:
[Root @ localhost ~] # lvresize -L + 200M / dev / vg1000 / lvol0 # logical space will increase 200M
Output information is as follows:
Extending logical volume lvol0 to 280.00 MB Logical volume lvol0 successfully resized
lvreduce
lvreduce disk management commands lvreduce command for reducing the size of the space occupied by the LVM logical volume. Use lvreduce command shrink the size of the logical volume space may delete existing data on the logical volume,
So before the operation must be confirmed.
grammar
lvreduce (Option) (arguments)
Options
-L: Specifies the size of the logical unit is "kKmMgGtT" byte;
-l: Specifies the size of the logical volume (LE number).
parameter
Logical Volume: Specifies the logical device file to be operated.
Examples
Use lvreduce order to reduce the size of the space specified logical volume.
Enter the following command at the command line:
[Root @ localhost ~] # lvreduce -L -50M / dev / vg1000 / lvol0 # reduce the size of the logical volume space 50M
Output information is as follows:
...... Output omitted content ...... Do you really want to reduce lvol0 [y / n]:? Y # to confirm the operation
Reducing logical volume lvol0 to 252.00 MB Logical volume lvol0 successfully resized
lvchange lvrename
lvdisplay
LVM logical volume space, read and write status information and snapshots command to display attributes such as lvdisplay. If you omit the "logical" argument,
Lvdisplay command displays all the attributes of the logical volume. Otherwise, it shows only the specified logical attributes.
grammar
lvdisplay (parameters)
parameter
Logical Volume: Specifies the logical device file attributes.
Examples
Use lvdisplay command displays the specified logical volume attributes.
Enter the following command at the command line:
[Root @ localhost ~] # lvdisplay / dev / vg1000 / lvol0 # Displaying the Logical Properties
Output information is as follows: --- Logical volume --- LV Name / dev / vg1000 / lvol0 ...... part output omitted ...... Block device 253: 0
lvscan
lvscan command is used to scan all LVM logical volumes that exist in the current system. Use lvscan instructions can be found in the system all the logical volumes,
And its corresponding device file.
Grammar
lvscan (option)
Options
-b: Display logical volume main and minor device numbers.
Examples
Use lvscan command scans all logical systems.
Enter the following command at the command line:
[Root @ localhost ~] # lvscan # scans all logical volumes
Output information is as follows: ACTIVE '/ dev / vg1000 / lvol0' [200.00 MB] inherit |
|
|
|