2

I am running a Xubuntu 14.04.5 LTS machine with Logical volume management. One of the physical disks (sda) has some space left and I want to allocate it to one of the logical volumes (xubuntu--vg-home).

Some details:

sudo lsblk gives

NAME                           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                              8:0    0 232,9G  0 disk  
├─sda1                           8:1    0   512M  0 part  /boot/efi
├─sda2                           8:2    0   244M  0 part  /boot
└─sda3                           8:3    0   223G  0 part  
  ├─xubuntu--vg-root (dm-0)    252:0    0    40G  0 lvm   /
  ├─xubuntu--vg-swap_1 (dm-1)  252:1    0  31,9G  0 lvm   
  │ └─cryptswap1 (dm-4)        252:4    0  31,9G  0 crypt [SWAP]
  └─xubuntu--vg-home (dm-2)    252:2    0 100,1G  0 lvm   /home

and sudo pvdisplay -m

--- Physical volume ---
PV Name               /dev/sda3
VG Name               xubuntu-vg
PV Size               223,00 GiB / not usable 3,00 MiB
Allocatable           yes 
PE Size               4,00 MiB
Total PE              57087
Free PE               13036
Allocated PE          44051
PV UUID               OcYxXO-aGpI-A42q-n0H0-19Tj-78zG-kcqOiU

--- Physical Segments ---
Physical extent 0 to 10251:
  Logical volume    /dev/xubuntu-vg/root
  Logical extents   0 to 10251
Physical extent 10252 to 35883:
  Logical volume    /dev/xubuntu-vg/home
  Logical extents   0 to 25631
Physical extent 35884 to 44050:
  Logical volume    /dev/xubuntu-vg/swap_1
  Logical extents   0 to 8166
Physical extent 44051 to 57086:
  FREE

My question is:

I want to extend the logical volume xubuntu--vg-home to use all free space that is left on the disk. Should I reorder the logical volumes xubuntu--vg-swap_1 and xubuntu--vg-home before extending so that xubuntu--vg-home becomes coherent, regarding physical segments, after extension?

2

No. The whole point of LVM is that you can assign space to LVs without consideration of where the data is stored.

Also, actually doing so is going to be complicated, since there are no commands to do so.

3
  • I agree there's no point in doing this, but there is a command to do so: pvmove can move PEs (not just PVs). Mar 18 '17 at 11:44
  • Yes, I should have clarified: you can get it done manually, by telling pvmove to move extents from here to there. What I meant is that you can't tell it to move things around so they're optimized again in an automatic fashion Mar 18 '17 at 13:09
  • A sort of pvdefrag ;-) Mar 18 '17 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.