Tuesday, July 22, 2014

Extend a logical volume on a encrypted disk

My encrypted disk shows up as a 'double' volume in the 'Disk Utility' as shown in the following figure





You can see both volumes show up as 253 GB. I think it means the encrypted volume is using the LVM2 Physical Volume. Then the encrypted volume contains 5 mapped volumes which are listed under 'Peripheral Devices'. Initially they where:

  • Home: 4GB
  • NotBackedUp: 8GB
  • Root: 15 GB
  • Swap: 4 GB
  • VirtualMachines: 29GB
This totals  about 60 GB, and 'vgdisplay HelpDeskRHEL6' shows:

# vgdisplay HelpDeskRHEL6
  --- Volume group ---
  VG Name               HelpDeskRHEL6
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                5
  Open LV               5
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               235.47 GiB
  PE Size               4.00 MiB
  Total PE              60280
  Alloc PE / Size       15346 / 59.95 GiB
  Free  PE / Size       44934 / 175.52 GiB
  VG UUID               zXN22u-w74k-PxAn-RhB0-QZib-Pg0e-apCHx0





Which show the Alloc Size of 59.95 GB, and it also shows I still have 175.52 GB of Free Size. I want to use that as part of my 'NotBackedUp' Logical Volume and I use lvextend to add 150GB to it:

# lvextend -L 150G /dev/HelpDeskRHEL6/NotBackedUp
  Extending logical volume NotBackedUp to 150.00 GiB
  Logical volume NotBackedUp successfully resized


Next, to actually use the extra space we need to resize the filesystem using resize2fs

# resize2fs /dev/HelpDeskRHEL6/NotBackedUp
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/HelpDeskRHEL6/NotBackedUp is mounted on /NotBackedUp; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 10
Performing an on-line resize of /dev/HelpDeskRHEL6/NotBackedUp to 39321600 (4k) blocks.
The filesystem on /dev/HelpDeskRHEL6/NotBackedUp is now 39321600 blocks long.
 

and to verify we can see the large NotBackedUp Volume I use df:

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/HelpDeskRHEL6-Root
                       15G  7.5G  6.2G  55% /
tmpfs                 7.7G  600K  7.7G   1% /dev/shm
/dev/mapper/HelpDeskRHEL6-NotBackedUp
                      148G  7.5G  133G   6% /NotBackedUp
/dev/mapper/HelpDeskRHEL6-VirtualMachines
                       29G  8.2G   20G  30% /VirtualMachines
/dev/sda1             3.0G   93M  2.8G   4% /boot
/dev/mapper/HelpDeskRHEL6-Home
                      4.0G  260M  3.5G   7% /home

 

No comments: