User Tools

Site Tools


ubuntu:lvm:resize_lvm_partition_inside_an_extended_partition

Ubuntu - LVM - Resize LVM Partition Inside an Extended Partition

Resizing a logical volume is not very difficult and can be achieved through very straightforward approach.

Here are the usual steps:

  • Create a new partition on the hard disk.
  • Add the partition just created as a physical volume.
  • Add the new physical volume to the volume group.
  • Assign space from the volume group to the logical volume.
  • Resize the filesystem.

But in this scenario, the root filesystem (as an LVM partition) is mounted under an extended partition, not within a primary partition.

  • You just have one primary partition which is mounted on /boot and rest of the space is part of that extended partition.

ALERT: Please keep in mind that you should be very careful while dealing with disk partitions.


Show the usage of the disk space

df -hT

returns:

Filesystem                Type   Size  Used Avail Use% Mounted on
tmpfs                     tmpfs  3.2G  4.9M  3.2G   1% /run
/dev/mapper/vg01-root     ext4   9.1G  740M  8.0G   9% /
/dev/mapper/vg01-usr      ext4    20G  5.4G   14G  30% /usr
tmpfs                     tmpfs   16G     0   16G   0% /dev/shm
tmpfs                     tmpfs  5.0M     0  5.0M   0% /run/lock
tmpfs                     tmpfs   16G     0   16G   0% /run/qemu
tmpfs                     tmpfs   16G     0   16G   0% /run/shm
/dev/mapper/vg01-sharewiz ext4   9.5G  932M  8.1G  11% /sharewiz
/dev/mapper/vg01-home     ext4    32G   12G   19G  39% /home
/dev/mapper/vg01-opt      ext4   1.8G   36K  1.7G   1% /opt
/dev/mapper/vg01-var      ext4    65G   59G  4.5G  93% /var
/dev/mapper/vg01-backup   ext4   8.3G  7.7G  276M  97% /backup
/dev/sda3                 ext4   1.8G  264M  1.5G  16% /boot
/dev/mapper/vg01-srv      ext4   105G   83G   19G  82% /srv
tmpfs                     tmpfs  3.2G     0  3.2G   0% /run/user/1000

Show the current status of physical volumes, volume groups and logical volumes

lvs

returns:

  LV       VG   Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  backup   vg01 -wi-ao----    8.72g                                                    
  home     vg01 -wi-ao----  <41.86g                                                    
  opt      vg01 -wi-ao----   <1.86g                                                    
  root     vg01 -wi-ao----   <9.86g                                                    
  sharewiz vg01 -wi-ao----   <9.86g                                                    
  srv      vg01 -wi-ao---- <106.86g                                                    
  swap     vg01 -wi-ao----    4.00g                                                    
  usr      vg01 -wi-ao----  <21.86g                                                    
  var      vg01 -wi-ao----  <65.86g                                                    

pvs

returns:

  PV         VG   Fmt  Attr PSize    PFree 
  /dev/sda4  vg01 lvm2 a--  <272.22g <1.48g

vgs

returns:

  VG   #PV #LV #SN Attr   VSize    VFree 
  vg01   1   9   0 wz--n- <272.22g <1.48g

lsblk

returns:

NAME              MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda                 8:0    0 278.9G  0 disk 
├─sda1              8:1    0  39.2M  0 part 
├─sda2              8:2    0     2G  0 part 
├─sda3              8:3    0   1.9G  0 part /boot
└─sda4              8:4    0 272.2G  0 part 
  ├─vg01-swap     253:0    0     4G  0 lvm  [SWAP]
  ├─vg01-root     253:1    0   9.9G  0 lvm  /
  ├─vg01-usr      253:2    0  21.9G  0 lvm  /usr
  ├─vg01-var      253:3    0  65.9G  0 lvm  /var
  ├─vg01-srv      253:4    0 106.9G  0 lvm  /srv
  ├─vg01-opt      253:5    0   1.9G  0 lvm  /opt
  ├─vg01-home     253:6    0  41.9G  0 lvm  /home
  ├─vg01-backup   253:7    0   8.7G  0 lvm  /backup
  └─vg01-sharewiz 253:8    0   9.9G  0 lvm  /sharewiz
sr0                11:0    1  1024M  0 rom  

ubuntu/lvm/resize_lvm_partition_inside_an_extended_partition.txt · Last modified: 2024/07/30 15:18 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki