[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to Resize Partition on LVM



According to "man lvm", to add a physical volume to a volume group, the right command is "vgextend" (the name is because you make a volume group (VG) larger by adding more storage space for it, in a new physical volume). To create a new volume group, the command is "vgcreate". But if you want to add a filesystem, you *need not* (and very likely, should not) add a volume group nor a physical volume. What you need is: (1) Create a local volume within your existing volume groups; use lvcreate for that. (2) Make a filesystem with "mkfs.ext4" (or similar, for other filesystem type). (3) Optionally add a corresponding entry in /etc/fstab and mount the new filesystem.

A typical structure is this (where "->" means "stored in"); it is not the only possible layout, but it is likely the most common one and seems to be the one you are using:

Files -> Filesystem -> LVM LV -> LVM VG -> LVM PV
  -> Partition -> Disc or SSD

The structure is NOT hierarchical, and not all of these arrows represent the same relationship between components. In particular, note that a LVM VG does both grouping and ungrouping: It *takes* storage space from (possibly several) physical volumes, and it *provides* storages space to (possibly several) *logical volumes*.

The main information resource are the main pages. Also see <http://www.tldp.org/HOWTO/LVM-HOWTO/index.html>. Do your own research.

El 25/10/15 a las 19:22, ray escribió:
Mario,

Thank you for the review.

Yes, there is free space in the LVM.  I have gone through the manual many times (today and the last several months) and don't see a method to add a pv or vg.  It seems to add a pv, it needs a device.  And to add a vg, it needs a pv.  How can I add either?

Displaying the resize pv:
# pvdisplay -v -m
     DEGRADED MODE. Incomplete RAID LVs will be processed.
     Scanning for physical volume names
   --- Physical volume ---
   PV Name               /dev/sda5
   VG Name               mycomp-vg
   PV Size               55.00 GiB / not usable 3.00 MiB
   Allocatable           yes
   PE Size               4.00 MiB
   Total PE              14079
   Free PE               1695
   Allocated PE          12384
                  (the file system is smaller than the pv)
  lsblk
NAME                   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                      8:0    0   477G  0 disk
├─sda1                   8:1    0   243M  0 part /boot
├─sda2                   8:2    0     1K  0 part
└─sda5                   8:5    0 476.7G  0 part
   ├─mycomp--vg-root   254:0    0   8.4G  0 lvm  /
   ├─mycomp--vg-var    254:1    0   2.8G  0 lvm  /var
   ├─mycomp--vg-swap_1 254:2    0  31.9G  0 lvm  [SWAP]
   ├─mycomp--vg-tmp    254:3    0   380M  0 lvm  /tmp
   └─mycomp--vg-home   254:4    0     5G  0 lvm  /home




Reply to: