Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:cmd:lvm [2021/08/24 11:32] jslinux:cmd:lvm [2022/12/21 09:21] (current) js
Line 7: Line 7:
  
  
-<code bash>lvs -o +devices+<code bash>[root@centos ~]# lvs -o +devices
  
 LV                                   VG                                              Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices LV                                   VG                                              Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices
Line 14: Line 14:
  
  
-<code bash>lvs --segments -o +devices+<code bash>[root@centos ~]# lvs --segments -o +devices
  
 LV                                   VG                                              Attr       #Str Type    SSize  Devices LV                                   VG                                              Attr       #Str Type    SSize  Devices
Line 20: Line 20:
  
 === show logical volume groups === === show logical volume groups ===
-<code bash>vgdisplay</code>+<code bash>[root@centos ~]# vgdisplay</code>
  
 === show logical volume === === show logical volume ===
-<code bash>lvdisplay</code>+<code bash>[root@centos ~]# lvdisplay</code>
  
 === resize physical volume === === resize physical volume ===
 +You can use gparted live ios - do the partition magic .... and after that, resize the logical volume and extent the filesystem.
 +
 Rescan Host: Rescan Host:
-<code bash>echo "- - -" >/sys/class/scsi_host/host0/scan</code>+<code bash>[root@centos ~]# echo "- - -" >/sys/class/scsi_host/host0/scan</code>
  
 check hd: check hd:
-<code bash>fdisk -l+<code bash>[root@centos ~]# fdisk -l
 Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
 Units: sectors of 1 * 512 = 512 bytes Units: sectors of 1 * 512 = 512 bytes
Line 42: Line 44:
 /dev/sda2        411648   8800255   8388608    4G 82 Linux swap / Solaris /dev/sda2        411648   8800255   8388608    4G 82 Linux swap / Solaris
 /dev/sda3       8800256 209715199 200914944 95.8G 8e Linux LVM</code> /dev/sda3       8800256 209715199 200914944 95.8G 8e Linux LVM</code>
 +
 +or user cfdisk / parted:
 +<code bash>cfdisk</code>
 +
 +Get MB of free space:
 +<code bash>parted</code>
 +<code>unit MB</code>
 +<code>print</code>
 +Get the size of the disk in MB
 +<code bash>parted /dev/sda resizepart 2</code>
 +Enter size in MB - e.g. 24242MB
  
 resize resize
-<code bash>[root@nextcloud ~]# pvresize /dev/sda3+<code bash>[root@centos ~]# pvresize /dev/sda3
   Physical volume "/dev/sda3" changed   Physical volume "/dev/sda3" changed
   1 physical volume(s) resized or updated / 0 physical volume(s) not resized</code>   1 physical volume(s) resized or updated / 0 physical volume(s) not resized</code>
      
 check check
-<code bash>[root@nextcloud ~]# pvs+<code bash>[root@centos ~]# pvs
   PV         VG   Fmt  Attr PSize  PFree   PV         VG   Fmt  Attr PSize  PFree
   /dev/sda3  vg00 lvm2 a--  95.80g 70.00g</code>     /dev/sda3  vg00 lvm2 a--  95.80g 70.00g</code>  
  
 === resize logical volume === === resize logical volume ===
-resize logical volume<code bash>lvextend -l +100%FREE <path to lv e.g./dev/fsilun/lvfsilun></code+resize logical volume<code bash>[root@centos ~]# lvextend -l +100%FREE <path to lv e.g./dev/fsilun/lvfsilun> 
-<code>File descriptor 7 (pipe:[13154434]) leaked on lvextend invocation. Parent PID 3865: bash+ 
 +File descriptor 7 (pipe:[13154434]) leaked on lvextend invocation. Parent PID 3865: bash
   Size of logical volume fsilun/lvfsilun changed from 250.00 GiB (64000 extents) to 1000.00 GiB (256000 extents).   Size of logical volume fsilun/lvfsilun changed from 250.00 GiB (64000 extents) to 1000.00 GiB (256000 extents).
   Logical volume lvfsilun successfully resized</code>   Logical volume lvfsilun successfully resized</code>
-and than resize filesystem<code bash>resize2fs -p /dev/fsilun/lvfsilun</code> + 
-<code bash>resize2fs 1.41.12 (17-May-2010)+and than resize filesystem<code bash>[root@centos ~]# resize2fs -p /dev/fsilun/lvfsilun 
 + 
 +resize2fs 1.41.12 (17-May-2010)
 Filesystem at /dev/fsilun/lvfsilun is mounted on /mnt/fsi; on-line resizing required Filesystem at /dev/fsilun/lvfsilun is mounted on /mnt/fsi; on-line resizing required
 old desc_blocks = 16, new_desc_blocks = 63 old desc_blocks = 16, new_desc_blocks = 63