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 [2020/07/24 11:51] – [show physical volume] jslinux:cmd:lvm [2022/12/21 09:21] (current) js
Line 6: Line 6:
 <code bash>pvdisplay -C</code> <code bash>pvdisplay -C</code>
  
 +
 +<code bash>[root@centos ~]# lvs -o +devices
 +
 +LV                                   VG                                              Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices
 +6a8853c1-b0d5-86a0-5580-5447327106cd XSLocalEXT-6a8853c1-b0d5-86a0-5580-5447327106cd -wi-ao---- 29.96g                                                     /dev/sdb(0),/dev/sdc3(0),/dev/sda(0)
 +</code>
 +
 +
 +<code bash>[root@centos ~]# lvs --segments -o +devices
 +
 +LV                                   VG                                              Attr       #Str Type    SSize  Devices
 +6a8853c1-b0d5-86a0-5580-5447327106cd XSLocalEXT-6a8853c1-b0d5-86a0-5580-5447327106cd -wi-ao----    3 striped 29.96g /dev/sdb(0),/dev/sdc3(0),/dev/sda(0)</code>
  
 === 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 === 
 +You can use gparted live ios - do the partition magic .... and after that, resize the logical volume and extent the filesystem. 
 + 
 +Rescan Host: 
 +<code bash>[root@centos ~]# echo "- - -" >/sys/class/scsi_host/host0/scan</code> 
 + 
 +check hd: 
 +<code bash>[root@centos ~]# fdisk -l 
 +Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors 
 +Units: sectors of 1 * 512 = 512 bytes 
 +Sector size (logical/physical): 512 bytes / 512 bytes 
 +I/O size (minimum/optimal): 512 bytes / 512 bytes 
 +Disklabel type: dos 
 +Disk identifier: 0x4952fe1d 
 + 
 +Device     Boot   Start       End   Sectors  Size Id Type 
 +/dev/sda1  *       2048    411647    409600  200M 83 Linux 
 +/dev/sda2        411648   8800255   8388608    4G 82 Linux swap / Solaris 
 +/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 
 +<code bash>[root@centos ~]# pvresize /dev/sda3 
 +  Physical volume "/dev/sda3" changed 
 +  1 physical volume(s) resized or updated / 0 physical volume(s) not resized</code> 
 +   
 +check 
 +<code bash>[root@centos ~]# pvs 
 +  PV         VG   Fmt  Attr PSize  PFree 
 +  /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