Difference between revisions of "Using the Linux LVM"

From PeformIQ Upgrade
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 5: Line 5:
* https://www.golinuxcloud.com/lvremove-command-in-linux/
* https://www.golinuxcloud.com/lvremove-command-in-linux/
* https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/logical_volume_manager_administration/lv_remove
* https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/logical_volume_manager_administration/lv_remove
* https://www.golinuxcloud.com/lvdisplay-command-in-linux/
* https://www.systutorials.com/extending-a-lvm-volume-group/
* https://linuxconfig.org/using-lvm-to-manage-physical-volumes-volume-groups-and-logical-volumes-rhcsa-objective-preparation
* https://www.tecmint.com/add-new-disks-using-lvm-to-linux/
*  
*  
*  
 
=Qustions=
 
== how do i tell if there is a filesystem on a logical volume? ==
 
* https://unix.stackexchange.com/questions/235158/how-to-check-the-filesystem-type-of-a-logical-volume
 
<pre>
root@polaris:/u# file -s /dev/ubuntu-vg/ubuntu-lv
/dev/ubuntu-vg/ubuntu-lv: symbolic link to ../dm-0
root@polaris:/u#
root@polaris:/u# file -s /dev/ubuntu-vg/lv1
/dev/ubuntu-vg/lv1: symbolic link to ../dm-1
 
root@polaris:/u# file -L -s /dev/ubuntu-vg/lv1
/dev/ubuntu-vg/lv1: data
root@polaris:/u# file -L -s /dev/ubuntu-vg/ubuntu-lv
/dev/ubuntu-vg/ubuntu-lv: Linux rev 1.0 ext4 filesystem data, UUID=7c6ecda7-f151-4445-93e9-1244e2f50098 (needs journal recovery) (extents) (64bit) (large files) (huge files)
 
 
</pre>
 
 




Line 12: Line 38:


<pre>
<pre>
lvremove option LV
lvremove option LV
lvscan
lvscan
pvdisplay
pvdisplay
lvmdiskscan
lvmdiskscan
lvremove vol_grp/lvol1


</pre>
</pre>
Line 117: Line 147:


</pre>
</pre>
=Working with FDISK=
* https://linuxize.com/post/fdisk-command-in-linux/
<pre>
</pre>




[[Category:Infrastructure]]
[[Category:Infrastructure]]
[[Category:Linux]]
[[Category:Linux]]

Latest revision as of 20:48, 21 August 2022

Links

Qustions

how do i tell if there is a filesystem on a logical volume?

root@polaris:/u# file -s /dev/ubuntu-vg/ubuntu-lv
/dev/ubuntu-vg/ubuntu-lv: symbolic link to ../dm-0
root@polaris:/u#
root@polaris:/u# file -s /dev/ubuntu-vg/lv1
/dev/ubuntu-vg/lv1: symbolic link to ../dm-1

root@polaris:/u# file -L -s /dev/ubuntu-vg/lv1
/dev/ubuntu-vg/lv1: data
root@polaris:/u# file -L -s /dev/ubuntu-vg/ubuntu-lv
/dev/ubuntu-vg/ubuntu-lv: Linux rev 1.0 ext4 filesystem data, UUID=7c6ecda7-f151-4445-93e9-1244e2f50098 (needs journal recovery) (extents) (64bit) (large files) (huge files)




Command Examples


lvremove option LV
lvscan
pvdisplay
lvmdiskscan

lvremove vol_grp/lvol1



u# lvm
lvm> lvmdiskscan
  /dev/loop0 [      61.96 MiB]
  /dev/loop1 [     <79.95 MiB]
  /dev/sda1  [      <1.05 GiB]
  /dev/loop2 [      46.96 MiB]
  /dev/sda2  [       2.00 GiB]
  /dev/loop3 [     <61.96 MiB]
  /dev/sda3  [    <462.71 GiB] LVM physical volume
  /dev/loop4 [     <43.86 MiB]
  /dev/sdb   [     <27.96 GiB]
  1 disk
  7 partitions
  0 LVM physical volume whole disks
  1 LVM physical volume
lvm>
lvm> pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               ubuntu-vg
  PV Size               <462.71 GiB / not usable 3.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              118453
  Free PE               92853
  Allocated PE          25600
  PV UUID               UhkItV-lktv-M90s-QQ0K-3VpD-fXYN-TOzKI6

lvm> vgdisplay
  --- Volume group ---
  VG Name               ubuntu-vg
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <462.71 GiB
  PE Size               4.00 MiB
  Total PE              118453
  Alloc PE / Size       25600 / 100.00 GiB
  Free  PE / Size       92853 / <362.71 GiB
  VG UUID               wrbg12-UAib-VOEF-c03c-ViIc-WADv-irQQbc

lvm> lvcreate -L 10G -n lv1 vg1
  Volume group "vg1" not found
  Cannot process volume group vg1
lvm> lvcreate -L 200G -n lv1 ubuntu-vg
  Logical volume "lv1" created.
lvm> lvdisplay
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/ubuntu-lv
  LV Name                ubuntu-lv
  VG Name                ubuntu-vg
  LV UUID                pedAP4-9fA7-zfZE-NLkU-1SSX-TaZY-nNB5vD
  LV Write Access        read/write
  LV Creation host, time ubuntu-server, 2022-08-17 09:50:49 +1000
  LV Status              available
  # open                 1
  LV Size                100.00 GiB
  Current LE             25600
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/lv1
  LV Name                lv1
  VG Name                ubuntu-vg
  LV UUID                THHlpH-FHD4-dyMM-NYrz-fGmw-VwV6-bG9YnN
  LV Write Access        read/write
  LV Creation host, time polaris, 2022-08-21 14:01:17 +1000
  LV Status              available
  # open                 0
  LV Size                200.00 GiB
  Current LE             51200
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

lvm> lvscan
  ACTIVE            '/dev/ubuntu-vg/ubuntu-lv' [100.00 GiB] inherit
  ACTIVE            '/dev/ubuntu-vg/lv1' [200.00 GiB] inherit

Working with FDISK