Linux: Difference between revisions

Jump to navigation Jump to search
155 bytes removed ,  2 April 2018
put list of commands in a table
Line 20: Line 20:
=== Physical volume ===
=== Physical volume ===


Initialize for use as LVM physical volume.
{| class="wikitable" border="1" style="border-collapse:collapse"
 
! style="text-align: center;"| Description
<source lang="bash">
! Command
$ pvcreate /dev/sdb1
|-
</source>
| Initialize for use as LVM physical volume.
 
| <code>pvcreate /dev/sdb1</code>
Scanning for block devices.
|-
 
| Scanning for block devices.
<source lang="bash">
| <code>lvmdiskscan</code>
$ lvmdiskscan
|-
</source>
| Display the physical volumes.
 
| <code>pvdisplay</code>
Display the physical volumes.
|-
 
| Show all physical devices.
<source lang="bash">
| <code>pvscan</code>
$ pvdisplay
|-
</source>
| Prevent allocation of physical extents on the free space of one or more physical volumes.
 
| <code>pvchange -x n /dev/sdb1</code>
Show all physical devices.
|-
 
| Resize.
<source lang="bash">
| <code>pvresize</code>
$ pvscan
|-
</source>
| Remove LVM label.
 
| <code>pvremove</code>
Prevent allocation of physical extents on the free space of one or more physical volumes. This may be necessary if there are disk errors, or if you will be removing the physical volume.
|}
 
<source lang="bash">
$ pvchange -x n /dev/sdb1
</source>
 
Resize.
 
<source lang="bash">
$ pvresize
</source>
 
Remove LVM label.
 
<source lang="bash">
$ pvremove
</source>


=== Volume group ===
=== Volume group ===


Create a volume group.
{| class="wikitable" border="1" style="border-collapse:collapse"
 
! style="text-align: center;"| Description
<source lang="bash">
! Command
$ vgcreate vg1 /dev/sdb1 /dev/sdc1
|-
</source>
| Create a volume group.
 
| <code>vgcreate vg1 /dev/sdb1 /dev/sdc1</code>
Add a physical volume to a volume group.
|-
 
| Add a physical volume to a volume group.
<source lang="bash">
| <code>vgextend vg1 /dev/sdd1</code>
$ vgextend vg1 /dev/sdd1
|-
</source>
| Display volume group.
 
| <code>vgdisplay new_vg</code>
Display volume group.
|-
 
| Scan disks for volume groups.
<source lang="bash">
| <code>vgscan</code>
$ vgdisplay new_vg
|-
</source>
| Remove a physical volume from a volume group.
 
| <code>vgreduce group_name /dev/sdc1</code>
Scan disks for volume groups.
|-
 
| Change the maximum number of logical volumes of volume group vg00 to 128.
<source lang="bash">
| <code>vgchange -l 128 /dev/vg00</code>
$ vgscan
|-
</source>
| Activate or deactivate a volume group.
 
| <code>vgchange -a n my_volume_group</code>
Remove a physical volume from a volume group.
|-
 
| Remove a volume group.
<source lang="bash">
| <code>vgremove officevg</code>
$ vgreduce group_name /dev/sdc1
|-
</source>
| Split the physical volumes of a volume group and create a new volume group.
 
| <code>$ vgsplit bigvg smallvg /dev/ram15<br>Volume group "smallvg" successfully split from "bigvg"</code>
Change parameters of a volume group. Change the maximum number of logical volumes of volume group vg00 to 128.
|-
 
| Merge the inactive volume group my_vg into the active or inactive volume group databases giving verbose runtime information.
<source lang="bash">
| <code>vgmerge -v databases my_vg</code>
$ vgchange -l 128 /dev/vg00
|-
</source>
| Change the name of a volume group.
 
| <code>vgrename vg02 my_volume_group</code>
Activate or deactivate a volume group.
|}
 
<source lang="bash">
$ vgchange -a n my_volume_group
</source>
 
Remove a volume group.
 
<source lang="bash">
$ vgremove officevg
</source>
 
Split the physical volumes of a volume group and create a new volume group.
 
<source lang="bash">
$ vgsplit bigvg smallvg /dev/ram15
Volume group "smallvg" successfully split from "bigvg"  
</source>
 
Merge the inactive volume group my_vg into the active or inactive volume group databases giving verbose runtime information.
 
<source lang="bash">
$ vgmerge -v databases my_vg
</source>
 
Change the name of a volume group.
 
<source lang="bash">
$ vgrename vg02 my_volume_group
</source>


= File =
= File =

Navigation menu